Skip to content

Commit 3acc89f

Browse files
targosrichardlau
authored andcommitted
deps: V8: backport cd21f71f9cb5
Original commit message: [parser] Validate destructuring assignment pattern in correct classifier Previously we'd first accumulate errors to the parent and validate the destructuring pattern in the parent. In the case of ParseArguments this will invalidly propagate binding pattern errors from one argument to the next. The reason why ParseArguments keeps track of binding pattern errors is because it could also be used to parse async arrow function parameters. If we see async(a,b) we don't yet know whether this is the head of an async arrow function, or a call to async with arguments a and b. Bug: v8:8241 Change-Id: I670ab9a9c6f2e0bee399808b02a465ae1afa7c3f Reviewed-on: https://chromium-review.googlesource.com/c/1296229 Commit-Queue: Toon Verwaest <[email protected]> Reviewed-by: Marja Hölttä <[email protected]> Cr-Commit-Position: refs/heads/master@{#56887} Refs: v8/v8@cd21f71 Fixes: #23142 PR-URL: #33862 Reviewed-By: Richard Lau <[email protected]>
1 parent 89a306b commit 3acc89f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Reset this number to 0 on major V8 upgrades.
3535
# Increment by one for each non-official patch applied to deps/v8.
36-
'v8_embedder_string': '-node.57',
36+
'v8_embedder_string': '-node.58',
3737

3838
# Enable disassembler for `--print-code` v8 options
3939
'v8_enable_disassembler': 1,

deps/v8/src/parsing/parser-base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2977,13 +2977,13 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
29772977
// This is definitely not an expression so don't accumulate
29782978
// expression-related errors.
29792979
productions &= ~ExpressionClassifier::ExpressionProduction;
2980+
ValidateAssignmentPattern(CHECK_OK);
29802981
}
29812982

29822983
Accumulate(productions);
29832984
if (!Token::IsAssignmentOp(peek())) return expression;
29842985

29852986
if (is_destructuring_assignment) {
2986-
ValidateAssignmentPattern(CHECK_OK);
29872987
} else {
29882988
expression = CheckAndRewriteReferenceExpression(
29892989
expression, lhs_beg_pos, scanner()->location().end_pos,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright 2018 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
function f(x) { }
6+
f(x=>x, [x,y] = [1,2]);

0 commit comments

Comments
 (0)