diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h index 522b650be7..306f6d577f 100644 --- a/src/parsing/expression-classifier.h +++ b/src/parsing/expression-classifier.h @@ -61,18 +61,15 @@ class ExpressionClassifier { : location(Scanner::Location::invalid()), message(MessageTemplate::kNone), kind(kUnusedError), - type(kSyntaxError), arg(nullptr) {} V8_INLINE explicit Error(Scanner::Location loc, MessageTemplate::Template msg, ErrorKind k, - const char* a = nullptr, - ParseErrorType t = kSyntaxError) - : location(loc), message(msg), kind(k), type(t), arg(a) {} + const char* a = nullptr) + : location(loc), message(msg), kind(k), arg(a) {} Scanner::Location location; - MessageTemplate::Template message : 26; + MessageTemplate::Template message : 28; unsigned kind : 4; - ParseErrorType type : 2; const char* arg; }; @@ -88,10 +85,6 @@ class ExpressionClassifier { }; // clang-format on - enum FunctionProperties : unsigned { - NonSimpleParameter = 1 << 0 - }; - explicit ExpressionClassifier(typename Types::Base* base, DuplicateFinder* duplicate_finder = nullptr) : base_(base), @@ -100,7 +93,7 @@ class ExpressionClassifier { reported_errors_(base->impl()->GetReportedErrorList()), duplicate_finder_(duplicate_finder), invalid_productions_(0), - function_properties_(0) { + is_non_simple_parameter_list_(0) { base->classifier_ = this; reported_errors_begin_ = reported_errors_end_ = reported_errors_->length(); } @@ -193,11 +186,11 @@ class ExpressionClassifier { } V8_INLINE bool is_simple_parameter_list() const { - return !(function_properties_ & NonSimpleParameter); + return !is_non_simple_parameter_list_; } V8_INLINE void RecordNonSimpleParameter() { - function_properties_ |= NonSimpleParameter; + is_non_simple_parameter_list_ = 1; } void RecordExpressionError(const Scanner::Location& loc, @@ -208,14 +201,6 @@ class ExpressionClassifier { Add(Error(loc, message, kExpressionProduction, arg)); } - void RecordExpressionError(const Scanner::Location& loc, - MessageTemplate::Template message, - ParseErrorType type, const char* arg = nullptr) { - if (!is_valid_expression()) return; - invalid_productions_ |= ExpressionProduction; - Add(Error(loc, message, kExpressionProduction, arg, type)); - } - void RecordFormalParameterInitializerError(const Scanner::Location& loc, MessageTemplate::Template message, const char* arg = nullptr) { @@ -305,9 +290,9 @@ class ExpressionClassifier { bool copy_BP_to_AFP = false; if (productions & ArrowFormalParametersProduction && is_valid_arrow_formal_parameters()) { - // Also copy function properties if expecting an arrow function - // parameter. - function_properties_ |= inner->function_properties_; + // Also whether we've seen any non-simple parameters + // if expecting an arrow function parameter. + is_non_simple_parameter_list_ |= inner->is_non_simple_parameter_list_; if (!inner->is_valid_binding_pattern()) { copy_BP_to_AFP = true; invalid_productions_ |= ArrowFormalParametersProduction; @@ -411,8 +396,8 @@ class ExpressionClassifier { Zone* zone_; ZoneList* reported_errors_; DuplicateFinder* duplicate_finder_; - unsigned invalid_productions_ : 14; - unsigned function_properties_ : 2; + unsigned invalid_productions_ : 15; + unsigned is_non_simple_parameter_list_ : 1; // The uint16_t for reported_errors_begin_ and reported_errors_end_ will // not be enough in the case of a long series of expressions using nested // classifiers, e.g., a long sequence of assignments, as in: diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index 0bde3a0687..30e746eba4 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h @@ -962,8 +962,7 @@ class ParserBase { void ReportClassifierError( const typename ExpressionClassifier::Error& error) { - impl()->ReportMessageAt(error.location, error.message, error.arg, - error.type); + impl()->ReportMessageAt(error.location, error.message, error.arg); } void ValidateExpression(bool* ok) {