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() { | 5 (function() { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
11 var GlobalArray = global.Array; | |
12 var GlobalObject = global.Object; | 11 var GlobalObject = global.Object; |
13 var GlobalString = global.String; | 12 var GlobalString = global.String; |
14 | 13 |
15 //------------------------------------------------------------------- | 14 //------------------------------------------------------------------- |
16 | 15 |
17 var stringIteratorIteratedStringSymbol = | 16 var stringIteratorIteratedStringSymbol = |
18 GLOBAL_PRIVATE("StringIterator#iteratedString"); | 17 GLOBAL_PRIVATE("StringIterator#iteratedString"); |
19 var stringIteratorNextIndexSymbol = GLOBAL_PRIVATE("StringIterator#next"); | 18 var stringIteratorNextIndexSymbol = GLOBAL_PRIVATE("StringIterator#next"); |
20 | 19 |
21 | 20 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // 21.1.3.27 String.prototype [ @@iterator ]( ) | 81 // 21.1.3.27 String.prototype [ @@iterator ]( ) |
83 function StringPrototypeIterator() { | 82 function StringPrototypeIterator() { |
84 return CreateStringIterator(this); | 83 return CreateStringIterator(this); |
85 } | 84 } |
86 | 85 |
87 //------------------------------------------------------------------- | 86 //------------------------------------------------------------------- |
88 | 87 |
89 %FunctionSetPrototype(StringIterator, new GlobalObject()); | 88 %FunctionSetPrototype(StringIterator, new GlobalObject()); |
90 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); | 89 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); |
91 | 90 |
92 InstallFunctions(StringIterator.prototype, DONT_ENUM, GlobalArray( | 91 InstallFunctions(StringIterator.prototype, DONT_ENUM, [ |
93 'next', StringIteratorNext | 92 'next', StringIteratorNext |
94 )); | 93 ]); |
95 %FunctionSetName(StringIteratorIterator, '[Symbol.iterator]'); | 94 %FunctionSetName(StringIteratorIterator, '[Symbol.iterator]'); |
96 %AddNamedProperty(StringIterator.prototype, symbolIterator, | 95 %AddNamedProperty(StringIterator.prototype, symbolIterator, |
97 StringIteratorIterator, DONT_ENUM); | 96 StringIteratorIterator, DONT_ENUM); |
98 %AddNamedProperty(StringIterator.prototype, symbolToStringTag, | 97 %AddNamedProperty(StringIterator.prototype, symbolToStringTag, |
99 "String Iterator", READ_ONLY | DONT_ENUM); | 98 "String Iterator", READ_ONLY | DONT_ENUM); |
100 | 99 |
101 %FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]'); | 100 %FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]'); |
102 %AddNamedProperty(GlobalString.prototype, symbolIterator, | 101 %AddNamedProperty(GlobalString.prototype, symbolIterator, |
103 StringPrototypeIterator, DONT_ENUM); | 102 StringPrototypeIterator, DONT_ENUM); |
104 | 103 |
105 })(); | 104 })(); |
OLD | NEW |