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; |