You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Set the code evaluation state of _genContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments.
493
493
1. Set _generator_.[[GeneratorContext]] to _genContext_.
494
-
1. <ins>Set _generator_.[[GeneratorAsyncContextMapping]] to AsyncContextSnapshot().</ins>
494
+
1. <ins>If _generatorBody_ is a |FunctionBody| Parse Node, then</ins>
495
+
1. <ins>Set _generator_.[[GeneratorAsyncContextMapping]] to AsyncContextSnapshot().</ins>
496
+
1. <ins>Else,</ins>
497
+
1. <ins>Set _generator_.[[GeneratorAsyncContextMapping]] to ~empty~.</ins>
495
498
1. Set _generator_.[[GeneratorState]] to ~suspendedStart~.
496
499
1. Return ~unused~.
497
500
</emu-alg>
@@ -536,12 +539,16 @@ <h1>
536
539
1. Let _methodContext_ be the running execution context.
537
540
1. Suspend _methodContext_.
538
541
1. Set _generator_.[[GeneratorState]] to ~executing~.
539
-
1. <ins>Let _asyncContextMapping_ be AsyncContextSwap(_generator_.[[GeneratorAsyncContextMapping]]).</ins>
542
+
1. <ins>If _generator_.[[GeneratorAsyncContextMapping]] is ~empty~, then</ins>
543
+
1. <ins>Let _previousContextMapping_ be ~empty~.</ins>
544
+
1. <ins>Else,</ins>
545
+
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_generator_.[[GeneratorAsyncContextMapping]]).</ins>
540
546
1. Push _genContext_ onto the execution context stack; _genContext_ is now the running execution context.
541
547
1. <emu-metaeffects="user-code">Resume the suspended evaluation of _genContext_</emu-meta> using NormalCompletion(_value_) as the result of the operation that suspended it. Let _result_ be the value returned by the resumed computation.
542
548
1.Assert: When we return here, _genContext_ has already been removed from the execution context stack and _methodContext_ is the currently running execution context.
543
-
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[GeneratorAsyncContextMapping]].</ins>
1. Let _methodContext_ be the running execution context.
572
579
1. Suspend _methodContext_.
573
580
1. Set _generator_.[[GeneratorState]] to ~executing~.
574
-
1. <ins>Let _asyncContextMapping_ be AsyncContextSwap(_generator_.[[GeneratorAsyncContextMapping]]).</ins>
581
+
1. <ins>If _generator_.[[GeneratorAsyncContextMapping]] is ~empty~, then</ins>
582
+
1. <ins>Let _previousContextMapping_ be ~empty~.</ins>
583
+
1. <ins>Else,</ins>
584
+
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_generator_.[[GeneratorAsyncContextMapping]]).</ins>
575
585
1. Push _genContext_ onto the execution context stack; _genContext_ is now the running execution context.
576
586
1. <emu-metaeffects="user-code">Resume the suspended evaluation of _genContext_</emu-meta> using _abruptCompletion_ as the result of the operation that suspended it. Let _result_ be the Completion Record returned by the resumed computation.
577
587
1.Assert: When we return here, _genContext_ has already been removed from the execution context stack and _methodContext_ is the currently running execution context.
578
-
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[GeneratorAsyncContextMapping]].</ins>
<td><ins>a List of Async Context Mapping Records</ins></td>
656
+
<td><ins>a List of Async Context Mapping Records or ~empty~</ins></td>
646
657
<td><ins>The value of the agent's [[AsyncContextMapping]] to use the next time this generator is resumed.</ins></td>
647
658
</tr>
648
659
<tr>
@@ -690,7 +701,10 @@ <h1>
690
701
1. Set _generator_.[[AsyncGeneratorContext]] to _genContext_.
691
702
1. Set _generator_.[[AsyncGeneratorState]] to ~suspendedStart~.
692
703
1. Set _generator_.[[AsyncGeneratorQueue]] to a new empty List.
693
-
1. <ins>Set _generator_.[[AsyncGeneratorAsyncContextMapping]] to AsyncContextSnapshot().</ins>
704
+
1. <ins>If _generatorBody_ is a |FunctionBody| Parse Node, then</ins>
705
+
1. <ins>Set _generator_.[[AsyncGeneratorAsyncContextMapping]] to AsyncContextSnapshot().</ins>
706
+
1. <ins>Else,</ins>
707
+
1. <ins>Set _generator_.[[AsyncGeneratorAsyncContextMapping]] to ~empty~.</ins>
694
708
1. Return ~unused~.
695
709
</emu-alg>
696
710
</emu-clause>
@@ -729,13 +743,17 @@ <h1>
729
743
1. Let _callerContext_ be the running execution context.
730
744
1. Suspend _callerContext_.
731
745
1. Set _generator_.[[AsyncGeneratorState]] to ~executing~.
732
-
1. <ins>Let _asyncContextMapping_ be AsyncContextSwap(_generator_.[[AsyncGeneratorAsyncContextMapping]]).</ins>
746
+
1. <ins>If _generator_.[[AsyncGeneratorAsyncContextMapping]] is ~empty~, then</ins>
747
+
1. <ins>Let _previousContextMapping_ be ~empty~.</ins>
748
+
1. <ins>Else,</ins>
749
+
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_generator_.[[AsyncGeneratorAsyncContextMapping]]).</ins>
733
750
1. Push _genContext_ onto the execution context stack; _genContext_ is now the running execution context.
734
751
1. <emu-metaeffects="user-code">Resume the suspended evaluation of _genContext_</emu-meta> using _completion_ as the result of the operation that suspended it. Let _result_ be the Completion Record returned by the resumed computation.
735
752
1.Assert:_result_ is never an abrupt completion.
736
753
1.Assert: When we return here, _genContext_ has already been removed from the execution context stack and _callerContext_ is the currently running execution context.
737
-
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[AsyncGeneratorAsyncContextMapping]].</ins>
0 commit comments