OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $arrayValues; | 5 var $arrayValues; |
6 | 6 |
7 (function(global, utils) { | 7 (function(global, utils) { |
8 | 8 |
9 "use strict"; | 9 "use strict"; |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 | 69 |
70 | 70 |
71 // 22.1.5.2.2 %ArrayIteratorPrototype%[@@iterator] | 71 // 22.1.5.2.2 %ArrayIteratorPrototype%[@@iterator] |
72 function ArrayIteratorIterator() { | 72 function ArrayIteratorIterator() { |
73 return this; | 73 return this; |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 // 15.4.5.2.2 ArrayIterator.prototype.next( ) | 77 // 15.4.5.2.2 ArrayIterator.prototype.next( ) |
78 function ArrayIteratorNext() { | 78 function ArrayIteratorNext() { |
79 var iterator = TO_OBJECT(this); | 79 var iterator = this; |
80 | 80 |
81 if (!HAS_DEFINED_PRIVATE(iterator, arrayIteratorNextIndexSymbol)) { | 81 if (!IS_SPEC_OBJECT(iterator) || |
82 !HAS_DEFINED_PRIVATE(iterator, arrayIteratorNextIndexSymbol)) { | |
Jarin
2015/09/02 06:41:01
Technically, you should check for presence of the
Benedikt Meurer
2015/09/02 06:42:05
Yeah, I'll remove all of this soonish and replace
| |
82 throw MakeTypeError(kIncompatibleMethodReceiver, | 83 throw MakeTypeError(kIncompatibleMethodReceiver, |
83 'Array Iterator.prototype.next', this); | 84 'Array Iterator.prototype.next', this); |
84 } | 85 } |
85 | 86 |
86 var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol); | 87 var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol); |
87 if (IS_UNDEFINED(array)) { | 88 if (IS_UNDEFINED(array)) { |
88 return CreateIteratorResultObject(UNDEFINED, true); | 89 return CreateIteratorResultObject(UNDEFINED, true); |
89 } | 90 } |
90 | 91 |
91 var index = GET_PRIVATE(iterator, arrayIteratorNextIndexSymbol); | 92 var index = GET_PRIVATE(iterator, arrayIteratorNextIndexSymbol); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 169 |
169 utils.Export(function(to) { | 170 utils.Export(function(to) { |
170 to.ArrayIteratorCreateResultObject = CreateIteratorResultObject; | 171 to.ArrayIteratorCreateResultObject = CreateIteratorResultObject; |
171 }); | 172 }); |
172 | 173 |
173 $arrayValues = ArrayValues; | 174 $arrayValues = ArrayValues; |
174 | 175 |
175 %InstallToContext(["array_values_iterator", ArrayValues]); | 176 %InstallToContext(["array_values_iterator", ArrayValues]); |
176 | 177 |
177 }) | 178 }) |
OLD | NEW |