Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,24 @@ impl AsyncArrowFunction {
}
}

pub(crate) fn compile(
self: &Rc<Self>,
chunk: &mut Chunk,
strict: bool,
source: &Rc<SourceTree>,
) -> anyhow::Result<AlwaysAbruptResult> {
// Runtime Semantics: Evaluation
//
// The syntax-directed operation Evaluation takes argument env (an Environment Record) and returns either a
// normal completion containing a value or an abrupt completion. It is defined piecewise over the following
// productions:
//
// AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody
// CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
// 1. Return InstantiateAsyncArrowFunctionExpression of AsyncArrowFunction.
self.instantiate_async_arrow_function_expression(chunk, strict, source, None)
}

pub(crate) fn named_evaluation(
self: &Rc<Self>,
chunk: &mut Chunk,
Expand Down Expand Up @@ -4950,7 +4968,9 @@ impl AssignmentExpression {
AssignmentExpression::Arrow(arrow_function) => {
arrow_function.compile(chunk, strict, source).map(CompilerStatusFlags::from)
}
AssignmentExpression::AsyncArrow(_) => todo!(),
AssignmentExpression::AsyncArrow(node) => {
node.compile(chunk, strict, source).map(CompilerStatusFlags::from)
}
AssignmentExpression::OpAssignment(lhse, op, rhs) => {
// Stack: ...
let lhs_status = lhse.compile(chunk, strict, source)?;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3965,7 +3965,7 @@ mod assignment_expression {
]), true, false)); "lhse not abrupt")]
#[test_case("x => 0", true, &[] => Ok((svec(&["00001: x => 0", "STRING 0 ()", "FUNC_IAE 0"]), true, false)); "arrow function")]
#[test_case("yield 1", true, &[] => Ok((svec(&["00001: yield 1", "FLOAT 0 (1)", "YIELD"]), true, false)); "yield expr")]
#[test_case("async x => x", true, &[] => panics "not yet implemented"; "async arrow")]
#[test_case("async x => x", true, &[] => Ok((svec(&["00001: async x => x", "STRING 0 ()", "AFUN_IIFE 0"]), true, false)); "async arrow")]
#[test_case(
"a &&= b", true, &[]
=> Ok((
Expand Down
Loading