OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
10 | 10 |
11 var $Set = global.Set; | 11 var $Set = global.Set; |
12 var $Map = global.Map; | 12 var $Map = global.Map; |
13 | 13 |
14 | 14 |
15 // ------------------------------------------------------------------- | 15 // ------------------------------------------------------------------- |
16 // Harmony Set | 16 // Harmony Set |
17 | 17 |
18 function SetConstructor(iterable) { | 18 function SetConstructor(iterable) { |
19 if (!%_IsConstructCall()) { | 19 if (!%_IsConstructCall()) { |
20 throw MakeTypeError('constructor_not_function', ['Set']); | 20 throw MakeTypeError('constructor_not_function', ['Set']); |
21 } | 21 } |
22 | 22 |
23 var iter, adder; | 23 var iter, adder; |
24 | 24 |
25 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 25 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
26 iter = GetIterator(ToObject(iterable)); | 26 iter = GetIterator(iterable); |
27 adder = this.add; | 27 adder = this.add; |
28 if (!IS_SPEC_FUNCTION(adder)) { | 28 if (!IS_SPEC_FUNCTION(adder)) { |
29 throw MakeTypeError('property_not_function', ['add', this]); | 29 throw MakeTypeError('property_not_function', ['add', this]); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 %_SetInitialize(this); | 33 %_SetInitialize(this); |
34 | 34 |
35 if (IS_UNDEFINED(iter)) return; | 35 if (IS_UNDEFINED(iter)) return; |
36 | 36 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Harmony Map | 156 // Harmony Map |
157 | 157 |
158 function MapConstructor(iterable) { | 158 function MapConstructor(iterable) { |
159 if (!%_IsConstructCall()) { | 159 if (!%_IsConstructCall()) { |
160 throw MakeTypeError('constructor_not_function', ['Map']); | 160 throw MakeTypeError('constructor_not_function', ['Map']); |
161 } | 161 } |
162 | 162 |
163 var iter, adder; | 163 var iter, adder; |
164 | 164 |
165 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 165 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
166 iter = GetIterator(ToObject(iterable)); | 166 iter = GetIterator(iterable); |
167 adder = this.set; | 167 adder = this.set; |
168 if (!IS_SPEC_FUNCTION(adder)) { | 168 if (!IS_SPEC_FUNCTION(adder)) { |
169 throw MakeTypeError('property_not_function', ['set', this]); | 169 throw MakeTypeError('property_not_function', ['set', this]); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 %_MapInitialize(this); | 173 %_MapInitialize(this); |
174 | 174 |
175 if (IS_UNDEFINED(iter)) return; | 175 if (IS_UNDEFINED(iter)) return; |
176 | 176 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 "get", MapGetJS, | 295 "get", MapGetJS, |
296 "set", MapSetJS, | 296 "set", MapSetJS, |
297 "has", MapHasJS, | 297 "has", MapHasJS, |
298 "delete", MapDeleteJS, | 298 "delete", MapDeleteJS, |
299 "clear", MapClearJS, | 299 "clear", MapClearJS, |
300 "forEach", MapForEach | 300 "forEach", MapForEach |
301 )); | 301 )); |
302 } | 302 } |
303 | 303 |
304 SetUpMap(); | 304 SetUpMap(); |
OLD | NEW |