diff --git a/spec.html b/spec.html index 9341dcad66..3e3632e311 100644 --- a/spec.html +++ b/spec.html @@ -47356,11 +47356,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, @@ -47385,8 +47391,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_). @@ -47404,8 +47413,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, @@ -47429,8 +47441,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_). @@ -47448,8 +47463,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, @@ -47484,8 +47502,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_). @@ -47502,8 +47523,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, @@ -47526,8 +47550,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. @@ -47551,8 +47578,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_). @@ -47570,11 +47600,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,