diff --git a/src/ast/ast.h b/src/ast/ast.h index c28247049d..3d9142d386 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -376,14 +376,6 @@ class Expression : public AstNode { BailoutId id() const { return BailoutId(local_id(0)); } TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } - // Parenthesized expressions in the form `( Expression )`. - void set_is_parenthesized() { - bit_field_ = ParenthesizedField::update(bit_field_, true); - } - bool is_parenthesized() const { - return ParenthesizedField::decode(bit_field_); - } - protected: Expression(Zone* zone, int pos) : AstNode(pos), @@ -406,8 +398,6 @@ class Expression : public AstNode { int base_id_; Bounds bounds_; class ToBooleanTypesField : public BitField16 {}; - class ParenthesizedField - : public BitField16 {}; uint16_t bit_field_; // Ends with 16-bit field; deriving classes in turn begin with // 16-bit fields for optimum packing efficiency. diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index f541c6472f..e75e87a65a 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h @@ -1312,7 +1312,9 @@ ParserBase::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::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::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). @@ -3311,9 +3309,6 @@ void ParserBase::CheckDestructuringElement( const Scanner::Location location(begin, end); if (expression->IsArrayLiteral() || expression->IsObjectLiteral() || expression->IsAssignment()) { - if (expression->is_parenthesized()) { - classifier->RecordPatternError(location, message); - } return; } diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h index 71bc15326b..32b6446399 100644 --- a/src/parsing/preparser.h +++ b/src/parsing/preparser.h @@ -279,12 +279,6 @@ class PreParserExpression { int position() const { return RelocInfo::kNoPosition; } void set_function_token_position(int position) {} - // Parenthesized expressions in the form `( Expression )`. - void set_is_parenthesized() { - code_ = ParenthesizedField::update(code_, true); - } - bool is_parenthesized() const { return ParenthesizedField::decode(code_); } - private: enum Type { kExpression,