Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
only CreateAsyncFromSyncIterator when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Sep 13, 2022
1 parent 032ea9d commit 196dc3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,24 @@ <h1>
<emu-alg>
1. If _hint_ is not present, set _hint_ to ~sync~.
1. If _iterator_ is either *undefined* or *null*, throw a *TypeError* exception.
1. Let _alreadyAsync_ be *false*.
1. Let _method_ be *undefined*.
1. If _hint_ is ~async~, then
1. Set _method_ to ? GetV(_obj_, @@asyncIterator).
1. Set _alreadyAsync_ to *true*.
1. If IsCallable(_method_) is *false*, then
1. Set _method_ to ? GetV(_obj_, @@iterator).
1. Set _alreadyAsync_ to *false*.
1. If IsCallable(_method_) is *false*, then
1. Let _iterator_ be _obj_.
1. Set _alreadyAsync_ to *true*.
1. Else,
1. Let _iterator_ be ? Call(_method_, _obj_).
1. If _iterator_ is not an Object, throw a *TypeError* exception.
1. Let _nextMethod_ be ? Get(_iterator_, *"next"*).
1. If IsCallable(_nextMethod_) is *false*, throw a *TypeError* exception.
1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
1. If _hint_ is ~async~, then
1. If _hint_ is ~async~ and _alreadyAsync_ is *false*, then
1. Return CreateAsyncFromSyncIterator(_iteratorRecord_).
1. Return _iteratorRecord_.
</emu-alg>
Expand Down

0 comments on commit 196dc3f

Please sign in to comment.