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

Normative: handle broken promises in AsyncGenerator.prototype.return #2683

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
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
15 changes: 11 additions & 4 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -48263,7 +48263,7 @@ <h1>%AsyncGeneratorPrototype%.return ( _value_ )</h1>
1. Let _state_ be _generator_.[[AsyncGeneratorState]].
1. If _state_ is either ~suspended-start~ or ~completed~, then
1. Set _generator_.[[AsyncGeneratorState]] to ~awaiting-return~.
1. Perform ! AsyncGeneratorAwaitReturn(_generator_).
1. Perform AsyncGeneratorAwaitReturn(_generator_).
1. Else if _state_ is ~suspended-yield~, then
1. Perform AsyncGeneratorResume(_generator_, _completion_).
1. Else,
Expand Down Expand Up @@ -48552,7 +48552,7 @@ <h1>
<h1>
AsyncGeneratorAwaitReturn (
_generator_: an AsyncGenerator,
): either a normal completion containing ~unused~ or a throw completion
): ~unused~
</h1>
<dl class="header">
</dl>
Expand All @@ -48562,7 +48562,14 @@ <h1>
1. Let _next_ be the first element of _queue_.
1. Let _completion_ be Completion(_next_.[[Completion]]).
1. Assert: _completion_ is a return completion.
1. Let _promise_ be ? PromiseResolve(%Promise%, _completion_.[[Value]]).
1. Let _promiseCompletion_ be Completion(PromiseResolve(%Promise%, _completion_.[[Value]])).
1. If _promiseCompletion_ is an abrupt completion, then
1. Set _generator_.[[AsyncGeneratorState]] to ~completed~.
1. Perform AsyncGeneratorCompleteStep(_generator_, _promiseCompletion_, *true*).
1. Perform AsyncGeneratorDrainQueue(_generator_).
1. Return ~unused~.
1. Assert: _promiseCompletion_ is a normal completion.
1. Let _promise_ be _promiseCompletion_.[[Value]].
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. Let _result_ be NormalCompletion(_value_).
Expand Down Expand Up @@ -48602,7 +48609,7 @@ <h1>
1. Let _completion_ be Completion(_next_.[[Completion]]).
1. If _completion_ is a return completion, then
1. Set _generator_.[[AsyncGeneratorState]] to ~awaiting-return~.
1. Perform ! AsyncGeneratorAwaitReturn(_generator_).
1. Perform AsyncGeneratorAwaitReturn(_generator_).
1. Set _done_ to *true*.
1. Else,
1. If _completion_ is a normal completion, then
Expand Down
Loading