diff --git a/spec.html b/spec.html index 652ddce78b..382726d939 100644 --- a/spec.html +++ b/spec.html @@ -46759,11 +46759,17 @@

Iterator.prototype.drop ( _limit_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. Let _numLimit_ be ? ToNumber(_limit_). - 1. If _numLimit_ is *NaN*, throw a *RangeError* exception. + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. Let _numLimit_ be Completion(ToNumber(_limit_)). + 1. IfAbruptCloseIterator(_numLimit_, _iterated_). + 1. If _numLimit_ is *NaN*, then + 1. Let _error_ be ThrowCompletion(a newly created *RangeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). 1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_). - 1. If _integerLimit_ < 0, throw a *RangeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. If _integerLimit_ < 0, then + 1. Let _error_ be ThrowCompletion(a newly created *RangeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _integerLimit_ and performs the following steps when called: 1. Let _remaining_ be _integerLimit_. 1. Repeat, while _remaining_ > 0, @@ -46788,8 +46794,11 @@

Iterator.prototype.every ( _predicate_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_predicate_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). @@ -46807,8 +46816,11 @@

Iterator.prototype.filter ( _predicate_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_predicate_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _predicate_ and performs the following steps when called: 1. Let _counter_ be 0. 1. Repeat, @@ -46832,8 +46844,11 @@

Iterator.prototype.find ( _predicate_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_predicate_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). @@ -46851,8 +46866,11 @@

Iterator.prototype.flatMap ( _mapper_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_mapper_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_mapper_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _mapper_ and performs the following steps when called: 1. Let _counter_ be 0. 1. Repeat, @@ -46887,8 +46905,11 @@

Iterator.prototype.forEach ( _procedure_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_procedure_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_procedure_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). @@ -46905,8 +46926,11 @@

Iterator.prototype.map ( _mapper_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_mapper_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_mapper_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _mapper_ and performs the following steps when called: 1. Let _counter_ be 0. 1. Repeat, @@ -46929,8 +46953,11 @@

Iterator.prototype.reduce ( _reducer_ [ , _initialValue_ ] )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_reducer_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_reducer_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. If _initialValue_ is not present, then 1. Let _accumulator_ be ? IteratorStepValue(_iterated_). 1. If _accumulator_ is ~done~, throw a *TypeError* exception. @@ -46954,8 +46981,11 @@

Iterator.prototype.some ( _predicate_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. If IsCallable(_predicate_) is *false*, then + 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). @@ -46973,11 +47003,17 @@

Iterator.prototype.take ( _limit_ )

1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. Let _numLimit_ be ? ToNumber(_limit_). - 1. If _numLimit_ is *NaN*, throw a *RangeError* exception. + 1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }. + 1. Let _numLimit_ be Completion(ToNumber(_limit_)). + 1. IfAbruptCloseIterator(_numLimit_, _iterated_). + 1. If _numLimit_ is *NaN*, then + 1. Let _error_ be ThrowCompletion(a newly created *RangeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). 1. Let _integerLimit_ be ! ToIntegerOrInfinity(_numLimit_). - 1. If _integerLimit_ < 0, throw a *RangeError* exception. - 1. Let _iterated_ be ? GetIteratorDirect(_O_). + 1. If _integerLimit_ < 0, then + 1. Let _error_ be ThrowCompletion(a newly created *RangeError* object). + 1. Return ? IteratorClose(_iterated_, _error_). + 1. Set _iterated_ to ? GetIteratorDirect(_O_). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _integerLimit_ and performs the following steps when called: 1. Let _remaining_ be _integerLimit_. 1. Repeat,