[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/+/3516729
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79468}
diff --git a/src/parsing/expression-scope.h b/src/parsing/expression-scope.h
index c49fae7..8a4affa 100644
--- a/src/parsing/expression-scope.h
+++ b/src/parsing/expression-scope.h
@@ -758,6 +758,8 @@
            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;
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 18d3b09..df829ff 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1972,7 +1972,11 @@
 
     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);
diff --git a/test/mjsunit/regress/regress-v8-12688.js b/test/mjsunit/regress/regress-v8-12688.js
new file mode 100644
index 0000000..8d2189d
--- /dev/null
+++ b/test/mjsunit/regress/regress-v8-12688.js
@@ -0,0 +1,33 @@
+// 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;
+});