Skip to content

Commit 8dfc710

Browse files
targosMylesBorins
authored andcommitted
deps: cherry-pick b9f682b from upstream V8
Original commit message: Fix bug with illegal spread as single arrow parameter [email protected] BUG=chromium:621496 LOG=N Review-Url: https://codereview.chromium.org/2084703005 Cr-Commit-Position: refs/heads/master@{#37196} Fixes: #12017 PR-URL: #12037 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 52bdb8f commit 8dfc710

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 281
14-
#define V8_PATCH_LEVEL 96
14+
#define V8_PATCH_LEVEL 97
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,11 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
13071307
MessageTemplate::kUnexpectedToken,
13081308
Token::String(Token::ELLIPSIS));
13091309
classifier->RecordNonSimpleParameter();
1310-
ExpressionT expr =
1311-
this->ParseAssignmentExpression(true, classifier, CHECK_OK);
1310+
ExpressionClassifier binding_classifier(this);
1311+
ExpressionT expr = this->ParseAssignmentExpression(
1312+
true, &binding_classifier, CHECK_OK);
1313+
classifier->Accumulate(&binding_classifier,
1314+
ExpressionClassifier::AllProductions);
13121315
if (!this->IsIdentifier(expr) && !IsValidPattern(expr)) {
13131316
classifier->RecordArrowFormalParametersError(
13141317
Scanner::Location(ellipsis_pos, scanner()->location().end_pos),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2016 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 testIllegalSpreadAsSingleArrowParameter() {
6+
assertThrows("(...[42]) => 42)", SyntaxError) // will core dump, if not fixed
7+
})();

0 commit comments

Comments
 (0)