Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: src/collection.js

Issue 1095573002: Revert of Migrate error messages, part 2. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arraybuffer.js ('k') | src/collection-iterator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/arraybuffer.js ('k') | src/collection-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698