| Index: src/collection.js
|
| diff --git a/src/collection.js b/src/collection.js
|
| index af1b22347bbce972e63738b43ae06bcfd428070a..206aaa79134709b0a1a1c67c98646e73cccd9ffe 100644
|
| --- a/src/collection.js
|
| +++ b/src/collection.js
|
| @@ -99,7 +99,7 @@ function SetConstructor(iterable) {
|
| 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) {
|
| @@ -111,8 +111,7 @@ function SetConstructor(iterable) {
|
|
|
| function SetAdd(key) {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.add', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver, '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
|
| @@ -152,8 +151,7 @@ function SetAdd(key) {
|
|
|
| function SetHas(key) {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.has', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver, 'Set.prototype.has', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
|
| @@ -164,8 +162,8 @@ function SetHas(key) {
|
|
|
| function SetDelete(key) {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.delete', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Set.prototype.delete', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
|
| @@ -186,8 +184,8 @@ function SetDelete(key) {
|
|
|
| function SetGetSize() {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.size', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Set.prototype.size', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| return ORDERED_HASH_TABLE_ELEMENT_COUNT(table);
|
| @@ -196,8 +194,8 @@ function SetGetSize() {
|
|
|
| function SetClearJS() {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.clear', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Set.prototype.clear', this);
|
| }
|
| %_SetClear(this);
|
| }
|
| @@ -205,13 +203,11 @@ function SetClearJS() {
|
|
|
| function SetForEach(f, receiver) {
|
| if (!IS_SET(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Set.prototype.forEach', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Set.prototype.forEach', this);
|
| }
|
|
|
| - if (!IS_SPEC_FUNCTION(f)) {
|
| - throw MakeTypeError('called_non_callable', [f]);
|
| - }
|
| + if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
|
| var needs_wrapper = false;
|
| if (IS_NULL_OR_UNDEFINED(receiver)) {
|
| receiver = %GetDefaultReceiver(f) || receiver;
|
| @@ -266,7 +262,7 @@ function MapConstructor(iterable) {
|
| 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) {
|
| @@ -281,8 +277,8 @@ function MapConstructor(iterable) {
|
|
|
| function MapGet(key) {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.get', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.get', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
|
| @@ -295,8 +291,8 @@ function MapGet(key) {
|
|
|
| function MapSet(key, value) {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.set', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + '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
|
| @@ -343,8 +339,8 @@ function MapSet(key, value) {
|
|
|
| function MapHas(key) {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.has', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.has', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
|
| @@ -355,8 +351,8 @@ function MapHas(key) {
|
|
|
| function MapDelete(key) {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.delete', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.delete', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| var numBuckets = ORDERED_HASH_TABLE_BUCKET_COUNT(table);
|
| @@ -378,8 +374,8 @@ function MapDelete(key) {
|
|
|
| function MapGetSize() {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.size', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.size', this);
|
| }
|
| var table = %_JSCollectionGetTable(this);
|
| return ORDERED_HASH_TABLE_ELEMENT_COUNT(table);
|
| @@ -388,8 +384,8 @@ function MapGetSize() {
|
|
|
| function MapClearJS() {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.clear', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.clear', this);
|
| }
|
| %_MapClear(this);
|
| }
|
| @@ -397,13 +393,11 @@ function MapClearJS() {
|
|
|
| function MapForEach(f, receiver) {
|
| if (!IS_MAP(this)) {
|
| - throw MakeTypeError('incompatible_method_receiver',
|
| - ['Map.prototype.forEach', this]);
|
| + throw MakeTypeError(kIncompatibleMethodReceiver,
|
| + 'Map.prototype.forEach', this);
|
| }
|
|
|
| - if (!IS_SPEC_FUNCTION(f)) {
|
| - throw MakeTypeError('called_non_callable', [f]);
|
| - }
|
| + if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f);
|
| var needs_wrapper = false;
|
| if (IS_NULL_OR_UNDEFINED(receiver)) {
|
| receiver = %GetDefaultReceiver(f) || receiver;
|
|
|