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

Unified Diff: src/preparser.h

Issue 1236803003: Improve parsing errors related to related to destructuring bind (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 9f586469583c5cc7681c6a78c8f3d05b7b3ed260..506e29daf63baca13d38724e831f9232142e9e52 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -2170,7 +2170,7 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
case Token::SMI:
case Token::NUMBER:
classifier->RecordBindingPatternError(
- scanner()->location(), MessageTemplate::kUnexpectedTokenNumber);
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber);
Next();
result =
this->ExpressionFromLiteral(token, beg_pos, scanner(), factory());
@@ -2190,17 +2190,21 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
case Token::STRING: {
classifier->RecordBindingPatternError(
- scanner()->location(), MessageTemplate::kUnexpectedTokenString);
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenString);
Consume(Token::STRING);
result = this->ExpressionFromString(beg_pos, scanner(), factory());
break;
}
case Token::ASSIGN_DIV:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenRegExp);
result = this->ParseRegExpLiteral(true, classifier, CHECK_OK);
break;
case Token::DIV:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenRegExp);
result = this->ParseRegExpLiteral(false, classifier, CHECK_OK);
break;
@@ -2302,6 +2306,9 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
case Token::TEMPLATE_SPAN:
case Token::TEMPLATE_TAIL:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(),
+ MessageTemplate::kUnexpectedTemplateString);
result = this->ParseTemplateLiteral(Traits::NoTemplateTag(), beg_pos,
classifier, CHECK_OK);
break;
« no previous file with comments | « src/messages.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698