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 $Set = global.Set; | 10 // var $Set = global.Set; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 %CheckIsBootstrapping(); | 52 %CheckIsBootstrapping(); |
53 | 53 |
54 %SetCode(SetIterator, SetIteratorConstructor); | 54 %SetCode(SetIterator, SetIteratorConstructor); |
55 %FunctionSetPrototype(SetIterator, new $Object()); | 55 %FunctionSetPrototype(SetIterator, new $Object()); |
56 %FunctionSetInstanceClassName(SetIterator, 'Set Iterator'); | 56 %FunctionSetInstanceClassName(SetIterator, 'Set Iterator'); |
57 InstallFunctions(SetIterator.prototype, DONT_ENUM, $Array( | 57 InstallFunctions(SetIterator.prototype, DONT_ENUM, $Array( |
58 'next', SetIteratorNextJS | 58 'next', SetIteratorNextJS |
59 )); | 59 )); |
60 | 60 |
61 %FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]'); | 61 %FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]'); |
62 %SetProperty(SetIterator.prototype, InternalSymbol('Symbol.iterator'), | 62 %SetProperty(SetIterator.prototype, symbolIterator, |
63 SetIteratorSymbolIterator, DONT_ENUM); | 63 SetIteratorSymbolIterator, DONT_ENUM); |
64 } | 64 } |
65 | 65 |
66 SetUpSetIterator(); | 66 SetUpSetIterator(); |
67 | 67 |
68 | 68 |
69 function ExtendSetPrototype() { | 69 function ExtendSetPrototype() { |
70 %CheckIsBootstrapping(); | 70 %CheckIsBootstrapping(); |
71 | 71 |
72 InstallFunctions($Set.prototype, DONT_ENUM, $Array( | 72 InstallFunctions($Set.prototype, DONT_ENUM, $Array( |
73 'entries', SetEntries, | 73 'entries', SetEntries, |
74 'values', SetValues | 74 'values', SetValues |
75 )); | 75 )); |
76 | 76 |
77 %SetProperty($Set.prototype, InternalSymbol('Symbol.iterator'), SetValues, | 77 %SetProperty($Set.prototype, symbolIterator, SetValues, |
78 DONT_ENUM); | 78 DONT_ENUM); |
79 } | 79 } |
80 | 80 |
81 ExtendSetPrototype(); | 81 ExtendSetPrototype(); |
82 | 82 |
83 | 83 |
84 | 84 |
85 function MapIteratorConstructor(map, kind) { | 85 function MapIteratorConstructor(map, kind) { |
86 %MapIteratorInitialize(this, map, kind); | 86 %MapIteratorInitialize(this, map, kind); |
87 } | 87 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 %CheckIsBootstrapping(); | 132 %CheckIsBootstrapping(); |
133 | 133 |
134 %SetCode(MapIterator, MapIteratorConstructor); | 134 %SetCode(MapIterator, MapIteratorConstructor); |
135 %FunctionSetPrototype(MapIterator, new $Object()); | 135 %FunctionSetPrototype(MapIterator, new $Object()); |
136 %FunctionSetInstanceClassName(MapIterator, 'Map Iterator'); | 136 %FunctionSetInstanceClassName(MapIterator, 'Map Iterator'); |
137 InstallFunctions(MapIterator.prototype, DONT_ENUM, $Array( | 137 InstallFunctions(MapIterator.prototype, DONT_ENUM, $Array( |
138 'next', MapIteratorNextJS | 138 'next', MapIteratorNextJS |
139 )); | 139 )); |
140 | 140 |
141 %FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]'); | 141 %FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]'); |
142 %SetProperty(MapIterator.prototype, InternalSymbol('Symbol.iterator'), | 142 %SetProperty(MapIterator.prototype, symbolIterator, |
143 MapIteratorSymbolIterator, DONT_ENUM); | 143 MapIteratorSymbolIterator, DONT_ENUM); |
144 } | 144 } |
145 | 145 |
146 SetUpMapIterator(); | 146 SetUpMapIterator(); |
147 | 147 |
148 | 148 |
149 function ExtendMapPrototype() { | 149 function ExtendMapPrototype() { |
150 %CheckIsBootstrapping(); | 150 %CheckIsBootstrapping(); |
151 | 151 |
152 InstallFunctions($Map.prototype, DONT_ENUM, $Array( | 152 InstallFunctions($Map.prototype, DONT_ENUM, $Array( |
153 'entries', MapEntries, | 153 'entries', MapEntries, |
154 'keys', MapKeys, | 154 'keys', MapKeys, |
155 'values', MapValues | 155 'values', MapValues |
156 )); | 156 )); |
157 | 157 |
158 %SetProperty($Map.prototype, InternalSymbol('Symbol.iterator'), MapEntries, | 158 %SetProperty($Map.prototype, symbolIterator, MapEntries, |
159 DONT_ENUM); | 159 DONT_ENUM); |
160 } | 160 } |
161 | 161 |
162 ExtendMapPrototype(); | 162 ExtendMapPrototype(); |
OLD | NEW |