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

Unified Diff: src/parsing/parser-base.h

Issue 1570793002: [parser] parenthesized Literals are not valid AssignmentPatterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO + move ParenthesizedField line above Type-dependent fields/comments Created 4 years, 11 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/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 669d5ae86d9f3af0e6188546956e1db07f5bf8ae..caf07ae5e420b703d444b000047402eb832cfb3b 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1365,6 +1365,7 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
Expect(Token::RPAREN, CHECK_OK);
if (peek() != Token::ARROW) {
ValidateExpression(classifier, CHECK_OK);
+ expr->set_is_parenthesized();
}
return expr;
}
@@ -2041,7 +2042,8 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
ExpressionClassifier::CoverInitializedNameProduction);
bool maybe_pattern =
- expression->IsObjectLiteral() || expression->IsArrayLiteral();
+ (expression->IsObjectLiteral() || expression->IsArrayLiteral()) &&
+ !expression->is_parenthesized();
if (!Token::IsAssignmentOp(peek())) {
// Parsed conditional expression only (no assignment).
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698