boa-cat 0.3.1

Tree-walking ECMAScript interpreter built on ecma-syntax-cat. v0.3.0 added accessor-property support at the engine level (`Object::with_accessor`, getter/setter dispatch on read/write). v0.3.1 picks up ecma-parse-cat 0.2 so the same dispatch path now also fires for accessor / shorthand-method object-literal syntax (`{ get x() {} }` / `{ set x(v) {} }` / `{ foo() {} }`) in user-provided JS source -- the engine already handled those AST variants in 0.3.0, only the parser was holding it back.
//! 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(_))
    }
}