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: make async iterators next/return/throw not pass undefined when value is absent #1776

Merged
merged 1 commit into from
Jun 29, 2020
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
22 changes: 16 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -38899,20 +38899,23 @@ <h1>The %AsyncFromSyncIteratorPrototype% Object</h1>
</ul>

<emu-clause id="sec-%asyncfromsynciteratorprototype%.next">
<h1>%AsyncFromSyncIteratorPrototype%.next ( _value_ )</h1>
<h1>%AsyncFromSyncIteratorPrototype%.next ( [ _value_ ] )</h1>
<emu-alg>
1. Let _O_ be the *this* value.
1. Assert: Type(_O_) is Object and _O_ has a [[SyncIteratorRecord]] internal slot.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _syncIteratorRecord_ be _O_.[[SyncIteratorRecord]].
1. Let _result_ be IteratorNext(_syncIteratorRecord_, _value_).
1. If _value_ is present, then
1. Let _result_ be IteratorNext(_syncIteratorRecord_, _value_).
1. Else,
1. Let _result_ be IteratorNext(_syncIteratorRecord_).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Return ! AsyncFromSyncIteratorContinuation(_result_, _promiseCapability_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-%asyncfromsynciteratorprototype%.return">
<h1>%AsyncFromSyncIteratorPrototype%.return ( _value_ )</h1>
<h1>%AsyncFromSyncIteratorPrototype%.return ( [ _value_ ] )</h1>

<emu-alg>
1. Let _O_ be the *this* value.
Expand All @@ -38925,7 +38928,10 @@ <h1>%AsyncFromSyncIteratorPrototype%.return ( _value_ )</h1>
1. Let _iterResult_ be ! CreateIterResultObject(_value_, *true*).
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; _iterResult_ &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Let _result_ be Call(_return_, _syncIterator_, &laquo; _value_ &raquo;).
1. If _value_ is present, then
1. Let _result_ be Call(_return_, _syncIterator_, &laquo; _value_ &raquo;).
1. Else,
1. Let _result_ be Call(_return_, _syncIterator_).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. If Type(_result_) is not Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; a newly created *TypeError* object &raquo;).
Expand All @@ -38935,7 +38941,8 @@ <h1>%AsyncFromSyncIteratorPrototype%.return ( _value_ )</h1>
</emu-clause>

<emu-clause id="sec-%asyncfromsynciteratorprototype%.throw">
<h1>%AsyncFromSyncIteratorPrototype%.throw ( _value_ )</h1>
<h1>%AsyncFromSyncIteratorPrototype%.throw ( [ _value_ ] )</h1>
<emu-note>In this specification, _value_ is always provided, but is left optional for consistency with <emu-xref title href="#sec-%asyncfromsynciteratorprototype%.return"></emu-xref>.</emu-note>

<emu-alg>
1. Let _O_ be the *this* value.
Expand All @@ -38947,7 +38954,10 @@ <h1>%AsyncFromSyncIteratorPrototype%.throw ( _value_ )</h1>
1. If _throw_ is *undefined*, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; _value_ &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Let _result_ be Call(_throw_, _syncIterator_, &laquo; _value_ &raquo;).
1. If _value_ is present, then
1. Let _result_ be Call(_throw_, _syncIterator_, &laquo; _value_ &raquo;).
1. Else,
1. Let _result_ be Call(_throw_, _syncIterator_).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. If Type(_result_) is not Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; a newly created *TypeError* object &raquo;).
Expand Down