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

fixes #200: don't add additional ticks in wrapped objects' return #215

Merged
merged 1 commit into from Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions spec.html
Expand Up @@ -245,8 +245,12 @@ <h1>%WrapForValidIteratorPrototype%.return ( )</h1>
<emu-alg>
1. Let _O_ be *this* value.
1. Perform ? RequireInternalSlot(_O_, [[Iterated]]).
1. Let _result_ be ? IteratorClose(_O_.[[Iterated]], NormalCompletion(*undefined*)).
1. Return CreateIterResultObject(_result_, true).
1. Let _iterator_ be _O_.[[Iterated]].[[Iterator]].
1. Assert: Type(_iterator_) is Object.
1. Let _returnMethod_ be ? GetMethod(_iterator_, *"return"*).
1. If _returnMethod_ is *undefined*, then
1. Return CreateIterResultObject(*undefined*, *true*).
1. Return ? Call(_returnMethod_, _iterator_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -336,11 +340,15 @@ <h1>%WrapForValidAsyncIteratorPrototype%.return ( )</h1>
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _check_ be Completion(RequireInternalSlot(_O_, [[AsyncIterated]])).
1. IfAbruptRejectPromise(_check_, _promiseCapability_).
1. Let _result_ be Completion(AsyncIteratorClose(_O_.[[AsyncIterated]], NormalCompletion(*undefined*))).
1. Let _iterator_ be _O_.[[AsyncIterated]].[[Iterator]].
1. Assert: Type(_iterator_) is Object.
1. Let _returnMethod_ be Completion(GetMethod(_iterator_, *"return"*)).
1. IfAbruptRejectPromise(_returnMethod_, _promiseCapability_).
1. If _returnMethod_ is *undefined*, then
1. Return ? PromiseResolve(%Promise%, CreateIterResultObject(*undefined*, *true*)).
1. Let _result_ be Completion(Call(_returnMethod_, _iterator_)).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Let _iterResult_ be CreateIterResultObject(_result_, *true*).
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; _iterResult_ &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Return ? PromiseResolve(%Promise%, _result_).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down