Skip to content

Commit c4ab60c

Browse files
committed
Normative: consuming helpers close receiver on argument validation failure
1 parent 3ec2047 commit c4ab60c

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

spec.html

+25-10
Original file line numberDiff line numberDiff line change
@@ -46794,8 +46794,11 @@ <h1>Iterator.prototype.every ( _predicate_ )</h1>
4679446794
<emu-alg>
4679546795
1. Let _O_ be the *this* value.
4679646796
1. If _O_ is not an Object, throw a *TypeError* exception.
46797-
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
46798-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
46797+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
46798+
1. If IsCallable(_predicate_) is *false*, then
46799+
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
46800+
1. Return ? IteratorClose(_iterated_, _error_).
46801+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4679946802
1. Let _counter_ be 0.
4680046803
1. Repeat,
4680146804
1. Let _value_ be ? IteratorStepValue(_iterated_).
@@ -46841,8 +46844,11 @@ <h1>Iterator.prototype.find ( _predicate_ )</h1>
4684146844
<emu-alg>
4684246845
1. Let _O_ be the *this* value.
4684346846
1. If _O_ is not an Object, throw a *TypeError* exception.
46844-
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
46845-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
46847+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
46848+
1. If IsCallable(_predicate_) is *false*, then
46849+
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
46850+
1. Return ? IteratorClose(_iterated_, _error_).
46851+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4684646852
1. Let _counter_ be 0.
4684746853
1. Repeat,
4684846854
1. Let _value_ be ? IteratorStepValue(_iterated_).
@@ -46899,8 +46905,11 @@ <h1>Iterator.prototype.forEach ( _procedure_ )</h1>
4689946905
<emu-alg>
4690046906
1. Let _O_ be the *this* value.
4690146907
1. If _O_ is not an Object, throw a *TypeError* exception.
46902-
1. If IsCallable(_procedure_) is *false*, throw a *TypeError* exception.
46903-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
46908+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
46909+
1. If IsCallable(_procedure_) is *false*, then
46910+
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
46911+
1. Return ? IteratorClose(_iterated_, _error_).
46912+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4690446913
1. Let _counter_ be 0.
4690546914
1. Repeat,
4690646915
1. Let _value_ be ? IteratorStepValue(_iterated_).
@@ -46944,8 +46953,11 @@ <h1>Iterator.prototype.reduce ( _reducer_ [ , _initialValue_ ] )</h1>
4694446953
<emu-alg>
4694546954
1. Let _O_ be the *this* value.
4694646955
1. If _O_ is not an Object, throw a *TypeError* exception.
46947-
1. If IsCallable(_reducer_) is *false*, throw a *TypeError* exception.
46948-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
46956+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
46957+
1. If IsCallable(_reducer_) is *false*, then
46958+
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
46959+
1. Return ? IteratorClose(_iterated_, _error_).
46960+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4694946961
1. If _initialValue_ is not present, then
4695046962
1. Let _accumulator_ be ? IteratorStepValue(_iterated_).
4695146963
1. If _accumulator_ is ~done~, throw a *TypeError* exception.
@@ -46969,8 +46981,11 @@ <h1>Iterator.prototype.some ( _predicate_ )</h1>
4696946981
<emu-alg>
4697046982
1. Let _O_ be the *this* value.
4697146983
1. If _O_ is not an Object, throw a *TypeError* exception.
46972-
1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception.
46973-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
46984+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
46985+
1. If IsCallable(_predicate_) is *false*, then
46986+
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
46987+
1. Return ? IteratorClose(_iterated_, _error_).
46988+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4697446989
1. Let _counter_ be 0.
4697546990
1. Repeat,
4697646991
1. Let _value_ be ? IteratorStepValue(_iterated_).

0 commit comments

Comments
 (0)