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 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 function SetConstructor(iterable) { | 95 function SetConstructor(iterable) { |
96 if (!%_IsConstructCall()) { | 96 if (!%_IsConstructCall()) { |
97 throw MakeTypeError('constructor_not_function', ['Set']); | 97 throw MakeTypeError('constructor_not_function', ['Set']); |
98 } | 98 } |
99 | 99 |
100 %_SetInitialize(this); | 100 %_SetInitialize(this); |
101 | 101 |
102 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 102 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
103 var adder = this.add; | 103 var adder = this.add; |
104 if (!IS_SPEC_FUNCTION(adder)) { | 104 if (!IS_SPEC_FUNCTION(adder)) { |
105 throw MakeTypeError('property_not_function', ['add', this]); | 105 throw MakeTypeError(kPropertyNotFunction, ['add', this]); |
106 } | 106 } |
107 | 107 |
108 for (var value of iterable) { | 108 for (var value of iterable) { |
109 %_CallFunction(this, value, adder); | 109 %_CallFunction(this, value, adder); |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 function SetAdd(key) { | 115 function SetAdd(key) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 function MapConstructor(iterable) { | 261 function MapConstructor(iterable) { |
262 if (!%_IsConstructCall()) { | 262 if (!%_IsConstructCall()) { |
263 throw MakeTypeError('constructor_not_function', ['Map']); | 263 throw MakeTypeError('constructor_not_function', ['Map']); |
264 } | 264 } |
265 | 265 |
266 %_MapInitialize(this); | 266 %_MapInitialize(this); |
267 | 267 |
268 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 268 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
269 var adder = this.set; | 269 var adder = this.set; |
270 if (!IS_SPEC_FUNCTION(adder)) { | 270 if (!IS_SPEC_FUNCTION(adder)) { |
271 throw MakeTypeError('property_not_function', ['set', this]); | 271 throw MakeTypeError(kPropertyNotFunction, ['set', this]); |
272 } | 272 } |
273 | 273 |
274 for (var nextItem of iterable) { | 274 for (var nextItem of iterable) { |
275 if (!IS_SPEC_OBJECT(nextItem)) { | 275 if (!IS_SPEC_OBJECT(nextItem)) { |
276 throw MakeTypeError('iterator_value_not_an_object', [nextItem]); | 276 throw MakeTypeError('iterator_value_not_an_object', [nextItem]); |
277 } | 277 } |
278 %_CallFunction(this, nextItem[0], nextItem[1], adder); | 278 %_CallFunction(this, nextItem[0], nextItem[1], adder); |
279 } | 279 } |
280 } | 280 } |
281 } | 281 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 InstallFunctions($Map.prototype, DONT_ENUM, [ | 438 InstallFunctions($Map.prototype, DONT_ENUM, [ |
439 "get", MapGet, | 439 "get", MapGet, |
440 "set", MapSet, | 440 "set", MapSet, |
441 "has", MapHas, | 441 "has", MapHas, |
442 "delete", MapDelete, | 442 "delete", MapDelete, |
443 "clear", MapClearJS, | 443 "clear", MapClearJS, |
444 "forEach", MapForEach | 444 "forEach", MapForEach |
445 ]); | 445 ]); |
446 | 446 |
447 })(); | 447 })(); |
OLD | NEW |