diff --git a/spec.html b/spec.html index adf13813ed..512b71dbb7 100644 --- a/spec.html +++ b/spec.html @@ -49806,16 +49806,18 @@

1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to ReturnCompletion(*undefined*). 1. Else, 1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be Completion(_generatorBody_()). + 1. Assert: _result_ is a return completion or a throw completion. 1. Assert: If we return here, the generator either threw an exception or performed either an implicit or explicit return. 1. Remove _acGenContext_ 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. Set _acGenerator_.[[GeneratorState]] to ~completed~. 1. NOTE: Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _acGenerator_ can be discarded at this point. - 1. If _result_ is a normal completion, then - 1. Let _resultValue_ be *undefined*. - 1. Else if _result_ is a return completion, then + 1. If _result_ is a return completion, then 1. Let _resultValue_ be _result_.[[Value]]. 1. Else, 1. Assert: _result_ is a throw completion. @@ -50170,14 +50172,20 @@

1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to ReturnCompletion(*undefined*). 1. Else, 1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be Completion(_generatorBody_()). + 1. Assert: _result_ is a return completion or a throw completion. 1. Assert: If we return here, the async generator either threw an exception or performed either an implicit or explicit return. 1. Remove _acGenContext_ 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. Set _acGenerator_.[[AsyncGeneratorState]] to ~draining-queue~. - 1. If _result_ is a normal completion, set _result_ to NormalCompletion(*undefined*). - 1. If _result_ is a return completion, set _result_ to NormalCompletion(_result_.[[Value]]). + 1. If _result_ is a return completion, then + 1. Set _result_ to NormalCompletion(_result_.[[Value]]). + 1. Else, + 1. Assert: _result_ is a throw completion. 1. Perform AsyncGeneratorCompleteStep(_acGenerator_, _result_, *true*). 1. Perform AsyncGeneratorDrainQueue(_acGenerator_). 1. Return *undefined*. @@ -50561,14 +50569,16 @@

1. Let _acAsyncContext_ be the running execution context. 1. If _asyncBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _asyncBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to ReturnCompletion(*undefined*). 1. Else, 1. Assert: _asyncBody_ is an Abstract Closure with no parameters. - 1. Let _result_ be _asyncBody_(). + 1. Let _result_ be Completion(_asyncBody_()). + 1. Assert: _result_ is a return completion or a throw completion. 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 - 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « *undefined* »). - 1. Else if _result_ is a return completion, then + 1. If _result_ is a return completion, then 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _result_.[[Value]] »). 1. Else, 1. Assert: _result_ is a throw completion.