Index: src/collection.js |
diff --git a/src/collection.js b/src/collection.js |
index ff8d1be312989f1a33f20fd798e928c711844875..c05dcd5249be6e6fc213fa99bf06cd26c21d7838 100644 |
--- a/src/collection.js |
+++ b/src/collection.js |
@@ -102,7 +102,7 @@ |
if (!IS_NULL_OR_UNDEFINED(iterable)) { |
var adder = this.add; |
if (!IS_SPEC_FUNCTION(adder)) { |
- throw MakeTypeError(kPropertyNotFunction, 'add', this); |
+ throw MakeTypeError(kPropertyNotFunction, ['add', this]); |
} |
for (var value of iterable) { |
@@ -114,7 +114,8 @@ |
function SetAdd(key) { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.add', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.add', this]); |
} |
// Normalize -0 to +0 as required by the spec. |
// Even though we use SameValueZero as the comparison for the keys we don't |
@@ -154,7 +155,8 @@ |
function SetHas(key) { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.has', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.has', this]); |
} |
var table = %_JSCollectionGetTable(this); |
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
@@ -165,8 +167,8 @@ |
function SetDelete(key) { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Set.prototype.delete', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.delete', this]); |
} |
var table = %_JSCollectionGetTable(this); |
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
@@ -187,8 +189,8 @@ |
function SetGetSize() { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Set.prototype.size', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.size', this]); |
} |
var table = %_JSCollectionGetTable(this); |
return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); |
@@ -197,8 +199,8 @@ |
function SetClearJS() { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Set.prototype.clear', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.clear', this]); |
} |
%_SetClear(this); |
} |
@@ -206,11 +208,13 @@ |
function SetForEach(f, receiver) { |
if (!IS_SET(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Set.prototype.forEach', this); |
- } |
- |
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Set.prototype.forEach', this]); |
+ } |
+ |
+ if (!IS_SPEC_FUNCTION(f)) { |
+ throw MakeTypeError('called_non_callable', [f]); |
+ } |
var needs_wrapper = false; |
if (IS_NULL_OR_UNDEFINED(receiver)) { |
receiver = %GetDefaultReceiver(f) || receiver; |
@@ -264,7 +268,7 @@ |
if (!IS_NULL_OR_UNDEFINED(iterable)) { |
var adder = this.set; |
if (!IS_SPEC_FUNCTION(adder)) { |
- throw MakeTypeError(kPropertyNotFunction, 'set', this); |
+ throw MakeTypeError(kPropertyNotFunction, ['set', this]); |
} |
for (var nextItem of iterable) { |
@@ -279,8 +283,8 @@ |
function MapGet(key) { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.get', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.get', this]); |
} |
var table = %_JSCollectionGetTable(this); |
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
@@ -293,8 +297,8 @@ |
function MapSet(key, value) { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.set', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.set', this]); |
} |
// Normalize -0 to +0 as required by the spec. |
// Even though we use SameValueZero as the comparison for the keys we don't |
@@ -341,8 +345,8 @@ |
function MapHas(key) { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.has', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.has', this]); |
} |
var table = %_JSCollectionGetTable(this); |
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
@@ -353,8 +357,8 @@ |
function MapDelete(key) { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.delete', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.delete', this]); |
} |
var table = %_JSCollectionGetTable(this); |
var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table); |
@@ -376,8 +380,8 @@ |
function MapGetSize() { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.size', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.size', this]); |
} |
var table = %_JSCollectionGetTable(this); |
return ORDERED_HASH_TABLE_ELEMENT_COUNT(table); |
@@ -386,8 +390,8 @@ |
function MapClearJS() { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.clear', this); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.clear', this]); |
} |
%_MapClear(this); |
} |
@@ -395,11 +399,13 @@ |
function MapForEach(f, receiver) { |
if (!IS_MAP(this)) { |
- throw MakeTypeError(kIncompatibleMethodReceiver, |
- 'Map.prototype.forEach', this); |
- } |
- |
- if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
+ throw MakeTypeError('incompatible_method_receiver', |
+ ['Map.prototype.forEach', this]); |
+ } |
+ |
+ if (!IS_SPEC_FUNCTION(f)) { |
+ throw MakeTypeError('called_non_callable', [f]); |
+ } |
var needs_wrapper = false; |
if (IS_NULL_OR_UNDEFINED(receiver)) { |
receiver = %GetDefaultReceiver(f) || receiver; |