Chromium Code Reviews| Index: src/parsing/parser-base.h |
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
| index f687820fd57ff3277f2ca75bb197a4c6c9f82274..33437a1353fc9db769b5b7bfffb2b7d81381bfd8 100644 |
| --- a/src/parsing/parser-base.h |
| +++ b/src/parsing/parser-base.h |
| @@ -233,6 +233,7 @@ class ParserBase { |
| parsing_module_(false), |
| stack_limit_(stack_limit), |
| zone_(zone), |
| + classifier_wrapper_(nullptr), |
| scanner_(scanner), |
| stack_overflow_(false), |
| allow_lazy_(false), |
| @@ -833,9 +834,7 @@ class ParserBase { |
| ok); |
| } |
| - void CheckDestructuringElement(ExpressionT element, |
| - ExpressionClassifier* classifier, int beg_pos, |
| - int end_pos); |
| + void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos); |
| // Checking the name of a function literal. This has to be done after parsing |
| // the function, since the function can declare itself strict. |
| @@ -915,47 +914,43 @@ class ParserBase { |
| error.type); |
| } |
| - void ValidateExpression(const ExpressionClassifier* classifier, bool* ok) { |
| - if (!classifier->is_valid_expression()) { |
| - ReportClassifierError(classifier->expression_error()); |
| + void ValidateExpression(bool* ok) { |
| + if (!classifier()->is_valid_expression()) { |
| + ReportClassifierError(classifier()->expression_error()); |
| *ok = false; |
| } |
| } |
| - void ValidateFormalParameterInitializer( |
| - const ExpressionClassifier* classifier, bool* ok) { |
| - if (!classifier->is_valid_formal_parameter_initializer()) { |
| - ReportClassifierError(classifier->formal_parameter_initializer_error()); |
| + void ValidateFormalParameterInitializer(bool* ok) { |
| + if (!classifier()->is_valid_formal_parameter_initializer()) { |
| + ReportClassifierError(classifier()->formal_parameter_initializer_error()); |
| *ok = false; |
| } |
| } |
| - void ValidateBindingPattern(const ExpressionClassifier* classifier, |
| - bool* ok) { |
| - if (!classifier->is_valid_binding_pattern()) { |
| - ReportClassifierError(classifier->binding_pattern_error()); |
| + void ValidateBindingPattern(bool* ok) { |
| + if (!classifier()->is_valid_binding_pattern()) { |
| + ReportClassifierError(classifier()->binding_pattern_error()); |
| *ok = false; |
| } |
| } |
| - void ValidateAssignmentPattern(const ExpressionClassifier* classifier, |
| - bool* ok) { |
| - if (!classifier->is_valid_assignment_pattern()) { |
| - ReportClassifierError(classifier->assignment_pattern_error()); |
| + void ValidateAssignmentPattern(bool* ok) { |
| + if (!classifier()->is_valid_assignment_pattern()) { |
| + ReportClassifierError(classifier()->assignment_pattern_error()); |
| *ok = false; |
| } |
| } |
| - void ValidateFormalParameters(const ExpressionClassifier* classifier, |
| - LanguageMode language_mode, |
| + void ValidateFormalParameters(LanguageMode language_mode, |
| bool allow_duplicates, bool* ok) { |
| if (!allow_duplicates && |
| - !classifier->is_valid_formal_parameter_list_without_duplicates()) { |
| - ReportClassifierError(classifier->duplicate_formal_parameter_error()); |
| + !classifier()->is_valid_formal_parameter_list_without_duplicates()) { |
| + ReportClassifierError(classifier()->duplicate_formal_parameter_error()); |
| *ok = false; |
| } else if (is_strict(language_mode) && |
| - !classifier->is_valid_strict_mode_formal_parameters()) { |
| - ReportClassifierError(classifier->strict_mode_formal_parameter_error()); |
| + !classifier()->is_valid_strict_mode_formal_parameters()) { |
| + ReportClassifierError(classifier()->strict_mode_formal_parameter_error()); |
| *ok = false; |
| } |
| } |
| @@ -964,11 +959,10 @@ class ParserBase { |
| return is_any_identifier(token) || token == Token::LPAREN; |
| } |
| - void ValidateArrowFormalParameters(const ExpressionClassifier* classifier, |
| - ExpressionT expr, |
| + void ValidateArrowFormalParameters(ExpressionT expr, |
| bool parenthesized_formals, bool is_async, |
| bool* ok) { |
| - if (classifier->is_valid_binding_pattern()) { |
| + if (classifier()->is_valid_binding_pattern()) { |
| // A simple arrow formal parameter: IDENTIFIER => BODY. |
| if (!impl()->IsIdentifier(expr)) { |
| impl()->ReportMessageAt(scanner()->location(), |
| @@ -976,63 +970,62 @@ class ParserBase { |
| Token::String(scanner()->current_token())); |
| *ok = false; |
| } |
| - } else if (!classifier->is_valid_arrow_formal_parameters()) { |
| + } else if (!classifier()->is_valid_arrow_formal_parameters()) { |
| // If after parsing the expr, we see an error but the expression is |
| // neither a valid binding pattern nor a valid parenthesized formal |
| // parameter list, show the "arrow formal parameters" error if the formals |
| // started with a parenthesis, and the binding pattern error otherwise. |
| const typename ExpressionClassifier::Error& error = |
| - parenthesized_formals ? classifier->arrow_formal_parameters_error() |
| - : classifier->binding_pattern_error(); |
| + parenthesized_formals ? classifier()->arrow_formal_parameters_error() |
| + : classifier()->binding_pattern_error(); |
| ReportClassifierError(error); |
| *ok = false; |
| } |
| - if (is_async && !classifier->is_valid_async_arrow_formal_parameters()) { |
| + if (is_async && !classifier()->is_valid_async_arrow_formal_parameters()) { |
| const typename ExpressionClassifier::Error& error = |
| - classifier->async_arrow_formal_parameters_error(); |
| + classifier()->async_arrow_formal_parameters_error(); |
| ReportClassifierError(error); |
| *ok = false; |
| } |
| } |
| - void ValidateLetPattern(const ExpressionClassifier* classifier, bool* ok) { |
| - if (!classifier->is_valid_let_pattern()) { |
| - ReportClassifierError(classifier->let_pattern_error()); |
| + void ValidateLetPattern(bool* ok) { |
| + if (!classifier()->is_valid_let_pattern()) { |
| + ReportClassifierError(classifier()->let_pattern_error()); |
| *ok = false; |
| } |
| } |
| - void CheckNoTailCallExpressions(const ExpressionClassifier* classifier, |
| - bool* ok) { |
| + void CheckNoTailCallExpressions(bool* ok) { |
| if (FLAG_harmony_explicit_tailcalls && |
| - classifier->has_tail_call_expression()) { |
| - ReportClassifierError(classifier->tail_call_expression_error()); |
| + classifier()->has_tail_call_expression()) { |
| + ReportClassifierError(classifier()->tail_call_expression_error()); |
| *ok = false; |
| } |
| } |
| - void ExpressionUnexpectedToken(ExpressionClassifier* classifier) { |
| + void ExpressionUnexpectedToken() { |
| MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; |
| const char* arg; |
| Scanner::Location location = scanner()->peek_location(); |
| GetUnexpectedTokenMessage(peek(), &message, &location, &arg); |
| - classifier->RecordExpressionError(location, message, arg); |
| + classifier()->RecordExpressionError(location, message, arg); |
| } |
| - void BindingPatternUnexpectedToken(ExpressionClassifier* classifier) { |
| + void BindingPatternUnexpectedToken() { |
| MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; |
| const char* arg; |
| Scanner::Location location = scanner()->peek_location(); |
| GetUnexpectedTokenMessage(peek(), &message, &location, &arg); |
| - classifier->RecordBindingPatternError(location, message, arg); |
| + classifier()->RecordBindingPatternError(location, message, arg); |
| } |
| - void ArrowFormalParametersUnexpectedToken(ExpressionClassifier* classifier) { |
| + void ArrowFormalParametersUnexpectedToken() { |
| MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; |
| const char* arg; |
| Scanner::Location location = scanner()->peek_location(); |
| GetUnexpectedTokenMessage(peek(), &message, &location, &arg); |
| - classifier->RecordArrowFormalParametersError(location, message, arg); |
| + classifier()->RecordArrowFormalParametersError(location, message, arg); |
| } |
| // Recursive descent functions: |
| @@ -1043,8 +1036,7 @@ class ParserBase { |
| // "arguments" as identifier even in strict mode (this is needed in cases like |
| // "var foo = eval;"). |
| IdentifierT ParseIdentifier(AllowRestrictedIdentifiers, bool* ok); |
| - IdentifierT ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| - bool* ok); |
| + IdentifierT ParseAndClassifyIdentifier(bool* ok); |
| // Parses an identifier or a strict mode future reserved word, and indicate |
| // whether it is strict mode future reserved. Allows passing in function_kind |
| // for the case of parsing the identifier in a function expression, where the |
| @@ -1063,72 +1055,50 @@ class ParserBase { |
| ExpressionT ParseRegExpLiteral(bool* ok); |
| - ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, |
| - bool* is_async, bool* ok); |
| - ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, |
| - bool* ok) { |
| + ExpressionT ParsePrimaryExpression(bool* is_async, bool* ok); |
| + ExpressionT ParsePrimaryExpression(bool* ok) { |
| bool is_async; |
| - return ParsePrimaryExpression(classifier, &is_async, ok); |
| + return ParsePrimaryExpression(&is_async, ok); |
| } |
| ExpressionT ParseExpression(bool accept_IN, bool* ok); |
| - ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok); |
| + ExpressionT ParseExpressionNoWrap(bool accept_IN, bool* ok); |
| + ExpressionT ParseArrayLiteral(bool* ok); |
| ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set, |
| - bool* is_computed_name, |
| - ExpressionClassifier* classifier, bool* ok); |
| - ExpressionT ParseObjectLiteral(ExpressionClassifier* classifier, bool* ok); |
| + bool* is_computed_name, bool* ok); |
| + ExpressionT ParseObjectLiteral(bool* ok); |
| ObjectLiteralPropertyT ParsePropertyDefinition( |
| ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| MethodKind kind, bool* is_computed_name, bool* has_seen_constructor, |
| - ExpressionClassifier* classifier, IdentifierT* name, bool* ok); |
| + IdentifierT* name, bool* ok); |
| typename Types::ExpressionList ParseArguments( |
| - Scanner::Location* first_spread_pos, bool maybe_arrow, |
| - ExpressionClassifier* classifier, bool* ok); |
| + Scanner::Location* first_spread_pos, bool maybe_arrow, bool* ok); |
| typename Types::ExpressionList ParseArguments( |
| - Scanner::Location* first_spread_pos, ExpressionClassifier* classifier, |
| - bool* ok) { |
| - return ParseArguments(first_spread_pos, false, classifier, ok); |
| - } |
| - |
| - ExpressionT ParseAssignmentExpression(bool accept_IN, |
| - ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseYieldExpression(bool accept_IN, |
| - ExpressionClassifier* classifier, bool* ok); |
| - ExpressionT ParseTailCallExpression(ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseConditionalExpression(bool accept_IN, |
| - ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseBinaryExpression(int prec, bool accept_IN, |
| - ExpressionClassifier* classifier, bool* ok); |
| - ExpressionT ParseUnaryExpression(ExpressionClassifier* classifier, bool* ok); |
| - ExpressionT ParsePostfixExpression(ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| - bool* ok); |
| - ExpressionT ParseMemberWithNewPrefixesExpression( |
| - ExpressionClassifier* classifier, bool* is_async, bool* ok); |
| - ExpressionT ParseMemberExpression(ExpressionClassifier* classifier, |
| - bool* is_async, bool* ok); |
| - ExpressionT ParseMemberExpressionContinuation( |
| - ExpressionT expression, bool* is_async, ExpressionClassifier* classifier, |
| - bool* ok); |
| + Scanner::Location* first_spread_pos, bool* ok) { |
| + return ParseArguments(first_spread_pos, false, ok); |
| + } |
| + |
| + ExpressionT ParseAssignmentExpression(bool accept_IN, bool* ok); |
| + ExpressionT ParseYieldExpression(bool accept_IN, bool* ok); |
| + ExpressionT ParseTailCallExpression(bool* ok); |
| + ExpressionT ParseConditionalExpression(bool accept_IN, bool* ok); |
| + ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
| + ExpressionT ParseUnaryExpression(bool* ok); |
| + ExpressionT ParsePostfixExpression(bool* ok); |
| + ExpressionT ParseLeftHandSideExpression(bool* ok); |
| + ExpressionT ParseMemberWithNewPrefixesExpression(bool* is_async, bool* ok); |
| + ExpressionT ParseMemberExpression(bool* is_async, bool* ok); |
| + ExpressionT ParseMemberExpressionContinuation(ExpressionT expression, |
| + bool* is_async, bool* ok); |
| ExpressionT ParseArrowFunctionLiteral(bool accept_IN, |
| const FormalParametersT& parameters, |
| bool is_async, |
| - const ExpressionClassifier& classifier, |
| bool* ok); |
| - ExpressionT ParseTemplateLiteral(ExpressionT tag, int start, |
| - ExpressionClassifier* classifier, bool* ok); |
| + ExpressionT ParseTemplateLiteral(ExpressionT tag, int start, bool* ok); |
| ExpressionT ParseSuperExpression(bool is_new, bool* ok); |
| ExpressionT ParseNewTargetExpression(bool* ok); |
| - void ParseFormalParameter(FormalParametersT* parameters, |
| - ExpressionClassifier* classifier, bool* ok); |
| - void ParseFormalParameterList(FormalParametersT* parameters, |
| - ExpressionClassifier* classifier, bool* ok); |
| + void ParseFormalParameter(FormalParametersT* parameters, bool* ok); |
| + void ParseFormalParameterList(FormalParametersT* parameters, bool* ok); |
| void CheckArityRestrictions(int param_count, FunctionKind function_type, |
| bool has_rest, int formals_start_pos, |
| int formals_end_pos, bool* ok); |
| @@ -1191,8 +1161,7 @@ class ParserBase { |
| explicit ObjectLiteralCheckerBase(ParserBase* parser) : parser_(parser) {} |
| virtual void CheckProperty(Token::Value property, PropertyKind type, |
| - MethodKind method_type, |
| - ExpressionClassifier* classifier, bool* ok) = 0; |
| + MethodKind method_type, bool* ok) = 0; |
| virtual ~ObjectLiteralCheckerBase() {} |
| @@ -1211,8 +1180,7 @@ class ParserBase { |
| : ObjectLiteralCheckerBase(parser), has_seen_proto_(false) {} |
| void CheckProperty(Token::Value property, PropertyKind type, |
| - MethodKind method_type, ExpressionClassifier* classifier, |
| - bool* ok) override; |
| + MethodKind method_type, bool* ok) override; |
| private: |
| bool IsProto() { return this->scanner()->LiteralMatches("__proto__", 9); } |
| @@ -1227,8 +1195,7 @@ class ParserBase { |
| : ObjectLiteralCheckerBase(parser), has_seen_constructor_(false) {} |
| void CheckProperty(Token::Value property, PropertyKind type, |
| - MethodKind method_type, ExpressionClassifier* classifier, |
| - bool* ok) override; |
| + MethodKind method_type, bool* ok) override; |
| private: |
| bool IsConstructor() { |
| @@ -1246,6 +1213,74 @@ class ParserBase { |
| } |
| Scope* scope() const { return scope_state_->scope(); } |
| + // Stack of expression classifiers |
| + |
| + ExpressionClassifier* classifier() const { |
| + DCHECK_NOT_NULL(classifier_wrapper_); |
| + return classifier_wrapper_->classifier(); |
| + } |
| + |
| + void Accumulate(unsigned productions, bool merge_non_patterns = true) { |
| + DCHECK_NOT_NULL(classifier_wrapper_); |
| + ExpressionClassifierWrapper* previous_wrapper = |
| + classifier_wrapper_->previous(); |
| + DCHECK_NOT_NULL(previous_wrapper); |
| + if (previous_wrapper->is_accumulating()) { |
| + ExpressionClassifier* inner = classifier_wrapper_->classifier(); |
| + ExpressionClassifier* outer = previous_wrapper->classifier(); |
| + outer->Accumulate(inner, productions, merge_non_patterns); |
| + } |
| + classifier_wrapper_ = previous_wrapper; |
| + } |
| + |
| + void Discard() { |
| + DCHECK_NOT_NULL(classifier_wrapper_); |
| + classifier_wrapper_->classifier()->Discard(); |
| + classifier_wrapper_ = classifier_wrapper_->previous(); |
| + } |
| + |
| + // Accumulate errors that can be arbitrarily deep in an expression. |
| + // These correspond to the ECMAScript spec's 'Contains' operation |
| + // on productions. This includes: |
| + // |
| + // - YieldExpression is disallowed in arrow parameters in a generator. |
| + // - AwaitExpression is disallowed in arrow parameters in an async function. |
| + // - AwaitExpression is disallowed in async arrow parameters. |
| + // |
| + V8_INLINE void AccumulateFormalParameterContainmentErrors() { |
| + Accumulate(ExpressionClassifier::FormalParameterInitializerProduction | |
| + ExpressionClassifier::AsyncArrowFormalParametersProduction); |
| + } |
| + |
| + // TODO(nikolaos): This looks horrible, let's see about it... |
|
nickie
2016/08/29 10:34:37
Well, maybe it's not so bad after all, especially
|
| + class ExpressionClassifierWrapper { |
| + public: |
| + explicit ExpressionClassifierWrapper( |
| + ParserBase<Impl>* base, DuplicateFinder* duplicate_finder = nullptr, |
| + bool accumulating = true) |
| + : base_(base), |
| + classifier_(base, duplicate_finder), |
| + previous_(base->classifier_wrapper_), |
| + accumulating_(accumulating) { |
| + base->classifier_wrapper_ = this; |
| + } |
| + ~ExpressionClassifierWrapper() { |
| + if (base_->classifier_wrapper_ == this) |
| + base_->classifier_wrapper_ = previous_; |
| + } |
| + ExpressionClassifier* classifier() { return &classifier_; } |
| + ExpressionClassifierWrapper* previous() { return previous_; } |
| + bool is_accumulating() const { return accumulating_; } |
| + |
| + private: |
| + ParserBase<Impl>* base_; |
| + ExpressionClassifier classifier_; |
| + ExpressionClassifierWrapper* previous_; |
| + bool accumulating_; |
|
nickie
2016/08/29 10:34:37
This is needed just for the case of class declarat
|
| + }; |
| + |
| + // Parser base's protected field members. |
| + |
| ScopeState* scope_state_; // Scope stack. |
| FunctionState* function_state_; // Function state stack. |
| v8::Extension* extension_; |
| @@ -1257,8 +1292,11 @@ class ParserBase { |
| bool parsing_module_; |
| uintptr_t stack_limit_; |
| + // Parser base's private field members. |
| + |
| private: |
| Zone* zone_; |
| + ExpressionClassifierWrapper* classifier_wrapper_; |
| Scanner* scanner_; |
| bool stack_overflow_; |
| @@ -1384,13 +1422,12 @@ void ParserBase<Impl>::ReportUnexpectedTokenAt( |
| template <typename Impl> |
| typename ParserBase<Impl>::IdentifierT ParserBase<Impl>::ParseIdentifier( |
| AllowRestrictedIdentifiers allow_restricted_identifiers, bool* ok) { |
| - ExpressionClassifier classifier(this); |
| - auto result = |
| - ParseAndClassifyIdentifier(&classifier, CHECK_OK_CUSTOM(EmptyIdentifier)); |
| + ExpressionClassifierWrapper wrap_classifier(this); |
| + auto result = ParseAndClassifyIdentifier(CHECK_OK_CUSTOM(EmptyIdentifier)); |
| if (allow_restricted_identifiers == kDontAllowRestrictedIdentifiers) { |
| - ValidateAssignmentPattern(&classifier, CHECK_OK_CUSTOM(EmptyIdentifier)); |
| - ValidateBindingPattern(&classifier, CHECK_OK_CUSTOM(EmptyIdentifier)); |
| + ValidateAssignmentPattern(CHECK_OK_CUSTOM(EmptyIdentifier)); |
| + ValidateBindingPattern(CHECK_OK_CUSTOM(EmptyIdentifier)); |
| } |
| return result; |
| @@ -1398,8 +1435,7 @@ typename ParserBase<Impl>::IdentifierT ParserBase<Impl>::ParseIdentifier( |
| template <typename Impl> |
| typename ParserBase<Impl>::IdentifierT |
| -ParserBase<Impl>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| - bool* ok) { |
| +ParserBase<Impl>::ParseAndClassifyIdentifier(bool* ok) { |
| Token::Value next = Next(); |
| if (next == Token::IDENTIFIER || next == Token::ASYNC || |
| (next == Token::AWAIT && !parsing_module_ && !is_async_function())) { |
| @@ -1411,20 +1447,20 @@ ParserBase<Impl>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| // must detect because we know we're in strict mode, we also record any |
| // error that we might make in the future once we know the language mode. |
| if (impl()->IsEvalOrArguments(name)) { |
| - classifier->RecordStrictModeFormalParameterError( |
| + classifier()->RecordStrictModeFormalParameterError( |
| scanner()->location(), MessageTemplate::kStrictEvalArguments); |
| if (is_strict(language_mode())) { |
| - classifier->RecordBindingPatternError( |
| + classifier()->RecordBindingPatternError( |
| scanner()->location(), MessageTemplate::kStrictEvalArguments); |
| } |
| } else if (next == Token::AWAIT) { |
| - classifier->RecordAsyncArrowFormalParametersError( |
| + classifier()->RecordAsyncArrowFormalParametersError( |
| scanner()->location(), MessageTemplate::kAwaitBindingIdentifier); |
| } |
| - if (classifier->duplicate_finder() != nullptr && |
| - scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { |
| - classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
| + if (classifier()->duplicate_finder() != nullptr && |
| + scanner()->FindSymbol(classifier()->duplicate_finder(), 1) != 0) { |
| + classifier()->RecordDuplicateFormalParameterError(scanner()->location()); |
| } |
| return name; |
| } else if (is_sloppy(language_mode()) && |
| @@ -1432,7 +1468,7 @@ ParserBase<Impl>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| next == Token::ESCAPED_STRICT_RESERVED_WORD || |
| next == Token::LET || next == Token::STATIC || |
| (next == Token::YIELD && !is_generator()))) { |
| - classifier->RecordStrictModeFormalParameterError( |
| + classifier()->RecordStrictModeFormalParameterError( |
| scanner()->location(), MessageTemplate::kUnexpectedStrictReserved); |
| if (next == Token::ESCAPED_STRICT_RESERVED_WORD && |
| is_strict(language_mode())) { |
| @@ -1443,8 +1479,8 @@ ParserBase<Impl>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| if (next == Token::LET || |
| (next == Token::ESCAPED_STRICT_RESERVED_WORD && |
| scanner()->is_literal_contextual_keyword(CStrVector("let")))) { |
| - classifier->RecordLetPatternError(scanner()->location(), |
| - MessageTemplate::kLetInLexicalBinding); |
| + classifier()->RecordLetPatternError( |
| + scanner()->location(), MessageTemplate::kLetInLexicalBinding); |
| } |
| return impl()->GetSymbol(); |
| } else { |
| @@ -1522,7 +1558,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseRegExpLiteral( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| - ExpressionClassifier* classifier, bool* is_async, bool* ok) { |
| + bool* is_async, bool* ok) { |
| // PrimaryExpression :: |
| // 'this' |
| // 'null' |
| @@ -1543,7 +1579,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| int beg_pos = peek_position(); |
| switch (peek()) { |
| case Token::THIS: { |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| Consume(Token::THIS); |
| return impl()->ThisExpression(beg_pos); |
| } |
| @@ -1553,7 +1589,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| case Token::FALSE_LITERAL: |
| case Token::SMI: |
| case Token::NUMBER: |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| return impl()->ExpressionFromLiteral(Next(), beg_pos); |
| case Token::ASYNC: |
| @@ -1574,28 +1610,28 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| case Token::ESCAPED_STRICT_RESERVED_WORD: |
| case Token::FUTURE_STRICT_RESERVED_WORD: { |
| // Using eval or arguments in this context is OK even in strict mode. |
| - IdentifierT name = ParseAndClassifyIdentifier(classifier, CHECK_OK); |
| + IdentifierT name = ParseAndClassifyIdentifier(CHECK_OK); |
| return impl()->ExpressionFromIdentifier(name, beg_pos, |
| scanner()->location().end_pos); |
| } |
| case Token::STRING: { |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| Consume(Token::STRING); |
| return impl()->ExpressionFromString(beg_pos); |
| } |
| case Token::ASSIGN_DIV: |
| case Token::DIV: |
| - classifier->RecordBindingPatternError( |
| + classifier()->RecordBindingPatternError( |
| scanner()->peek_location(), MessageTemplate::kUnexpectedTokenRegExp); |
| return ParseRegExpLiteral(ok); |
| case Token::LBRACK: |
| - return ParseArrayLiteral(classifier, ok); |
| + return ParseArrayLiteral(ok); |
| case Token::LBRACE: |
| - return ParseObjectLiteral(classifier, ok); |
| + return ParseObjectLiteral(ok); |
| case Token::LPAREN: { |
| // Arrow function formal parameters are either a single identifier or a |
| @@ -1603,41 +1639,39 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| // Parentheses are not valid on the LHS of a BindingPattern, so we use the |
| // is_valid_binding_pattern() check to detect multiple levels of |
| // parenthesization. |
| - bool pattern_error = !classifier->is_valid_binding_pattern(); |
| - classifier->RecordPatternError(scanner()->peek_location(), |
| - MessageTemplate::kUnexpectedToken, |
| - Token::String(Token::LPAREN)); |
| - if (pattern_error) ArrowFormalParametersUnexpectedToken(classifier); |
| + bool pattern_error = !classifier()->is_valid_binding_pattern(); |
| + classifier()->RecordPatternError(scanner()->peek_location(), |
| + MessageTemplate::kUnexpectedToken, |
| + Token::String(Token::LPAREN)); |
| + if (pattern_error) ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::LPAREN); |
| if (Check(Token::RPAREN)) { |
| // ()=>x. The continuation that looks for the => is in |
| // ParseAssignmentExpression. |
| - classifier->RecordExpressionError(scanner()->location(), |
| - MessageTemplate::kUnexpectedToken, |
| - Token::String(Token::RPAREN)); |
| + classifier()->RecordExpressionError(scanner()->location(), |
| + MessageTemplate::kUnexpectedToken, |
| + Token::String(Token::RPAREN)); |
| return factory()->NewEmptyParentheses(beg_pos); |
| } else if (Check(Token::ELLIPSIS)) { |
| // (...x)=>x. The continuation that looks for the => is in |
| // ParseAssignmentExpression. |
| int ellipsis_pos = position(); |
| int expr_pos = peek_position(); |
| - classifier->RecordExpressionError(scanner()->location(), |
| - MessageTemplate::kUnexpectedToken, |
| - Token::String(Token::ELLIPSIS)); |
| - classifier->RecordNonSimpleParameter(); |
| - ExpressionClassifier binding_classifier(this); |
| + classifier()->RecordExpressionError(scanner()->location(), |
| + MessageTemplate::kUnexpectedToken, |
| + Token::String(Token::ELLIPSIS)); |
| + classifier()->RecordNonSimpleParameter(); |
| + ExpressionClassifierWrapper wrap_binding_classifier(this); |
| // TODO(adamk): The grammar for this is |
| // BindingIdentifier | BindingPattern, so |
| // ParseAssignmentExpression is overkill. |
| - ExpressionT expr = |
| - ParseAssignmentExpression(true, &binding_classifier, CHECK_OK); |
| + ExpressionT expr = ParseAssignmentExpression(true, CHECK_OK); |
| // This already couldn't be an expression or a pattern, so the |
| // only remaining possibility is an arrow formal parameter list. |
| - classifier->Accumulate( |
| - &binding_classifier, |
| + impl()->Accumulate( |
| ExpressionClassifier::ArrowFormalParametersProduction); |
| if (!impl()->IsIdentifier(expr) && !IsValidPattern(expr)) { |
| - classifier->RecordArrowFormalParametersError( |
| + classifier()->RecordArrowFormalParametersError( |
| Scanner::Location(ellipsis_pos, scanner()->location().end_pos), |
| MessageTemplate::kInvalidRestParameter); |
| } |
| @@ -1654,13 +1688,13 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| // seeing the call parentheses. |
| function_state_->set_next_function_is_parenthesized(peek() == |
| Token::FUNCTION); |
| - ExpressionT expr = ParseExpression(true, classifier, CHECK_OK); |
| + ExpressionT expr = ParseExpressionNoWrap(true, CHECK_OK); |
| Expect(Token::RPAREN, CHECK_OK); |
| return expr; |
| } |
| case Token::CLASS: { |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| Consume(Token::CLASS); |
| int class_token_position = position(); |
| IdentifierT name = impl()->EmptyIdentifier(); |
| @@ -1671,27 +1705,26 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| CHECK_OK); |
| class_name_location = scanner()->location(); |
| } |
| - return impl()->ParseClassLiteral(classifier, name, class_name_location, |
| + return impl()->ParseClassLiteral(name, class_name_location, |
| is_strict_reserved_name, |
| class_token_position, ok); |
| } |
| case Token::TEMPLATE_SPAN: |
| case Token::TEMPLATE_TAIL: |
| - BindingPatternUnexpectedToken(classifier); |
| - return ParseTemplateLiteral(impl()->NoTemplateTag(), beg_pos, classifier, |
| - ok); |
| + BindingPatternUnexpectedToken(); |
| + return ParseTemplateLiteral(impl()->NoTemplateTag(), beg_pos, ok); |
| case Token::MOD: |
| if (allow_natives() || extension_ != NULL) { |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| return impl()->ParseV8Intrinsic(ok); |
| } |
| break; |
| case Token::DO: |
| if (allow_harmony_do_expressions()) { |
| - BindingPatternUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| return impl()->ParseDoExpression(ok); |
| } |
| break; |
| @@ -1708,15 +1741,15 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| bool accept_IN, bool* ok) { |
| - ExpressionClassifier classifier(this); |
| - ExpressionT result = ParseExpression(accept_IN, &classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(&classifier, CHECK_OK); |
| + ExpressionClassifierWrapper wrap_classifier(this); |
| + ExpressionT result = ParseExpressionNoWrap(accept_IN, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| return result; |
| } |
| template <typename Impl> |
| -typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| - bool accept_IN, ExpressionClassifier* classifier, bool* ok) { |
| +typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpressionNoWrap( |
| + bool accept_IN, bool* ok) { |
| // Expression :: |
| // AssignmentExpression |
| // Expression ',' AssignmentExpression |
| @@ -1730,19 +1763,18 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| ~(ExpressionClassifier::BindingPatternProduction | |
| ExpressionClassifier::LetPatternProduction); |
| { |
| - ExpressionClassifier binding_classifier(this); |
| - result = |
| - ParseAssignmentExpression(accept_IN, &binding_classifier, CHECK_OK); |
| - classifier->Accumulate(&binding_classifier, kExpressionProductions); |
| + ExpressionClassifierWrapper wrap_binding_classifier(this); |
| + result = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + impl()->Accumulate(kExpressionProductions); |
| } |
| bool is_simple_parameter_list = impl()->IsIdentifier(result); |
| bool seen_rest = false; |
| while (peek() == Token::COMMA) { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| if (seen_rest) { |
| // At this point the production can't possibly be valid, but we don't know |
| // which error to signal. |
| - classifier->RecordArrowFormalParametersError( |
| + classifier()->RecordArrowFormalParametersError( |
| scanner()->peek_location(), MessageTemplate::kParamAfterRest); |
| } |
| Consume(Token::COMMA); |
| @@ -1755,21 +1787,20 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| // 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only |
| // as the formal parameters of'(x, y, ...z) => foo', and is not itself a |
| // valid expression or binding pattern. |
| - ExpressionUnexpectedToken(classifier); |
| - BindingPatternUnexpectedToken(classifier); |
| + ExpressionUnexpectedToken(); |
| + BindingPatternUnexpectedToken(); |
| Consume(Token::ELLIPSIS); |
| // TODO(adamk): If is_rest is true we don't need to parse an assignment |
| // expression, the grammar is BindingIdentifier | BindingPattern. |
| seen_rest = is_rest = true; |
| } |
| int pos = position(), expr_pos = peek_position(); |
| - ExpressionClassifier binding_classifier(this); |
| - ExpressionT right = |
| - ParseAssignmentExpression(accept_IN, &binding_classifier, CHECK_OK); |
| - classifier->Accumulate(&binding_classifier, kExpressionProductions); |
| + ExpressionClassifierWrapper wrap_binding_classifier(this); |
| + ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + impl()->Accumulate(kExpressionProductions); |
| if (is_rest) { |
| if (!impl()->IsIdentifier(right) && !IsValidPattern(right)) { |
| - classifier->RecordArrowFormalParametersError( |
| + classifier()->RecordArrowFormalParametersError( |
| Scanner::Location(pos, scanner()->location().end_pos), |
| MessageTemplate::kInvalidRestParameter); |
| } |
| @@ -1780,7 +1811,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| result = factory()->NewBinaryOperation(Token::COMMA, result, right, pos); |
| } |
| if (!is_simple_parameter_list || seen_rest) { |
| - classifier->RecordNonSimpleParameter(); |
| + classifier()->RecordNonSimpleParameter(); |
| } |
| return result; |
| @@ -1788,7 +1819,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral( |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| // ArrayLiteral :: |
| // '[' Expression? (',' Expression?)* ']' |
| @@ -1804,9 +1835,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral( |
| int start_pos = peek_position(); |
| Consume(Token::ELLIPSIS); |
| int expr_pos = peek_position(); |
| - ExpressionT argument = |
| - ParseAssignmentExpression(true, classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + ExpressionT argument = ParseAssignmentExpression(true, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| elem = factory()->NewSpread(argument, start_pos, expr_pos); |
| if (first_spread_index < 0) { |
| @@ -1814,25 +1844,24 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral( |
| } |
| if (argument->IsAssignment()) { |
| - classifier->RecordPatternError( |
| + classifier()->RecordPatternError( |
| Scanner::Location(start_pos, scanner()->location().end_pos), |
| MessageTemplate::kInvalidDestructuringTarget); |
| } else { |
| - CheckDestructuringElement(argument, classifier, start_pos, |
| + CheckDestructuringElement(argument, start_pos, |
| scanner()->location().end_pos); |
| } |
| if (peek() == Token::COMMA) { |
| - classifier->RecordPatternError( |
| + classifier()->RecordPatternError( |
| Scanner::Location(start_pos, scanner()->location().end_pos), |
| MessageTemplate::kElementAfterRest); |
| } |
| } else { |
| int beg_pos = peek_position(); |
| - elem = ParseAssignmentExpression(true, classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - CheckDestructuringElement(elem, classifier, beg_pos, |
| - scanner()->location().end_pos); |
| + elem = ParseAssignmentExpression(true, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + CheckDestructuringElement(elem, beg_pos, scanner()->location().end_pos); |
| } |
| values->Add(elem, zone_); |
| if (peek() != Token::RBRACK) { |
| @@ -1864,7 +1893,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral( |
| template <class Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName( |
| IdentifierT* name, bool* is_get, bool* is_set, bool* is_computed_name, |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| Token::Value token = peek(); |
| int pos = peek_position(); |
| @@ -1896,12 +1925,10 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName( |
| case Token::LBRACK: { |
| *is_computed_name = true; |
| Consume(Token::LBRACK); |
| - ExpressionClassifier computed_name_classifier(this); |
| - ExpressionT expression = |
| - ParseAssignmentExpression(true, &computed_name_classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(&computed_name_classifier, CHECK_OK); |
| - classifier->AccumulateFormalParameterContainmentErrors( |
| - &computed_name_classifier); |
| + ExpressionClassifierWrapper wrap_computed_name_classifier(this); |
| + ExpressionT expression = ParseAssignmentExpression(true, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + impl()->AccumulateFormalParameterContainmentErrors(); |
| Expect(Token::RBRACK, CHECK_OK); |
| return expression; |
| } |
| @@ -1920,10 +1947,12 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName( |
| template <typename Impl> |
| typename ParserBase<Impl>::ObjectLiteralPropertyT |
| -ParserBase<Impl>::ParsePropertyDefinition( |
| - ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| - MethodKind method_kind, bool* is_computed_name, bool* has_seen_constructor, |
| - ExpressionClassifier* classifier, IdentifierT* name, bool* ok) { |
| +ParserBase<Impl>::ParsePropertyDefinition(ObjectLiteralCheckerBase* checker, |
| + bool in_class, bool has_extends, |
| + MethodKind method_kind, |
| + bool* is_computed_name, |
| + bool* has_seen_constructor, |
| + IdentifierT* name, bool* ok) { |
| DCHECK(!in_class || IsStaticMethod(method_kind) || |
| has_seen_constructor != nullptr); |
| bool is_get = false; |
| @@ -1945,7 +1974,7 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| int next_beg_pos = scanner()->peek_location().beg_pos; |
| int next_end_pos = scanner()->peek_location().end_pos; |
| ExpressionT name_expression = |
| - ParsePropertyName(name, &is_get, &is_set, is_computed_name, classifier, |
| + ParsePropertyName(name, &is_get, &is_set, is_computed_name, |
| CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| if (fni_ != nullptr && !*is_computed_name) { |
| @@ -1959,15 +1988,13 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| // PropertyName ':' AssignmentExpression |
| if (!*is_computed_name) { |
| checker->CheckProperty(name_token, kValueProperty, MethodKind::kNormal, |
| - classifier, |
| CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| } |
| Consume(Token::COLON); |
| int beg_pos = peek_position(); |
| ExpressionT value = ParseAssignmentExpression( |
| - true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| - CheckDestructuringElement(value, classifier, beg_pos, |
| - scanner()->location().end_pos); |
| + true, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| + CheckDestructuringElement(value, beg_pos, scanner()->location().end_pos); |
| return factory()->NewObjectLiteralProperty(name_expression, value, |
| is_static, *is_computed_name); |
| @@ -1983,42 +2010,42 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| // |
| // CoverInitializedName |
| // IdentifierReference Initializer? |
| - if (classifier->duplicate_finder() != nullptr && |
| - scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { |
| - classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
| + if (classifier()->duplicate_finder() != nullptr && |
| + scanner()->FindSymbol(classifier()->duplicate_finder(), 1) != 0) { |
| + classifier()->RecordDuplicateFormalParameterError( |
| + scanner()->location()); |
| } |
| if (impl()->IsEvalOrArguments(*name) && is_strict(language_mode())) { |
| - classifier->RecordBindingPatternError( |
| + classifier()->RecordBindingPatternError( |
| scanner()->location(), MessageTemplate::kStrictEvalArguments); |
| } |
| if (name_token == Token::LET) { |
| - classifier->RecordLetPatternError( |
| + classifier()->RecordLetPatternError( |
| scanner()->location(), MessageTemplate::kLetInLexicalBinding); |
| } |
| if (name_token == Token::AWAIT) { |
| DCHECK(!is_async_function()); |
| - classifier->RecordAsyncArrowFormalParametersError( |
| + classifier()->RecordAsyncArrowFormalParametersError( |
| Scanner::Location(next_beg_pos, next_end_pos), |
| MessageTemplate::kAwaitBindingIdentifier); |
| } |
| ExpressionT lhs = |
| impl()->ExpressionFromIdentifier(*name, next_beg_pos, next_end_pos); |
| - CheckDestructuringElement(lhs, classifier, next_beg_pos, next_end_pos); |
| + CheckDestructuringElement(lhs, next_beg_pos, next_end_pos); |
| ExpressionT value; |
| if (peek() == Token::ASSIGN) { |
| Consume(Token::ASSIGN); |
| - ExpressionClassifier rhs_classifier(this); |
| + ExpressionClassifierWrapper wrap_rhs_classifier(this); |
| ExpressionT rhs = ParseAssignmentExpression( |
| - true, &rhs_classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| - impl()->RewriteNonPattern(&rhs_classifier, |
| - CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| - classifier->AccumulateFormalParameterContainmentErrors(&rhs_classifier); |
| + true, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| + impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| + impl()->AccumulateFormalParameterContainmentErrors(); |
| value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs, |
| kNoSourcePosition); |
| - classifier->RecordExpressionError( |
| + classifier()->RecordExpressionError( |
| Scanner::Location(next_beg_pos, scanner()->location().end_pos), |
| MessageTemplate::kInvalidCoverInitializedName); |
| @@ -2034,7 +2061,7 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| } |
| // Method definitions are never valid in patterns. |
| - classifier->RecordPatternError( |
| + classifier()->RecordPatternError( |
| Scanner::Location(next_beg_pos, scanner()->location().end_pos), |
| MessageTemplate::kInvalidDestructuringTarget); |
| @@ -2042,9 +2069,9 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| DCHECK(!is_get); |
| DCHECK(!is_set); |
| bool dont_care; |
| - name_expression = ParsePropertyName( |
| - name, &dont_care, &dont_care, is_computed_name, classifier, |
| - CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| + name_expression = |
| + ParsePropertyName(name, &dont_care, &dont_care, is_computed_name, |
| + CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| method_kind |= MethodKind::kAsync; |
| } |
| @@ -2054,7 +2081,6 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| // '*' PropertyName '(' StrictFormalParameters ')' '{' FunctionBody '}' |
| if (!*is_computed_name) { |
| checker->CheckProperty(name_token, kMethodProperty, method_kind, |
| - classifier, |
| CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| } |
| @@ -2084,10 +2110,10 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| // ClassElement (static) |
| // 'static' MethodDefinition |
| *name = impl()->EmptyIdentifier(); |
| - ObjectLiteralPropertyT property = ParsePropertyDefinition( |
| - checker, true, has_extends, MethodKind::kStatic, is_computed_name, |
| - nullptr, classifier, name, ok); |
| - impl()->RewriteNonPattern(classifier, ok); |
| + ObjectLiteralPropertyT property = |
| + ParsePropertyDefinition(checker, true, has_extends, MethodKind::kStatic, |
| + is_computed_name, nullptr, name, ok); |
| + impl()->RewriteNonPattern(ok); |
| return property; |
| } |
| @@ -2099,13 +2125,12 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| bool dont_care = false; |
| name_token = peek(); |
| - name_expression = ParsePropertyName( |
| - name, &dont_care, &dont_care, is_computed_name, classifier, |
| - CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| + name_expression = |
| + ParsePropertyName(name, &dont_care, &dont_care, is_computed_name, |
| + CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| if (!*is_computed_name) { |
| checker->CheckProperty(name_token, kAccessorProperty, method_kind, |
| - classifier, |
| CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| } |
| @@ -2137,7 +2162,7 @@ ParserBase<Impl>::ParsePropertyDefinition( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral( |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| // ObjectLiteral :: |
| // '{' (PropertyDefinition (',' PropertyDefinition)* ','? )? '}' |
| @@ -2158,7 +2183,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral( |
| IdentifierT name = impl()->EmptyIdentifier(); |
| ObjectLiteralPropertyT property = ParsePropertyDefinition( |
| &checker, in_class, has_extends, MethodKind::kNormal, &is_computed_name, |
| - NULL, classifier, &name, CHECK_OK); |
| + NULL, &name, CHECK_OK); |
| if (is_computed_name) { |
| has_computed_names = true; |
| @@ -2193,8 +2218,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral( |
| template <typename Impl> |
| typename ParserBase<Impl>::Types::ExpressionList |
| ParserBase<Impl>::ParseArguments(Scanner::Location* first_spread_arg_loc, |
| - bool maybe_arrow, |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool maybe_arrow, bool* ok) { |
| // Arguments :: |
| // '(' (AssignmentExpression)*[','] ')' |
| @@ -2209,12 +2233,11 @@ ParserBase<Impl>::ParseArguments(Scanner::Location* first_spread_arg_loc, |
| bool is_spread = Check(Token::ELLIPSIS); |
| int expr_pos = peek_position(); |
| - ExpressionT argument = ParseAssignmentExpression( |
| - true, classifier, CHECK_OK_CUSTOM(NullExpressionList)); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK_CUSTOM(NullExpressionList)); |
| + ExpressionT argument = |
| + ParseAssignmentExpression(true, CHECK_OK_CUSTOM(NullExpressionList)); |
| + CheckNoTailCallExpressions(CHECK_OK_CUSTOM(NullExpressionList)); |
| if (!maybe_arrow) { |
| - impl()->RewriteNonPattern(classifier, |
| - CHECK_OK_CUSTOM(NullExpressionList)); |
| + impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList)); |
| } |
| if (is_spread) { |
| if (!spread_arg.IsValid()) { |
| @@ -2258,8 +2281,7 @@ ParserBase<Impl>::ParseArguments(Scanner::Location* first_spread_arg_loc, |
| if (!maybe_arrow || peek() != Token::ARROW) { |
| if (maybe_arrow) { |
| - impl()->RewriteNonPattern(classifier, |
| - CHECK_OK_CUSTOM(NullExpressionList)); |
| + impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList)); |
| } |
| if (spread_arg.IsValid()) { |
| // Unspread parameter sequences are translated into array literals in the |
| @@ -2275,9 +2297,7 @@ ParserBase<Impl>::ParseArguments(Scanner::Location* first_spread_arg_loc, |
| // Precedence = 2 |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| -ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| - ExpressionClassifier* classifier, |
| - bool* ok) { |
| +ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) { |
| // AssignmentExpression :: |
| // ConditionalExpression |
| // ArrowFunction |
| @@ -2286,13 +2306,13 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| int lhs_beg_pos = peek_position(); |
| if (peek() == Token::YIELD && is_generator()) { |
| - return ParseYieldExpression(accept_IN, classifier, ok); |
| + return ParseYieldExpression(accept_IN, ok); |
| } |
| FuncNameInferrer::State fni_state(fni_); |
| Checkpoint checkpoint(this); |
| - ExpressionClassifier arrow_formals_classifier(this, |
| - classifier->duplicate_finder()); |
| + ExpressionClassifierWrapper wrap_arrow_formals_classifier( |
| + this, classifier()->duplicate_finder()); |
| Scope::Snapshot scope_snapshot(scope()); |
| @@ -2302,25 +2322,22 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| bool parenthesized_formals = peek() == Token::LPAREN; |
| if (!is_async && !parenthesized_formals) { |
| - ArrowFormalParametersUnexpectedToken(&arrow_formals_classifier); |
| + ArrowFormalParametersUnexpectedToken(); |
| } |
| // Parse a simple, faster sub-grammar (primary expression) if it's evident |
| // that we have only a trivial expression to parse. |
| ExpressionT expression; |
| if (IsTrivialExpression()) { |
| - expression = |
| - ParsePrimaryExpression(&arrow_formals_classifier, &is_async, CHECK_OK); |
| + expression = ParsePrimaryExpression(&is_async, CHECK_OK); |
| } else { |
| - expression = ParseConditionalExpression( |
| - accept_IN, &arrow_formals_classifier, CHECK_OK); |
| + expression = ParseConditionalExpression(accept_IN, CHECK_OK); |
| } |
| if (is_async && impl()->IsIdentifier(expression) && peek_any_identifier() && |
| PeekAhead() == Token::ARROW) { |
| // async Identifier => AsyncConciseBody |
| - IdentifierT name = |
| - ParseAndClassifyIdentifier(&arrow_formals_classifier, CHECK_OK); |
| + IdentifierT name = ParseAndClassifyIdentifier(CHECK_OK); |
| expression = impl()->ExpressionFromIdentifier( |
| name, position(), scanner()->location().end_pos, InferName::kNo); |
| if (fni_) { |
| @@ -2331,15 +2348,15 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| if (peek() == Token::ARROW) { |
| Scanner::Location arrow_loc = scanner()->peek_location(); |
| - ValidateArrowFormalParameters(&arrow_formals_classifier, expression, |
| - parenthesized_formals, is_async, CHECK_OK); |
| + ValidateArrowFormalParameters(expression, parenthesized_formals, is_async, |
| + CHECK_OK); |
| // This reads strangely, but is correct: it checks whether any |
| // sub-expression of the parameter list failed to be a valid formal |
| // parameter initializer. Since YieldExpressions are banned anywhere |
| // in an arrow parameter list, this is correct. |
| // TODO(adamk): Rename "FormalParameterInitializerError" to refer to |
| // "YieldExpression", which is its only use. |
| - ValidateFormalParameterInitializer(&arrow_formals_classifier, ok); |
| + ValidateFormalParameterInitializer(ok); |
| Scanner::Location loc(lhs_beg_pos, scanner()->location().end_pos); |
| DeclarationScope* scope = |
| @@ -2350,7 +2367,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| // to the arrow scope. |
| this->scope()->PropagateUsageFlagsToScope(scope); |
| FormalParametersT parameters(scope); |
| - if (!arrow_formals_classifier.is_simple_parameter_list()) { |
| + if (!classifier()->is_simple_parameter_list()) { |
| scope->SetHasNonSimpleParameters(); |
| parameters.is_simple = false; |
| } |
| @@ -2362,15 +2379,14 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| impl()->ParseArrowFunctionFormalParameterList( |
| ¶meters, expression, loc, &duplicate_loc, scope_snapshot, CHECK_OK); |
| if (duplicate_loc.IsValid()) { |
| - arrow_formals_classifier.RecordDuplicateFormalParameterError( |
| - duplicate_loc); |
| + classifier()->RecordDuplicateFormalParameterError(duplicate_loc); |
| } |
| - expression = ParseArrowFunctionLiteral(accept_IN, parameters, is_async, |
| - arrow_formals_classifier, CHECK_OK); |
| - arrow_formals_classifier.Discard(); |
| - classifier->RecordPatternError(arrow_loc, |
| - MessageTemplate::kUnexpectedToken, |
| - Token::String(Token::ARROW)); |
| + expression = |
| + ParseArrowFunctionLiteral(accept_IN, parameters, is_async, CHECK_OK); |
| + impl()->Discard(); |
| + classifier()->RecordPatternError(arrow_loc, |
| + MessageTemplate::kUnexpectedToken, |
| + Token::String(Token::ARROW)); |
| if (fni_ != nullptr) fni_->Infer(); |
| @@ -2404,17 +2420,17 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| if (!Token::IsAssignmentOp(peek())) { |
| // Parsed conditional expression only (no assignment). |
| // Pending non-pattern expressions must be merged. |
| - classifier->Accumulate(&arrow_formals_classifier, productions); |
| + impl()->Accumulate(productions); |
| return expression; |
| } else { |
| // Pending non-pattern expressions must be discarded. |
| - classifier->Accumulate(&arrow_formals_classifier, productions, false); |
| + impl()->Accumulate(productions, false); |
| } |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| if (is_destructuring_assignment) { |
| - ValidateAssignmentPattern(classifier, CHECK_OK); |
| + ValidateAssignmentPattern(CHECK_OK); |
| } else { |
| expression = CheckAndRewriteReferenceExpression( |
| expression, lhs_beg_pos, scanner()->location().end_pos, |
| @@ -2425,19 +2441,18 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| Token::Value op = Next(); // Get assignment operator. |
| if (op != Token::ASSIGN) { |
| - classifier->RecordPatternError(scanner()->location(), |
| - MessageTemplate::kUnexpectedToken, |
| - Token::String(op)); |
| + classifier()->RecordPatternError(scanner()->location(), |
| + MessageTemplate::kUnexpectedToken, |
| + Token::String(op)); |
| } |
| int pos = position(); |
| - ExpressionClassifier rhs_classifier(this); |
| + ExpressionClassifierWrapper wrap_rhs_classifier(this); |
| - ExpressionT right = |
| - ParseAssignmentExpression(accept_IN, &rhs_classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(&rhs_classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(&rhs_classifier, CHECK_OK); |
| - classifier->AccumulateFormalParameterContainmentErrors(&rhs_classifier); |
| + ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + impl()->AccumulateFormalParameterContainmentErrors(); |
| // TODO(1231235): We try to estimate the set of properties set by |
| // constructors. We define a new property whenever there is an |
| @@ -2483,13 +2498,13 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseYieldExpression( |
| - bool accept_IN, ExpressionClassifier* classifier, bool* ok) { |
| + bool accept_IN, bool* ok) { |
| // YieldExpression :: |
| // 'yield' ([no line terminator] '*'? AssignmentExpression)? |
| int pos = peek_position(); |
| - classifier->RecordPatternError(scanner()->peek_location(), |
| - MessageTemplate::kInvalidDestructuringTarget); |
| - classifier->RecordFormalParameterInitializerError( |
| + classifier()->RecordPatternError( |
| + scanner()->peek_location(), MessageTemplate::kInvalidDestructuringTarget); |
| + classifier()->RecordFormalParameterInitializerError( |
| scanner()->peek_location(), MessageTemplate::kYieldInParameter); |
| Expect(Token::YIELD, CHECK_OK); |
| ExpressionT generator_object = |
| @@ -2514,8 +2529,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseYieldExpression( |
| if (!delegating) break; |
| // Delegating yields require an RHS; fall through. |
| default: |
| - expression = ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + expression = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| break; |
| } |
| } |
| @@ -2534,8 +2549,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseYieldExpression( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| -ParserBase<Impl>::ParseTailCallExpression(ExpressionClassifier* classifier, |
| - bool* ok) { |
| +ParserBase<Impl>::ParseTailCallExpression(bool* ok) { |
| // TailCallExpression:: |
| // 'continue' MemberExpression Arguments |
| // 'continue' CallExpression Arguments |
| @@ -2544,8 +2558,8 @@ ParserBase<Impl>::ParseTailCallExpression(ExpressionClassifier* classifier, |
| Expect(Token::CONTINUE, CHECK_OK); |
| int pos = position(); |
| int sub_expression_pos = peek_position(); |
| - ExpressionT expression = ParseLeftHandSideExpression(classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + ExpressionT expression = ParseLeftHandSideExpression(CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| Scanner::Location loc(pos, scanner()->location().end_pos); |
| if (!expression->IsCall()) { |
| @@ -2589,7 +2603,7 @@ ParserBase<Impl>::ParseTailCallExpression(ExpressionClassifier* classifier, |
| *ok = false; |
| return impl()->EmptyExpression(); |
| } |
| - classifier->RecordTailCallExpressionError( |
| + classifier()->RecordTailCallExpressionError( |
| loc, MessageTemplate::kUnexpectedTailCall); |
| function_state_->AddExplicitTailCallExpression(expression, loc); |
| return expression; |
| @@ -2599,7 +2613,6 @@ ParserBase<Impl>::ParseTailCallExpression(ExpressionClassifier* classifier, |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, |
| - ExpressionClassifier* classifier, |
| bool* ok) { |
| // ConditionalExpression :: |
| // LogicalOrExpression |
| @@ -2607,23 +2620,21 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, |
| int pos = peek_position(); |
| // We start using the binary expression parser for prec >= 4 only! |
| - ExpressionT expression = |
| - ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); |
| + ExpressionT expression = ParseBinaryExpression(4, accept_IN, CHECK_OK); |
| if (peek() != Token::CONDITIONAL) return expression; |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::CONDITIONAL); |
| // In parsing the first assignment expression in conditional |
| // expressions we always accept the 'in' keyword; see ECMA-262, |
| // section 11.12, page 58. |
| - ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT left = ParseAssignmentExpression(true, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| Expect(Token::COLON, CHECK_OK); |
| - ExpressionT right = |
| - ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| return factory()->NewConditional(expression, left, right, pos); |
| } |
| @@ -2631,27 +2642,26 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, |
| // Precedence >= 4 |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression( |
| - int prec, bool accept_IN, ExpressionClassifier* classifier, bool* ok) { |
| + int prec, bool accept_IN, bool* ok) { |
| DCHECK(prec >= 4); |
| - ExpressionT x = ParseUnaryExpression(classifier, CHECK_OK); |
| + ExpressionT x = ParseUnaryExpression(CHECK_OK); |
| for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { |
| // prec1 >= 4 |
| while (Precedence(peek(), accept_IN) == prec1) { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Token::Value op = Next(); |
| int pos = position(); |
| const bool is_right_associative = op == Token::EXP; |
| const int next_prec = is_right_associative ? prec1 : prec1 + 1; |
| - ExpressionT y = |
| - ParseBinaryExpression(next_prec, accept_IN, classifier, CHECK_OK); |
| + ExpressionT y = ParseBinaryExpression(next_prec, accept_IN, CHECK_OK); |
| if (op != Token::OR && op != Token::AND) { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| } |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| if (impl()->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos)) { |
| continue; |
| @@ -2686,7 +2696,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression( |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| // UnaryExpression :: |
| // PostfixExpression |
| // 'delete' UnaryExpression |
| @@ -2702,14 +2712,14 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression( |
| Token::Value op = peek(); |
| if (Token::IsUnaryOp(op)) { |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| op = Next(); |
| int pos = position(); |
| - ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| if (op == Token::DELETE && is_strict(language_mode())) { |
| if (impl()->IsIdentifier(expression)) { |
| @@ -2729,17 +2739,17 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression( |
| // Allow the parser's implementation to rewrite the expression. |
| return impl()->BuildUnaryExpression(expression, op, pos); |
| } else if (Token::IsCountOp(op)) { |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| op = Next(); |
| int beg_pos = peek_position(); |
| - ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| expression = CheckAndRewriteReferenceExpression( |
| expression, beg_pos, scanner()->location().end_pos, |
| MessageTemplate::kInvalidLhsInPrefixOp, CHECK_OK); |
| expression = impl()->MarkExpressionAsAssigned(expression); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| return factory()->NewCountOperation(op, |
| true /* prefix */, |
| @@ -2747,40 +2757,40 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression( |
| position()); |
| } else if (is_async_function() && peek() == Token::AWAIT) { |
| - classifier->RecordFormalParameterInitializerError( |
| + classifier()->RecordFormalParameterInitializerError( |
| scanner()->peek_location(), |
| MessageTemplate::kAwaitExpressionFormalParameter); |
| int await_pos = peek_position(); |
| Consume(Token::AWAIT); |
| - ExpressionT value = ParseUnaryExpression(classifier, CHECK_OK); |
| + ExpressionT value = ParseUnaryExpression(CHECK_OK); |
| return impl()->RewriteAwaitExpression(value, await_pos); |
| } else { |
| - return ParsePostfixExpression(classifier, ok); |
| + return ParsePostfixExpression(ok); |
| } |
| } |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePostfixExpression( |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| // PostfixExpression :: |
| // LeftHandSideExpression ('++' | '--')? |
| int lhs_beg_pos = peek_position(); |
| - ExpressionT expression = ParseLeftHandSideExpression(classifier, CHECK_OK); |
| + ExpressionT expression = ParseLeftHandSideExpression(CHECK_OK); |
| if (!scanner()->HasAnyLineTerminatorBeforeNext() && |
| Token::IsCountOp(peek())) { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| expression = CheckAndRewriteReferenceExpression( |
| expression, lhs_beg_pos, scanner()->location().end_pos, |
| MessageTemplate::kInvalidLhsInPostfixOp, CHECK_OK); |
| expression = impl()->MarkExpressionAsAssigned(expression); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| Token::Value next = Next(); |
| expression = |
| @@ -2794,40 +2804,39 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePostfixExpression( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| -ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| - bool* ok) { |
| +ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) { |
| // LeftHandSideExpression :: |
| // (NewExpression | MemberExpression) ... |
| if (FLAG_harmony_explicit_tailcalls && peek() == Token::CONTINUE) { |
| - return ParseTailCallExpression(classifier, ok); |
| + return ParseTailCallExpression(ok); |
| } |
| bool is_async = false; |
| ExpressionT result = |
| - ParseMemberWithNewPrefixesExpression(classifier, &is_async, CHECK_OK); |
| + ParseMemberWithNewPrefixesExpression(&is_async, CHECK_OK); |
| while (true) { |
| switch (peek()) { |
| case Token::LBRACK: { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::LBRACK); |
| int pos = position(); |
| - ExpressionT index = ParseExpression(true, classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT index = ParseExpressionNoWrap(true, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| result = factory()->NewProperty(result, index, pos); |
| Expect(Token::RBRACK, CHECK_OK); |
| break; |
| } |
| case Token::LPAREN: { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| int pos; |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| if (scanner()->current_token() == Token::IDENTIFIER || |
| scanner()->current_token() == Token::SUPER || |
| scanner()->current_token() == Token::ASYNC) { |
| @@ -2851,17 +2860,17 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| Scanner::Location spread_pos; |
| typename Types::ExpressionList args; |
| if (V8_UNLIKELY(is_async && impl()->IsIdentifier(result))) { |
| - ExpressionClassifier async_classifier(this); |
| - args = ParseArguments(&spread_pos, true, &async_classifier, CHECK_OK); |
| + ExpressionClassifierWrapper wrap_async_classifier(this); |
| + args = ParseArguments(&spread_pos, true, CHECK_OK); |
| if (peek() == Token::ARROW) { |
| if (fni_) { |
| fni_->RemoveAsyncKeywordFromEnd(); |
| } |
| - ValidateBindingPattern(&async_classifier, CHECK_OK); |
| - ValidateFormalParameterInitializer(&async_classifier, CHECK_OK); |
| - if (!async_classifier.is_valid_async_arrow_formal_parameters()) { |
| + ValidateBindingPattern(CHECK_OK); |
| + ValidateFormalParameterInitializer(CHECK_OK); |
| + if (!classifier()->is_valid_async_arrow_formal_parameters()) { |
| ReportClassifierError( |
| - async_classifier.async_arrow_formal_parameters_error()); |
| + classifier()->async_arrow_formal_parameters_error()); |
| *ok = false; |
| return impl()->EmptyExpression(); |
| } |
| @@ -2872,14 +2881,13 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| // async () => ... |
| return factory()->NewEmptyParentheses(pos); |
| } else { |
| - classifier->AccumulateFormalParameterContainmentErrors( |
| - &async_classifier); |
| + impl()->AccumulateFormalParameterContainmentErrors(); |
| } |
| } else { |
| - args = ParseArguments(&spread_pos, false, classifier, CHECK_OK); |
| + args = ParseArguments(&spread_pos, false, CHECK_OK); |
| } |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + ArrowFormalParametersUnexpectedToken(); |
| // Keep track of eval() calls since they disable all local variable |
| // optimizations. |
| @@ -2912,10 +2920,10 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| } |
| case Token::PERIOD: { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::PERIOD); |
| int pos = position(); |
| IdentifierT name = ParseIdentifierName(CHECK_OK); |
| @@ -2927,11 +2935,11 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| case Token::TEMPLATE_SPAN: |
| case Token::TEMPLATE_TAIL: { |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| - result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| + result = ParseTemplateLiteral(result, position(), CHECK_OK); |
| break; |
| } |
| @@ -2943,8 +2951,8 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier, |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| -ParserBase<Impl>::ParseMemberWithNewPrefixesExpression( |
| - ExpressionClassifier* classifier, bool* is_async, bool* ok) { |
| +ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async, |
| + bool* ok) { |
| // NewExpression :: |
| // ('new')+ MemberExpression |
| // |
| @@ -2966,8 +2974,8 @@ ParserBase<Impl>::ParseMemberWithNewPrefixesExpression( |
| // new new foo().bar().baz means (new (new foo()).bar()).baz |
| if (peek() == Token::NEW) { |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::NEW); |
| int new_pos = position(); |
| ExpressionT result; |
| @@ -2977,15 +2985,14 @@ ParserBase<Impl>::ParseMemberWithNewPrefixesExpression( |
| } else if (peek() == Token::PERIOD) { |
| return ParseNewTargetExpression(CHECK_OK); |
| } else { |
| - result = |
| - ParseMemberWithNewPrefixesExpression(classifier, is_async, CHECK_OK); |
| + result = ParseMemberWithNewPrefixesExpression(is_async, CHECK_OK); |
| } |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| if (peek() == Token::LPAREN) { |
| // NewExpression with arguments. |
| Scanner::Location spread_pos; |
| typename Types::ExpressionList args = |
| - ParseArguments(&spread_pos, classifier, CHECK_OK); |
| + ParseArguments(&spread_pos, CHECK_OK); |
| if (spread_pos.IsValid()) { |
| args = impl()->PrepareSpreadArguments(args); |
| @@ -2994,20 +3001,19 @@ ParserBase<Impl>::ParseMemberWithNewPrefixesExpression( |
| result = factory()->NewCallNew(result, args, new_pos); |
| } |
| // The expression can still continue with . or [ after the arguments. |
| - result = ParseMemberExpressionContinuation(result, is_async, classifier, |
| - CHECK_OK); |
| + result = ParseMemberExpressionContinuation(result, is_async, CHECK_OK); |
| return result; |
| } |
| // NewExpression without arguments. |
| return factory()->NewCallNew(result, impl()->NewExpressionList(0), new_pos); |
| } |
| // No 'new' or 'super' keyword. |
| - return ParseMemberExpression(classifier, is_async, ok); |
| + return ParseMemberExpression(is_async, ok); |
| } |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression( |
| - ExpressionClassifier* classifier, bool* is_async, bool* ok) { |
| + bool* is_async, bool* ok) { |
| // MemberExpression :: |
| // (PrimaryExpression | FunctionLiteral | ClassLiteral) |
| // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)* |
| @@ -3019,8 +3025,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression( |
| // Parse the initial primary or function expression. |
| ExpressionT result; |
| if (peek() == Token::FUNCTION) { |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::FUNCTION); |
| int function_token_position = position(); |
| @@ -3065,11 +3071,10 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression( |
| const bool is_new = false; |
| result = ParseSuperExpression(is_new, CHECK_OK); |
| } else { |
| - result = ParsePrimaryExpression(classifier, is_async, CHECK_OK); |
| + result = ParsePrimaryExpression(is_async, CHECK_OK); |
| } |
| - result = |
| - ParseMemberExpressionContinuation(result, is_async, classifier, CHECK_OK); |
| + result = ParseMemberExpressionContinuation(result, is_async, CHECK_OK); |
| return result; |
| } |
| @@ -3134,23 +3139,22 @@ ParserBase<Impl>::ParseNewTargetExpression(bool* ok) { |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| -ParserBase<Impl>::ParseMemberExpressionContinuation( |
| - ExpressionT expression, bool* is_async, ExpressionClassifier* classifier, |
| - bool* ok) { |
| +ParserBase<Impl>::ParseMemberExpressionContinuation(ExpressionT expression, |
| + bool* is_async, bool* ok) { |
| // Parses this part of MemberExpression: |
| // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* |
| while (true) { |
| switch (peek()) { |
| case Token::LBRACK: { |
| *is_async = false; |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::LBRACK); |
| int pos = position(); |
| - ExpressionT index = ParseExpression(true, classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT index = ParseExpressionNoWrap(true, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| expression = factory()->NewProperty(expression, index, pos); |
| if (fni_ != NULL) { |
| impl()->PushPropertyName(fni_, index); |
| @@ -3160,9 +3164,9 @@ ParserBase<Impl>::ParseMemberExpressionContinuation( |
| } |
| case Token::PERIOD: { |
| *is_async = false; |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| Consume(Token::PERIOD); |
| int pos = position(); |
| @@ -3177,9 +3181,9 @@ ParserBase<Impl>::ParseMemberExpressionContinuation( |
| case Token::TEMPLATE_SPAN: |
| case Token::TEMPLATE_TAIL: { |
| *is_async = false; |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| - BindingPatternUnexpectedToken(classifier); |
| - ArrowFormalParametersUnexpectedToken(classifier); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| + BindingPatternUnexpectedToken(); |
| + ArrowFormalParametersUnexpectedToken(); |
| int pos; |
| if (scanner()->current_token() == Token::IDENTIFIER) { |
| pos = position(); |
| @@ -3191,8 +3195,7 @@ ParserBase<Impl>::ParseMemberExpressionContinuation( |
| expression->AsFunctionLiteral()->set_should_eager_compile(); |
| } |
| } |
| - expression = |
| - ParseTemplateLiteral(expression, pos, classifier, CHECK_OK); |
| + expression = ParseTemplateLiteral(expression, pos, CHECK_OK); |
| break; |
| } |
| case Token::ILLEGAL: { |
| @@ -3210,32 +3213,29 @@ ParserBase<Impl>::ParseMemberExpressionContinuation( |
| template <typename Impl> |
| void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters, |
| - ExpressionClassifier* classifier, |
| bool* ok) { |
| // FormalParameter[Yield,GeneratorParameter] : |
| // BindingElement[?Yield, ?GeneratorParameter] |
| bool is_rest = parameters->has_rest; |
| - ExpressionT pattern = |
| - ParsePrimaryExpression(classifier, CHECK_OK_CUSTOM(Void)); |
| - ValidateBindingPattern(classifier, CHECK_OK_CUSTOM(Void)); |
| + ExpressionT pattern = ParsePrimaryExpression(CHECK_OK_CUSTOM(Void)); |
| + ValidateBindingPattern(CHECK_OK_CUSTOM(Void)); |
| if (!impl()->IsIdentifier(pattern)) { |
| parameters->is_simple = false; |
| - ValidateFormalParameterInitializer(classifier, CHECK_OK_CUSTOM(Void)); |
| - classifier->RecordNonSimpleParameter(); |
| + ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void)); |
| + classifier()->RecordNonSimpleParameter(); |
| } |
| ExpressionT initializer = impl()->EmptyExpression(); |
| if (!is_rest && Check(Token::ASSIGN)) { |
| - ExpressionClassifier init_classifier(this); |
| - initializer = ParseAssignmentExpression(true, &init_classifier, |
| - CHECK_OK_CUSTOM(Void)); |
| - impl()->RewriteNonPattern(&init_classifier, CHECK_OK_CUSTOM(Void)); |
| - ValidateFormalParameterInitializer(&init_classifier, CHECK_OK_CUSTOM(Void)); |
| + ExpressionClassifierWrapper wrap_init_classifier(this); |
| + initializer = ParseAssignmentExpression(true, CHECK_OK_CUSTOM(Void)); |
| + impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void)); |
| + ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void)); |
| parameters->is_simple = false; |
| - init_classifier.Discard(); |
| - classifier->RecordNonSimpleParameter(); |
| + impl()->Discard(); |
| + classifier()->RecordNonSimpleParameter(); |
| impl()->SetFunctionNameFromIdentifierRef(initializer, pattern); |
| } |
| @@ -3245,8 +3245,8 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters, |
| } |
| template <typename Impl> |
| -void ParserBase<Impl>::ParseFormalParameterList( |
| - FormalParametersT* parameters, ExpressionClassifier* classifier, bool* ok) { |
| +void ParserBase<Impl>::ParseFormalParameterList(FormalParametersT* parameters, |
| + bool* ok) { |
| // FormalParameters[Yield] : |
| // [empty] |
| // FunctionRestParameter[?Yield] |
| @@ -3268,11 +3268,11 @@ void ParserBase<Impl>::ParseFormalParameterList( |
| return; |
| } |
| parameters->has_rest = Check(Token::ELLIPSIS); |
| - ParseFormalParameter(parameters, classifier, CHECK_OK_CUSTOM(Void)); |
| + ParseFormalParameter(parameters, CHECK_OK_CUSTOM(Void)); |
| if (parameters->has_rest) { |
| parameters->is_simple = false; |
| - classifier->RecordNonSimpleParameter(); |
| + classifier()->RecordNonSimpleParameter(); |
| if (peek() == Token::COMMA) { |
| impl()->ReportMessageAt(scanner()->peek_location(), |
| MessageTemplate::kParamAfterRest); |
| @@ -3291,7 +3291,7 @@ void ParserBase<Impl>::ParseFormalParameterList( |
| for (int i = 0; i < parameters->Arity(); ++i) { |
| auto parameter = parameters->at(i); |
| - impl()->DeclareFormalParameter(parameters->scope, parameter, classifier); |
| + impl()->DeclareFormalParameter(parameters->scope, parameter); |
| } |
| } |
| @@ -3371,7 +3371,7 @@ template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT |
| ParserBase<Impl>::ParseArrowFunctionLiteral( |
| bool accept_IN, const FormalParametersT& formal_parameters, bool is_async, |
| - const ExpressionClassifier& formals_classifier, bool* ok) { |
| + bool* ok) { |
| if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { |
| // ASI inserts `;` after arrow parameters if a line terminator is found. |
| // `=> ...` is never a valid expression, so report as syntax error. |
| @@ -3430,15 +3430,14 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
| body = impl()->NewStatementList(1); |
| impl()->AddParameterInitializationBlock(formal_parameters, body, is_async, |
| CHECK_OK); |
| - ExpressionClassifier classifier(this); |
| + ExpressionClassifierWrapper wrap_classifier(this); |
| if (is_async) { |
| - impl()->ParseAsyncArrowSingleExpressionBody(body, accept_IN, |
| - &classifier, pos, CHECK_OK); |
| - impl()->RewriteNonPattern(&classifier, CHECK_OK); |
| + impl()->ParseAsyncArrowSingleExpressionBody(body, accept_IN, pos, |
| + CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| } else { |
| - ExpressionT expression = |
| - ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(&classifier, CHECK_OK); |
| + ExpressionT expression = ParseAssignmentExpression(accept_IN, CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| body->Add(factory()->NewReturnStatement(expression, pos), zone()); |
| if (allow_tailcalls() && !is_sloppy(language_mode())) { |
| // ES6 14.6.1 Static Semantics: IsInTailPosition |
| @@ -3457,8 +3456,8 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
| // that duplicates are not allowed. Of course, the arrow function may |
| // itself be strict as well. |
| const bool allow_duplicate_parameters = false; |
| - ValidateFormalParameters(&formals_classifier, language_mode(), |
| - allow_duplicate_parameters, CHECK_OK); |
| + ValidateFormalParameters(language_mode(), allow_duplicate_parameters, |
| + CHECK_OK); |
| // Validate strict mode. |
| if (is_strict(language_mode())) { |
| @@ -3488,7 +3487,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
| template <typename Impl> |
| typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral( |
| - ExpressionT tag, int start, ExpressionClassifier* classifier, bool* ok) { |
| + ExpressionT tag, int start, bool* ok) { |
| // A TemplateLiteral is made up of 0 or more TEMPLATE_SPAN tokens (literal |
| // text followed by a substitution expression), finalized by a single |
| // TEMPLATE_TAIL. |
| @@ -3540,9 +3539,9 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral( |
| } |
| int expr_pos = peek_position(); |
| - ExpressionT expression = ParseExpression(true, classifier, CHECK_OK); |
| - CheckNoTailCallExpressions(classifier, CHECK_OK); |
| - impl()->RewriteNonPattern(classifier, CHECK_OK); |
| + ExpressionT expression = ParseExpressionNoWrap(true, CHECK_OK); |
| + CheckNoTailCallExpressions(CHECK_OK); |
| + impl()->RewriteNonPattern(CHECK_OK); |
| impl()->AddTemplateExpression(&ts, expression); |
| if (peek() != Token::RBRACE) { |
| @@ -3621,12 +3620,11 @@ bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) { |
| } |
| template <typename Impl> |
| -void ParserBase<Impl>::CheckDestructuringElement( |
| - ExpressionT expression, ExpressionClassifier* classifier, int begin, |
| - int end) { |
| +void ParserBase<Impl>::CheckDestructuringElement(ExpressionT expression, |
| + int begin, int end) { |
| if (!IsValidPattern(expression) && !expression->IsAssignment() && |
| !IsValidReferenceExpression(expression)) { |
| - classifier->RecordAssignmentPatternError( |
| + classifier()->RecordAssignmentPatternError( |
| Scanner::Location(begin, end), |
| MessageTemplate::kInvalidDestructuringTarget); |
| } |
| @@ -3639,7 +3637,7 @@ void ParserBase<Impl>::CheckDestructuringElement( |
| template <typename Impl> |
| void ParserBase<Impl>::ObjectLiteralChecker::CheckProperty( |
| Token::Value property, PropertyKind type, MethodKind method_type, |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| DCHECK(!IsStaticMethod(method_type)); |
| DCHECK(!IsSpecialMethod(method_type) || type == kMethodProperty); |
| @@ -3647,8 +3645,8 @@ void ParserBase<Impl>::ObjectLiteralChecker::CheckProperty( |
| if (type == kValueProperty && IsProto()) { |
| if (has_seen_proto_) { |
| - classifier->RecordExpressionError(this->scanner()->location(), |
| - MessageTemplate::kDuplicateProto); |
| + this->parser()->classifier()->RecordExpressionError( |
| + this->scanner()->location(), MessageTemplate::kDuplicateProto); |
| return; |
| } |
| has_seen_proto_ = true; |
| @@ -3658,7 +3656,7 @@ void ParserBase<Impl>::ObjectLiteralChecker::CheckProperty( |
| template <typename Impl> |
| void ParserBase<Impl>::ClassLiteralChecker::CheckProperty( |
| Token::Value property, PropertyKind type, MethodKind method_type, |
| - ExpressionClassifier* classifier, bool* ok) { |
| + bool* ok) { |
| DCHECK(type == kMethodProperty || type == kAccessorProperty); |
| if (property == Token::SMI || property == Token::NUMBER) return; |