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

Unified Diff: src/string.js

Issue 1116953002: Migrate error messages, part 6. (string.js and date.js) (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/messages.js ('k') | test/mjsunit/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 87823d92644abc6c59b1b314c8b410ad199e0229..14350732b66131c1bc271c2a35f5bb5e3167a5f2 100644
--- a/src/string.js
+++ b/src/string.js
@@ -936,9 +936,7 @@ function StringRepeat(count) {
var n = ToInteger(count);
// The maximum string length is stored in a smi, so a longer repeat
// must result in a range error.
- if (n < 0 || n > %_MaxSmi()) {
- throw MakeRangeError("invalid_count_value", []);
- }
+ if (n < 0 || n > %_MaxSmi()) throw MakeRangeError(kInvalidCountValue);
var r = "";
while (true) {
@@ -957,8 +955,7 @@ function StringStartsWith(searchString /* position */) { // length == 1
var s = TO_STRING_INLINE(this);
if (IS_REGEXP(searchString)) {
- throw MakeTypeError("first_argument_not_regexp",
- ["String.prototype.startsWith"]);
+ throw MakeTypeError(kFirstArgumentNotRegExp, "String.prototype.startsWith");
}
var ss = TO_STRING_INLINE(searchString);
@@ -986,8 +983,7 @@ function StringEndsWith(searchString /* position */) { // length == 1
var s = TO_STRING_INLINE(this);
if (IS_REGEXP(searchString)) {
- throw MakeTypeError("first_argument_not_regexp",
- ["String.prototype.endsWith"]);
+ throw MakeTypeError(kFirstArgumentNotRegExp, "String.prototype.endsWith");
}
var ss = TO_STRING_INLINE(searchString);
@@ -1018,8 +1014,7 @@ function StringIncludes(searchString /* position */) { // length == 1
var s = TO_STRING_INLINE(this);
if (IS_REGEXP(searchString)) {
- throw MakeTypeError("first_argument_not_regexp",
- ["String.prototype.includes"]);
+ throw MakeTypeError(kFirstArgumentNotRegExp, "String.prototype.includes");
}
var ss = TO_STRING_INLINE(searchString);
@@ -1074,7 +1069,7 @@ function StringFromCodePoint(_) { // length = 1
code = ToNumber(code);
}
if (code < 0 || code > 0x10FFFF || code !== TO_INTEGER(code)) {
- throw MakeRangeError("invalid_code_point", [code]);
+ throw MakeRangeError(kInvalidCodePoint, code);
}
if (code <= 0xFFFF) {
result += %_StringCharFromCode(code);
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698