Skip to content

Commit 3312edc

Browse files
js-choibakkot
andcommitted
fix: Replace IteratorStep with NextMethod
Fixes #33. Prevents an infinite loop caused by IteratorStep(iteratorRecord) not actually flagging termination when IteratorRecord is async. Instead, we will directly call iteratorStep.[[NextMethod]], like how `for await` does. Co-Authored-By: Kevin Gibbons <[email protected]>
1 parent dfcf0d2 commit 3312edc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spec.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ <h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h
9393
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
9494
1. Return ? AsyncIteratorClose(_iteratorRecord_, _error_).
9595
1. Let _Pk_ be ! ToString(𝔽(_k_)).
96-
1. Let _next_ be ? Await(IteratorStep(_iteratorRecord_)).
97-
1. If _next_ is *false*, then
96+
1. Let _nextResult_ be ? Call(_iteratorRecord_.[[NextMethod]], _iteratorRecord_.[[Iterator]]).
97+
1. Set _nextResult_ to ? Await(_nextResult_).
98+
1. If _nextResult_ is not an Object, throw a *TypeError* exception.
99+
1. Let _done_ be ? IteratorComplete(_nextResult_).
100+
1. If _done_ is *true*,
98101
1. Perform ? Set(_A_, *"length"*, 𝔽(_k_), *true*).
99102
1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _A_, [[Target]]: ~empty~ }.
100103
1. Let _nextValue_ be ? IteratorValue(_next_).

0 commit comments

Comments
 (0)