| Index: src/array-iterator.js
|
| diff --git a/src/array-iterator.js b/src/array-iterator.js
|
| index f1e1800bfb8f1e7b217daa02c7546945bf1188b8..a96b9cb7c660b51efb59679f75a9eb7281f85e42 100644
|
| --- a/src/array-iterator.js
|
| +++ b/src/array-iterator.js
|
| @@ -38,12 +38,17 @@ function CreateIteratorResultObject(value, done) {
|
| // 15.4.5.2.2 ArrayIterator.prototype.next( )
|
| function ArrayIteratorNext() {
|
| var iterator = ToObject(this);
|
| - var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol);
|
| - if (!array) {
|
| +
|
| + if (!HAS_PRIVATE(iterator, arrayIteratorObjectSymbol)) {
|
| throw MakeTypeError('incompatible_method_receiver',
|
| ['Array Iterator.prototype.next']);
|
| }
|
|
|
| + var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol);
|
| + if (IS_UNDEFINED(array)) {
|
| + return CreateIteratorResultObject(UNDEFINED, true);
|
| + }
|
| +
|
| var index = GET_PRIVATE(iterator, arrayIteratorNextIndexSymbol);
|
| var itemKind = GET_PRIVATE(iterator, arrayIterationKindSymbol);
|
| var length = TO_UINT32(array.length);
|
| @@ -51,17 +56,19 @@ function ArrayIteratorNext() {
|
| // "sparse" is never used.
|
|
|
| if (index >= length) {
|
| - SET_PRIVATE(iterator, arrayIteratorNextIndexSymbol, INFINITY);
|
| + SET_PRIVATE(iterator, arrayIteratorObjectSymbol, UNDEFINED);
|
| return CreateIteratorResultObject(UNDEFINED, true);
|
| }
|
|
|
| SET_PRIVATE(iterator, arrayIteratorNextIndexSymbol, index + 1);
|
|
|
| - if (itemKind == ITERATOR_KIND_VALUES)
|
| + if (itemKind == ITERATOR_KIND_VALUES) {
|
| return CreateIteratorResultObject(array[index], false);
|
| + }
|
|
|
| - if (itemKind == ITERATOR_KIND_ENTRIES)
|
| + if (itemKind == ITERATOR_KIND_ENTRIES) {
|
| return CreateIteratorResultObject([index, array[index]], false);
|
| + }
|
|
|
| return CreateIteratorResultObject(index, false);
|
| }
|
|
|