From 86d44426a54a81aa8c17950eb0f1ebb4e25539e4 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 23 Jun 2021 22:21:38 -0700 Subject: [PATCH] Editorial: use abstract closures in AsyncGeneratorResumeNext (#2439) --- spec.html | 46 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/spec.html b/spec.html index a8dd0e2a5b9..b7add578831 100644 --- a/spec.html +++ b/spec.html @@ -40039,7 +40039,7 @@

AsyncGeneratorReject ( _generator_, _exception_ )

- +

AsyncGeneratorResumeNext ( _generator_ )

The abstract operation AsyncGeneratorResumeNext takes argument _generator_. It performs the following steps when called:

@@ -40060,14 +40060,14 @@

AsyncGeneratorResumeNext ( _generator_ )

1. If _completion_.[[Type]] is ~return~, then 1. Set _generator_.[[AsyncGeneratorState]] to ~awaiting-return~. 1. Let _promise_ be ? PromiseResolve(%Promise%, _completion_.[[Value]]). - 1. Let _stepsFulfilled_ be the algorithm steps defined in . - 1. Let _lengthFulfilled_ be the number of non-optional parameters of the function definition in . - 1. Let _onFulfilled_ be ! CreateBuiltinFunction(_stepsFulfilled_, _lengthFulfilled_, *""*, « [[Generator]] »). - 1. Set _onFulfilled_.[[Generator]] to _generator_. - 1. Let _stepsRejected_ be the algorithm steps defined in . - 1. Let _lengthRejected_ be the number of non-optional parameters of the function definition in . - 1. Let _onRejected_ be ! CreateBuiltinFunction(_stepsRejected_, _lengthRejected_, *""*, « [[Generator]] »). - 1. Set _onRejected_.[[Generator]] to _generator_. + 1. Let _fulfilledClosure_ be a new Abstract Closure with parameters (_value_) that captures _generator_ and performs the following steps when called: + 1. Set _generator_.[[AsyncGeneratorState]] to ~completed~. + 1. Return ! AsyncGeneratorResolve(_generator_, _value_, *true*). + 1. Let _onFulfilled_ be ! CreateBuiltinFunction(_fulfilledClosure_, 1, *""*, « »). + 1. Let _rejectedClosure_ be a new Abstract Closure with parameters (_reason_) that captures _generator_ and performs the following steps when called: + 1. Set _generator_.[[AsyncGeneratorState]] to ~completed~. + 1. Return ! AsyncGeneratorReject(_generator_, _reason_). + 1. Let _onRejected_ be ! CreateBuiltinFunction(_rejectedClosure_, 1, *""*, « »). 1. Perform ! PerformPromiseThen(_promise_, _onFulfilled_, _onRejected_). 1. Return *undefined*. 1. Else, @@ -40086,34 +40086,6 @@

AsyncGeneratorResumeNext ( _generator_ )

1. Assert: When we return here, _genContext_ has already been removed from the execution context stack and _callerContext_ is the currently running execution context. 1. Return *undefined*.
- - -

AsyncGeneratorResumeNext Return Processor Fulfilled Functions

-

An AsyncGeneratorResumeNext return processor fulfilled function is an anonymous built-in function that is used as part of the AsyncGeneratorResumeNext specification device to unwrap promises passed in to the method. Each AsyncGeneratorResumeNext return processor fulfilled function has a [[Generator]] internal slot.

-

When an AsyncGeneratorResumeNext return processor fulfilled function is called with argument _value_, the following steps are taken:

- - - 1. Let _F_ be the active function object. - 1. Set _F_.[[Generator]].[[AsyncGeneratorState]] to ~completed~. - 1. Return ! AsyncGeneratorResolve(_F_.[[Generator]], _value_, *true*). - - -

The *"length"* property of an AsyncGeneratorResumeNext return processor fulfilled function is *1*𝔽.

-
- - -

AsyncGeneratorResumeNext Return Processor Rejected Functions

-

An AsyncGeneratorResumeNext return processor rejected function is an anonymous built-in function that is used as part of the AsyncGeneratorResumeNext specification device to unwrap promises passed in to the method. Each AsyncGeneratorResumeNext return processor rejected function has a [[Generator]] internal slot.

-

When an AsyncGeneratorResumeNext return processor rejected function is called with argument _reason_, the following steps are taken:

- - - 1. Let _F_ be the active function object. - 1. Set _F_.[[Generator]].[[AsyncGeneratorState]] to ~completed~. - 1. Return ! AsyncGeneratorReject(_F_.[[Generator]], _reason_). - - -

The *"length"* property of an AsyncGeneratorResumeNext return processor rejected function is *1*𝔽.

-