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 GlobalString = global.String; | 14 var GlobalString = global.String; |
15 var IteratorPrototype = utils.ImportNow("IteratorPrototype"); | 15 var IteratorPrototype = utils.ImportNow("IteratorPrototype"); |
16 var iteratorSymbol = utils.ImportNow("iterator_symbol"); | 16 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
| 17 var MakeTypeError; |
17 var stringIteratorIteratedStringSymbol = | 18 var stringIteratorIteratedStringSymbol = |
18 utils.ImportNow("string_iterator_iterated_string_symbol"); | 19 utils.ImportNow("string_iterator_iterated_string_symbol"); |
19 var stringIteratorNextIndexSymbol = | 20 var stringIteratorNextIndexSymbol = |
20 utils.ImportNow("string_iterator_next_index_symbol"); | 21 utils.ImportNow("string_iterator_next_index_symbol"); |
21 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 22 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
22 | 23 |
| 24 utils.Import(function(from) { |
| 25 MakeTypeError = from.MakeTypeError; |
| 26 }); |
| 27 |
23 // ------------------------------------------------------------------- | 28 // ------------------------------------------------------------------- |
24 | 29 |
25 function StringIterator() {} | 30 function StringIterator() {} |
26 | 31 |
27 | 32 |
28 // 21.1.5.1 CreateStringIterator Abstract Operation | 33 // 21.1.5.1 CreateStringIterator Abstract Operation |
29 function CreateStringIterator(string) { | 34 function CreateStringIterator(string) { |
30 var s = TO_STRING(string); | 35 var s = TO_STRING(string); |
31 var iterator = new StringIterator; | 36 var iterator = new StringIterator; |
32 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); | 37 SET_PRIVATE(iterator, stringIteratorIteratedStringSymbol, s); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 'next', StringIteratorNext | 93 'next', StringIteratorNext |
89 ]); | 94 ]); |
90 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, | 95 %AddNamedProperty(StringIterator.prototype, toStringTagSymbol, |
91 "String Iterator", READ_ONLY | DONT_ENUM); | 96 "String Iterator", READ_ONLY | DONT_ENUM); |
92 | 97 |
93 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); | 98 utils.SetFunctionName(StringPrototypeIterator, iteratorSymbol); |
94 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, | 99 %AddNamedProperty(GlobalString.prototype, iteratorSymbol, |
95 StringPrototypeIterator, DONT_ENUM); | 100 StringPrototypeIterator, DONT_ENUM); |
96 | 101 |
97 }) | 102 }) |
OLD | NEW |