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

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

Issue 1665043002: Remove is_parenthesized bit from Expression and PreParserExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@simplify-parsing-result
Patch Set: 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/ast/ast.h ('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 83c8375197db75ad352b8bbb98a3fd587825ac3c..e44ebe01f4f6e4ee4d7e010c6ba808dc4480da26 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1312,7 +1312,9 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
if (!classifier->is_valid_binding_pattern()) {
ArrowFormalParametersUnexpectedToken(classifier);
}
- BindingPatternUnexpectedToken(classifier);
+ classifier->RecordPatternError(scanner()->peek_location(),
+ MessageTemplate::kUnexpectedToken,
+ Token::String(Token::LPAREN));
Consume(Token::LPAREN);
if (Check(Token::RPAREN)) {
// ()=>x. The continuation that looks for the => is in
@@ -1356,9 +1358,6 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
ExpressionT expr = this->ParseExpression(true, kIsPossibleArrowFormals,
classifier, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
- if (peek() != Token::ARROW) {
- expr->set_is_parenthesized();
- }
return expr;
}
@@ -2025,8 +2024,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
ExpressionClassifier::CoverInitializedNameProduction);
bool maybe_pattern =
- (expression->IsObjectLiteral() || expression->IsArrayLiteral()) &&
- !expression->is_parenthesized();
+ expression->IsObjectLiteral() || expression->IsArrayLiteral();
if (!Token::IsAssignmentOp(peek())) {
// Parsed conditional expression only (no assignment).
@@ -3314,9 +3312,6 @@ void ParserBase<Traits>::CheckDestructuringElement(
const Scanner::Location location(begin, end);
if (expression->IsArrayLiteral() || expression->IsObjectLiteral() ||
expression->IsAssignment()) {
- if (expression->is_parenthesized()) {
- classifier->RecordPatternError(location, message);
- }
return;
}
« no previous file with comments | « src/ast/ast.h ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698