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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 | 7 |
8 // This file relies on the fact that the following declaration has been made | 8 // This file relies on the fact that the following declaration has been made |
9 // in runtime.js: | 9 // in runtime.js: |
10 // var $String = global.String; | 10 // var $String = global.String; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 function SetUpStringIterator() { | 77 function SetUpStringIterator() { |
78 %CheckIsBootstrapping(); | 78 %CheckIsBootstrapping(); |
79 | 79 |
80 %FunctionSetPrototype(StringIterator, new $Object()); | 80 %FunctionSetPrototype(StringIterator, new $Object()); |
81 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); | 81 %FunctionSetInstanceClassName(StringIterator, 'String Iterator'); |
82 | 82 |
83 InstallFunctions(StringIterator.prototype, DONT_ENUM, $Array( | 83 InstallFunctions(StringIterator.prototype, DONT_ENUM, $Array( |
84 'next', StringIteratorNext | 84 'next', StringIteratorNext |
85 )); | 85 )); |
86 %FunctionSetName(StringIteratorIterator, '[Symbol.iterator]'); | 86 %FunctionSetName(StringIteratorIterator, '[Symbol.iterator]'); |
87 %AddProperty(StringIterator.prototype, symbolIterator, StringIteratorIterator, | 87 %AddNamedProperty(StringIterator.prototype, symbolIterator, |
88 DONT_ENUM); | 88 StringIteratorIterator, DONT_ENUM); |
89 } | 89 } |
90 SetUpStringIterator(); | 90 SetUpStringIterator(); |
91 | 91 |
92 | 92 |
93 // 21.1.3.27 String.prototype [ @@iterator ]( ) | 93 // 21.1.3.27 String.prototype [ @@iterator ]( ) |
94 function StringPrototypeIterator() { | 94 function StringPrototypeIterator() { |
95 return CreateStringIterator(this); | 95 return CreateStringIterator(this); |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 function ExtendStringPrototypeWithIterator() { | 99 function ExtendStringPrototypeWithIterator() { |
100 %CheckIsBootstrapping(); | 100 %CheckIsBootstrapping(); |
101 | 101 |
102 %FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]'); | 102 %FunctionSetName(StringPrototypeIterator, '[Symbol.iterator]'); |
103 %AddProperty($String.prototype, symbolIterator, StringPrototypeIterator, | 103 %AddNamedProperty($String.prototype, symbolIterator, |
104 DONT_ENUM); | 104 StringPrototypeIterator, DONT_ENUM); |
105 } | 105 } |
106 ExtendStringPrototypeWithIterator(); | 106 ExtendStringPrototypeWithIterator(); |
OLD | NEW |