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 |
11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
12 // Imports | 12 // Imports |
13 | 13 |
14 var ArrayIteratorCreateResultObject; | 14 var ArrayIteratorCreateResultObject; |
15 var GlobalString = global.String; | 15 var GlobalString = global.String; |
| 16 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
16 var stringIteratorIteratedStringSymbol = | 17 var stringIteratorIteratedStringSymbol = |
17 utils.GetPrivateSymbol("string_iterator_iterated_string_symbol"); | 18 utils.ImportNow("string_iterator_iterated_string_symbol"); |
18 var stringIteratorNextIndexSymbol = | 19 var stringIteratorNextIndexSymbol = |
19 utils.GetPrivateSymbol("string_iterator_next_index_symbol"); | 20 utils.ImportNow("string_iterator_next_index_symbol"); |
| 21 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
20 | 22 |
21 utils.Import(function(from) { | 23 utils.Import(function(from) { |
22 ArrayIteratorCreateResultObject = from.ArrayIteratorCreateResultObject; | 24 ArrayIteratorCreateResultObject = from.ArrayIteratorCreateResultObject; |
23 }); | 25 }); |
24 | 26 |
25 // ------------------------------------------------------------------- | 27 // ------------------------------------------------------------------- |
26 | 28 |
27 function StringIterator() {} | 29 function StringIterator() {} |
28 | 30 |
29 | 31 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 86 } |
85 | 87 |
86 //------------------------------------------------------------------- | 88 //------------------------------------------------------------------- |
87 | 89 |
88 %FunctionSetPrototype(StringIterator, {__proto__: $iteratorPrototype}); | 90 %FunctionSetPrototype(StringIterator, {__proto__: $iteratorPrototype}); |
89 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); | 91 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); |
90 | 92 |
91 utils.InstallFunctions(StringIterator.prototype, DONT_ENUM, [ | 93 utils.InstallFunctions(StringIterator.prototype, DONT_ENUM, [ |
92 'next', StringIteratorNext | 94 'next', StringIteratorNext |
93 ]); | 95 ]); |
94 %AddNamedProperty(StringIterator.prototype, symbolToStringTag, | 96 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, |
95 "String Iterator", READ_ONLY | DONT_ENUM); | 97 "String Iterator", READ_ONLY | DONT_ENUM); |
96 | 98 |
97 utils.SetFunctionName(StringPrototypeIterator, symbolIterator); | 99 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); |
98 %AddNamedProperty(GlobalString.prototype, symbolIterator, | 100 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, |
99 StringPrototypeIterator, DONT_ENUM); | 101 StringPrototypeIterator, DONT_ENUM); |
100 | 102 |
101 }) | 103 }) |
OLD | NEW |