boa-cat 0.7.2

Tree-walking ECMAScript interpreter built on ecma-syntax-cat. v0.7.2 lands three integration tests pinning down the existing `new SomeNativeFn(args)` dispatch path: `expression::construct` allocates a fresh empty Object as `this`, hands it to `call_function`, and honours the spec's "return the Object the constructor produced, else fall back to `this`" semantics. Embedders (e.g. `web-api-cat`'s `Event` / `CustomEvent` constructors) can now rely on this surface without reverse-engineering the implementation. No source change.
//! Completion records: the spec's abrupt-completion mechanism, lifted into
//! a sum type the interpreter can return from statement evaluation.

use crate::value::Value;

/// The result of evaluating a statement.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Completion {
    /// Normal completion with an optional value (the result of an
    /// `Expression` statement, the body of a block, etc.).
    Normal(Value),
    /// `return value;`
    Return(Value),
    /// `throw value;`
    Throw(Value),
    /// `break;` (labeled break deferred to v0.2).
    Break,
    /// `continue;` (labeled continue deferred to v0.2).
    Continue,
}

impl Completion {
    /// Whether this completion is abrupt (anything other than `Normal`).
    #[must_use]
    pub fn is_abrupt(&self) -> bool {
        !matches!(self, Self::Normal(_))
    }
}