Commit dc9ed94e authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[parser] clear last next_arrow_function_info tracked

strict parameters error before parse parentheses expression
in ParsePrimaryExpression

clear last next_arrow_function_info tracked strict
parameters error, avoid throw syntax error when parse
arrow function nested in a parentheses expression.

Bug: v8:12688
Change-Id: Ib190ff5e04c9a83329c59421e9dd44f5a5907b07
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3516729Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79468}
parent 273d3e4b
......@@ -758,6 +758,8 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
kind == FunctionKind::kArrowFunction);
DCHECK(this->CanBeDeclaration());
DCHECK(!this->IsCertainlyDeclaration());
// clear last next_arrow_function_info tracked strict parameters error.
parser->next_arrow_function_info_.ClearStrictParameterError();
}
ArrowHeadParsingScope(const ArrowHeadParsingScope&) = delete;
......
......@@ -1972,7 +1972,11 @@ ParserBase<Impl>::ParsePrimaryExpression() {
case Token::LPAREN: {
Consume(Token::LPAREN);
if (Check(Token::RPAREN)) {
// clear last next_arrow_function_info tracked strict parameters error.
next_arrow_function_info_.ClearStrictParameterError();
// ()=>x. The continuation that consumes the => is in
// ParseAssignmentExpressionCoverGrammar.
if (peek() != Token::ARROW) ReportUnexpectedToken(Token::RPAREN);
......
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var yield;
({p: yield} = class {
q = () => 42;
});
var yield;
({p: yield} = class {
q = (a) => 42;
});
var yield;
({p: yield} = class {
q = a => 42;
});
var yield;
({p: yield} = class {
q = async a => 42;
});
var yield;
({p: yield} = class {
q = async (a) => 42;
});
var yield;
({p: yield} = class {
q = async () => 42;
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment