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

Unified Diff: src/collection.js

Issue 1086313003: 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 c05dcd5249be6e6fc213fa99bf06cd26c21d7838..ff8d1be312989f1a33f20fd798e928c711844875 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -102,7 +102,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) {
@@ -114,8 +114,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
@@ -155,8 +154,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);
@@ -167,8 +165,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);
@@ -189,8 +187,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);
@@ -199,8 +197,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);
}
@@ -208,13 +206,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;
@@ -268,7 +264,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) {
@@ -283,8 +279,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);
@@ -297,8 +293,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
@@ -345,8 +341,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);
@@ -357,8 +353,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);
@@ -380,8 +376,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);
@@ -390,8 +386,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);
}
@@ -399,13 +395,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;
« 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