Skip to content

Commit

Permalink
Editorial: Allow ACs in Async{Function,Block}Start (#3452)
Browse files Browse the repository at this point in the history
There is no use of Abstract Closures as async function bodies in ecma262 itself.
This PR is a prereq to allow the JSPI specification to pass in an AC.
  • Loading branch information
syg authored and ljharb committed Nov 8, 2024
1 parent 1cc4d4b commit 616b8c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -49462,7 +49462,7 @@ <h1>Async Functions Abstract Operations</h1>
<h1>
AsyncFunctionStart (
_promiseCapability_: a PromiseCapability Record,
_asyncFunctionBody_: a |FunctionBody| Parse Node or an |ExpressionBody| Parse Node,
_asyncFunctionBody_: a |FunctionBody| Parse Node, an |ExpressionBody| Parse Node, or an Abstract Closure with no parameters,
): ~unused~
</h1>
<dl class="header">
Expand All @@ -49480,7 +49480,7 @@ <h1>
<h1>
AsyncBlockStart (
_promiseCapability_: a PromiseCapability Record,
_asyncBody_: a Parse Node,
_asyncBody_: a Parse Node or an Abstract Closure with no parameters,
_asyncContext_: an execution context,
): ~unused~
</h1>
Expand All @@ -49490,7 +49490,11 @@ <h1>
1. Let _runningContext_ be the running execution context.
1. Let _closure_ be a new Abstract Closure with no parameters that captures _promiseCapability_ and _asyncBody_ and performs the following steps when called:
1. Let _acAsyncContext_ be the running execution context.
1. Let _result_ be Completion(Evaluation of _asyncBody_).
1. If _asyncBody_ is a Parse Node, then
1. Let _result_ be Completion(Evaluation of _asyncBody_).
1. Else,
1. Assert: _asyncBody_ is an Abstract Closure with no parameters.
1. Let _result_ be _asyncBody_().
1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done.
1. Remove _acAsyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
1. If _result_ is a normal completion, then
Expand Down

0 comments on commit 616b8c9

Please sign in to comment.