This repository was archived by the owner on Jan 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgenerator-abstract-ops-patch.html
29 lines (28 loc) · 1.76 KB
/
generator-abstract-ops-patch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<emu-clause id="sec-getgeneratorkind" aoid="GetGeneratorKind">
<h1><ins>GetGeneratorKind ( )</ins></h1>
<emu-alg>
1. Let _genContext_ be the running execution context.
1. If _genContext_ does not have a Generator component, return ~non-generator~.
1. Let _generator_ be the Generator component of _genContext_.
1. If _generator_ has an [[AsyncGeneratorState]] internal slot, return ~async~.
1. Else, return ~normal~.
</emu-alg>
</emu-clause>
<emu-clause id="sec-generatoryield" aoid="GeneratorYield">
<h1>GeneratorYield ( _iterNextObj_ )</h1>
<p>The abstract operation GeneratorYield with argument _iterNextObj_ performs the following steps:</p>
<emu-alg>
1. Assert: _iterNextObj_ is an Object that implements the <i>IteratorResult</i> interface.
1. Let _genContext_ be the running execution context.
1. Assert: _genContext_ is the execution context of a generator.
1. Let _generator_ be the value of the Generator component of _genContext_.
1. <ins>Assert: GetGeneratorKind() is ~normal~</ins>.
1. Set _generator_.[[GeneratorState]] to `"suspendedYield"`.
1. Remove _genContext_ 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 the code evaluation state of _genContext_ such that when evaluation is resumed with a Completion _resumptionValue_ the following steps will be performed:
1. Return _resumptionValue_.
1. NOTE: This returns to the evaluation of the |YieldExpression| that originally called this abstract operation.
1. Return NormalCompletion(_iterNextObj_).
1. NOTE: This returns to the evaluation of the operation that had most previously resumed evaluation of _genContext_.
</emu-alg>
</emu-clause>