Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sync and async generators restore the initialization context #61

Merged
merged 5 commits into from
Aug 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix wrong assertions
  • Loading branch information
andreubotella committed Aug 4, 2023
commit dfc0cf113d82328f2c9398111ffaa30f8a7098ab
6 changes: 3 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ <h1>
1. Push _genContext_ onto the execution context stack; _genContext_ is now the running execution context.
1. <emu-meta effects="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.
1. Assert: When we return here, _genContext_ has already been removed from the execution context stack and _methodContext_ is the currently running execution context.
1. <ins>Assert: The result of AsyncContextSnapshot() is _asyncContextMapping_.</ins>
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[GeneratorAsyncContextMapping]].</ins>
1. <ins>AsyncContextSwap(_asyncContextMapping_).</ins>
Copy link
Member

@littledan littledan Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Write this as "Perform AsyncContextSwap(asyncContextMapping)."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we should probably follow this with an assert that it doesn't matter whether we are discarding or saving/restoring.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are steps that just do "AsyncContextSwap(previousMapping)" in the existing spec text.

I will add that assertion though.

1. Return ? _result_.
</emu-alg>
Expand Down Expand Up @@ -487,7 +487,7 @@ <h1>
1. Push _genContext_ onto the execution context stack; _genContext_ is now the running execution context.
1. <emu-meta effects="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.
1. Assert: When we return here, _genContext_ has already been removed from the execution context stack and _methodContext_ is the currently running execution context.
1. <ins>Assert: The result of AsyncContextSnapshot() is _asyncContextMapping_.</ins>
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[GeneratorAsyncContextMapping]].</ins>
1. <ins>AsyncContextSwap(_asyncContextMapping_).</ins>
1. Return ? _result_.
</emu-alg>
Expand Down Expand Up @@ -646,7 +646,7 @@ <h1>
1. <emu-meta effects="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.
1. Assert: _result_ is never an abrupt completion.
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. <ins>Assert: The result of AsyncContextSnapshot() is _asyncContextMapping_.</ins>
1. <ins>Assert: The result of AsyncContextSnapshot() is _generator_.[[AsyncGeneratorAsyncContextMapping]].</ins>
1. <ins>AsyncContextSwap(_asyncContextMapping_).</ins>
1. Return ~unused~.
</emu-alg>
Expand Down