diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/parsing/parser-base.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/parsing/parser-base.h')
-rw-r--r-- | chromium/v8/src/parsing/parser-base.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/chromium/v8/src/parsing/parser-base.h b/chromium/v8/src/parsing/parser-base.h index 903ce2bb7f8..3519599a882 100644 --- a/chromium/v8/src/parsing/parser-base.h +++ b/chromium/v8/src/parsing/parser-base.h @@ -786,7 +786,7 @@ class ParserBase { // should automatically use scope() as parent, and be fine with // NewScope(ScopeType) above. Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) const { - // Must always use the specific constructors for the blacklisted scope + // Must always use the specific constructors for the blocklisted scope // types. DCHECK_NE(FUNCTION_SCOPE, scope_type); DCHECK_NE(SCRIPT_SCOPE, scope_type); @@ -2755,8 +2755,7 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() { Token::Value op = peek(); if (!Token::IsArrowOrAssignmentOp(op)) return expression; - if ((op == Token::ASSIGN_NULLISH || op == Token::ASSIGN_OR || - op == Token::ASSIGN_AND) && + if (Token::IsLogicalAssignmentOp(op) && !flags().allow_harmony_logical_assignment()) { return expression; } @@ -2830,13 +2829,8 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() { ExpressionT right = ParseAssignmentExpression(); - if (op == Token::ASSIGN) { - // We try to estimate the set of properties set by constructors. We define a - // new property whenever there is an assignment to a property of 'this'. We - // should probably only add properties if we haven't seen them before. - // Otherwise we'll probably overestimate the number of properties. - if (impl()->IsThisProperty(expression)) function_state_->AddProperty(); - + // Anonymous function name inference applies to =, ||=, &&=, and ??=. + if (op == Token::ASSIGN || Token::IsLogicalAssignmentOp(op)) { impl()->CheckAssigningFunctionLiteralToProperty(expression, right); // Check if the right hand side is a call to avoid inferring a @@ -2850,10 +2844,20 @@ ParserBase<Impl>::ParseAssignmentExpressionCoverGrammar() { impl()->SetFunctionNameFromIdentifierRef(right, expression); } else { + fni_.RemoveLastFunction(); + } + + if (op == Token::ASSIGN) { + // We try to estimate the set of properties set by constructors. We define a + // new property whenever there is an assignment to a property of 'this'. We + // should probably only add properties if we haven't seen them before. + // Otherwise we'll probably overestimate the number of properties. + if (impl()->IsThisProperty(expression)) function_state_->AddProperty(); + } else { + // Only initializers (i.e. no compound assignments) are allowed in patterns. expression_scope()->RecordPatternError( Scanner::Location(lhs_beg_pos, end_position()), MessageTemplate::kInvalidDestructuringTarget); - fni_.RemoveLastFunction(); } return factory()->NewAssignment(op, expression, right, op_position); |