Tree-walking ECMAScript interpreter built on ecma-syntax-cat. v0.6.0 adds `await` evaluator dispatch + async function call wrapping (async track chunk 3 of 5-7): `await Resolved(v)` -> `v`, `await Rejected(v)` -> throw `v`, `await Pending` -> TypeError (no continuation in the synchronous tree-walking model), `await non_promise` -> pass through. Calling an async function (`FunctionDef::is_async()` flag, threaded from `Function::is_async()` / `ArrowFunction::is_async()`) wraps the body's normal completion in a `Resolved` promise and its throw completion in a `Rejected` promise.
//! Completion records: the spec's abrupt-completion mechanism, lifted into
//! a sum type the interpreter can return from statement evaluation.
usecrate::value::Value;/// The result of evaluating a statement.
#[derive(Debug, Clone, PartialEq, Eq)]pubenumCompletion{/// 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,}implCompletion{/// Whether this completion is abrupt (anything other than `Normal`).
#[must_use]pubfnis_abrupt(&self)->bool{!matches!(self,Self::Normal(_))}}