Skip to content

Commit

Permalink
Update ongoing promise in async iterator return() method
Browse files Browse the repository at this point in the history
This aligns with the behavior of async generators.
  • Loading branch information
MattiasBuelens authored Feb 13, 2024
1 parent 47c5c92 commit 400ce04
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -12794,27 +12794,27 @@ The \[[Prototype]] [=/internal slot=] of an [=asynchronous iterator prototype ob
|interface|, given |object|'s [=default asynchronous iterator object/target=], |object|,
and |value|.

1. Let |returnStepsPromise| be null.

1. Let |ongoingPromise| be |object|'s [=default asynchronous iterator object/ongoing promise=].

1. If |ongoingPromise| is not null, then:
1. Let |afterOngoingPromiseCapability| be [=!=] [$NewPromiseCapability$]({{%Promise%}}).
1. Let |onSettled| be [$CreateBuiltinFunction$](|returnSteps|, « »).
1. Perform [$PerformPromiseThen$](|ongoingPromise|, |onSettled|, |onSettled|,
|afterOngoingPromiseCapability|).
1. Set |returnStepsPromise| to |afterOngoingPromiseCapability|.\[[Promise]].
1. Set |object|'s [=default asynchronous iterator object/ongoing promise=] to
|afterOngoingPromiseCapability|.\[[Promise]].

1. Otherwise:
1. Set |returnStepsPromise| to the result of running |returnSteps|.
1. Set |object|'s [=default asynchronous iterator object/ongoing promise=] to the result of
running |returnSteps|.

1. Let |fulfillSteps| be the following steps:
1. Return [$CreateIterResultObject$](|value|, <emu-val>true</emu-val>).

1. Let |onFulfilled| be [$CreateBuiltinFunction$](|fulfillSteps|, « »).

1. Perform [$PerformPromiseThen$](|returnStepsPromise|, |onFulfilled|,
<emu-val>undefined</emu-val>, |returnPromiseCapability|).
1. Perform [$PerformPromiseThen$](|object|'s [=default asynchronous iterator object/ongoing
promise=], |onFulfilled|, <emu-val>undefined</emu-val>, |returnPromiseCapability|).

1. Return |returnPromiseCapability|.\[[Promise]].
</div>
Expand Down

0 comments on commit 400ce04

Please sign in to comment.