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

Unified Diff: src/json-parser.h

Issue 1140053002: Migrate error messages, part 11. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/isolate.cc ('k') | src/jsregexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-parser.h
diff --git a/src/json-parser.h b/src/json-parser.h
index 54c78414804c20ef0f48f3f539eb24bb1790ae8d..b5dc33eb5713bd521444370c5de7fbd7017c3e5e 100644
--- a/src/json-parser.h
+++ b/src/json-parser.h
@@ -213,14 +213,13 @@ MaybeHandle<Object> JsonParser<seq_one_byte>::ParseJson() {
if (isolate_->has_pending_exception()) return Handle<Object>::null();
// Parse failed. Current character is the unexpected token.
- const char* message;
Factory* factory = this->factory();
- Handle<JSArray> array;
+ MessageTemplate::Template message;
+ Handle<String> argument;
switch (c0_) {
case kEndOfString:
- message = "unexpected_eos";
- array = factory->NewJSArray(0);
+ message = MessageTemplate::kUnexpectedEOS;
break;
case '-':
case '0':
@@ -233,26 +232,21 @@ MaybeHandle<Object> JsonParser<seq_one_byte>::ParseJson() {
case '7':
case '8':
case '9':
- message = "unexpected_token_number";
- array = factory->NewJSArray(0);
+ message = MessageTemplate::kUnexpectedTokenNumber;
break;
case '"':
- message = "unexpected_token_string";
- array = factory->NewJSArray(0);
+ message = MessageTemplate::kUnexpectedTokenString;
break;
default:
- message = "unexpected_token";
- Handle<Object> name = factory->LookupSingleCharacterStringFromCode(c0_);
- Handle<FixedArray> element = factory->NewFixedArray(1);
- element->set(0, *name);
- array = factory->NewJSArrayWithElements(element);
+ message = MessageTemplate::kUnexpectedToken;
+ argument = factory->LookupSingleCharacterStringFromCode(c0_);
break;
}
MessageLocation location(factory->NewScript(source_),
position_,
position_ + 1);
- Handle<Object> error = factory->NewSyntaxError(message, array);
+ Handle<Object> error = factory->NewSyntaxError(message, argument);
return isolate()->template Throw<Object>(error, &location);
}
return result;
« no previous file with comments | « src/isolate.cc ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698