OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 var s = TO_STRING_INLINE(string); | 34 var s = TO_STRING_INLINE(string); |
35 var iterator = new StringIterator; | 35 var iterator = new StringIterator; |
36 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); | 36 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); |
37 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0); | 37 SET_PRIVATE(iterator, stringIteratorNextIndexSymbol, 0); |
38 return iterator; | 38 return iterator; |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 // 21.1.5.2.1 %StringIteratorPrototype%.next( ) | 42 // 21.1.5.2.1 %StringIteratorPrototype%.next( ) |
43 function StringIteratorNext() { | 43 function StringIteratorNext() { |
44 var iterator = $toObject(this); | 44 var iterator = TO_OBJECT(this); |
45 | 45 |
46 if (!HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) { | 46 if (!HAS_DEFINED_PRIVATE(iterator, stringIteratorNextIndexSymbol)) { |
47 throw MakeTypeError(kIncompatibleMethodReceiver, | 47 throw MakeTypeError(kIncompatibleMethodReceiver, |
48 'String Iterator.prototype.next'); | 48 'String Iterator.prototype.next'); |
49 } | 49 } |
50 | 50 |
51 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol); | 51 var s = GET_PRIVATE(iterator, stringIteratorIteratedStringSymbol); |
52 if (IS_UNDEFINED(s)) { | 52 if (IS_UNDEFINED(s)) { |
53 return ArrayIteratorCreateResultObject(UNDEFINED, true); | 53 return ArrayIteratorCreateResultObject(UNDEFINED, true); |
54 } | 54 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 'next', StringIteratorNext | 94 'next', StringIteratorNext |
95 ]); | 95 ]); |
96 %AddNamedProperty(StringIterator.prototype, symbolToStringTag, | 96 %AddNamedProperty(StringIterator.prototype, symbolToStringTag, |
97 "String Iterator", READ_ONLY | DONT_ENUM); | 97 "String Iterator", READ_ONLY | DONT_ENUM); |
98 | 98 |
99 utils.SetFunctionName(StringPrototypeIterator, symbolIterator); | 99 utils.SetFunctionName(StringPrototypeIterator, symbolIterator); |
100 %AddNamedProperty(GlobalString.prototype, symbolIterator, | 100 %AddNamedProperty(GlobalString.prototype, symbolIterator, |
101 StringPrototypeIterator, DONT_ENUM); | 101 StringPrototypeIterator, DONT_ENUM); |
102 | 102 |
103 }) | 103 }) |
OLD | NEW |