From 616b8c9535b3544c7beaa1d1150f3cb2ff6f2fb7 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Fri, 8 Nov 2024 10:39:33 +0000 Subject: [PATCH] Editorial: Allow ACs in Async{Function,Block}Start (#3452) 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. --- spec.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index d5f695f985..ded8d5a23e 100644 --- a/spec.html +++ b/spec.html @@ -49462,7 +49462,7 @@

Async Functions Abstract Operations

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~

@@ -49480,7 +49480,7 @@

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~

@@ -49490,7 +49490,11 @@

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