Skip to content

Commit

Permalink
Editorial: have Create{,Async}IteratorFromClosure provide a new execu…
Browse files Browse the repository at this point in the history
…tion context to GeneratorStart (tc39#2398)
  • Loading branch information
bakkot authored and mathiasbynens committed Oct 18, 2021
1 parent 167c91e commit d5b9346
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -39818,7 +39818,15 @@ <h1>CreateIteratorFromClosure ( _closure_, _generatorBrand_, _generatorPrototype
1. Let _generator_ be ! OrdinaryObjectCreate(_generatorPrototype_, _internalSlotsList_).
1. Set _generator_.[[GeneratorBrand]] to _generatorBrand_.
1. Set _generator_.[[GeneratorState]] to *undefined*.
1. Let _callerContext_ be the running execution context.
1. Let _calleeContext_ be a new execution context.
1. Set the Function of _calleeContext_ to *null*.
1. Set the Realm of _calleeContext_ to the current Realm Record.
1. Set the ScriptOrModule of _calleeContext_ to _callerContext_'s ScriptOrModule.
1. If _callerContext_ is not already suspended, suspend _callerContext_.
1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context.
1. Perform ! GeneratorStart(_generator_, _closure_).
1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context.
1. Return _generator_.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -40117,7 +40125,15 @@ <h1>CreateAsyncIteratorFromClosure ( _closure_, _generatorBrand_, _generatorProt
1. Let _generator_ be ! OrdinaryObjectCreate(_generatorPrototype_, _internalSlotsList_).
1. Set _generator_.[[GeneratorBrand]] to _generatorBrand_.
1. Set _generator_.[[AsyncGeneratorState]] to *undefined*.
1. Let _callerContext_ be the running execution context.
1. Let _calleeContext_ be a new execution context.
1. Set the Function of _calleeContext_ to *null*.
1. Set the Realm of _calleeContext_ to the current Realm Record.
1. Set the ScriptOrModule of _calleeContext_ to _callerContext_'s ScriptOrModule.
1. If _callerContext_ is not already suspended, suspend _callerContext_.
1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context.
1. Perform ! AsyncGeneratorStart(_generator_, _closure_).
1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context.
1. Return _generator_.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit d5b9346

Please sign in to comment.