Skip to content

Commit 6d4281b

Browse files
committed
[spec] close iterator if abrupt during StepValue
1 parent 8be227a commit 6d4281b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

spec.emu

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ copyright: false
2323
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _chunkSize_ and performs the following steps when called:
2424
1. Let _buffer_ be a new empty List.
2525
1. Repeat,
26-
1. Let _value_ be ? IteratorStepValue(_iterated_).
26+
1. Let _result_ be Completion(IteratorStepValue(_iterated_)).
27+
1. IfAbruptCloseIterator(_result_, _iterated_).
28+
1. Let _value_ be ! _result_.
2729
1. If _value_ is ~done~, then
2830
1. If _buffer_ is not empty, then
2931
1. Perform Completion(Yield(CreateArrayFromList(_buffer_))).
@@ -57,7 +59,9 @@ copyright: false
5759
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_, _windowSize_, and _undersized_ and performs the following steps when called:
5860
1. Let _buffer_ be a new empty List.
5961
1. Repeat,
60-
1. Let _value_ be ? IteratorStepValue(_iterated_).
62+
1. Let _result_ be Completion(IteratorStepValue(_iterated_)).
63+
1. IfAbruptCloseIterator(_result_, _iterated_).
64+
1. Let _value_ be ! _result_.
6165
1. If _value_ is ~done~, then
6266
1. If _undersized_ is *"allow-partial"*, _buffer_ is not empty, and the number of elements in _buffer_ < ℝ(_windowSize_), then
6367
1. Perform Completion(Yield(CreateArrayFromList(_buffer_))).

0 commit comments

Comments
 (0)