Skip to content

Commit b9f682b

Browse files
nickieCommit bot
authored andcommitted
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}
1 parent 04f710a commit b9f682b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/parsing/parser-base.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,8 +1592,11 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
15921592
MessageTemplate::kUnexpectedToken,
15931593
Token::String(Token::ELLIPSIS));
15941594
classifier->RecordNonSimpleParameter();
1595-
ExpressionT expr =
1596-
this->ParseAssignmentExpression(true, classifier, CHECK_OK);
1595+
ExpressionClassifier binding_classifier(this);
1596+
ExpressionT expr = this->ParseAssignmentExpression(
1597+
true, &binding_classifier, CHECK_OK);
1598+
classifier->Accumulate(&binding_classifier,
1599+
ExpressionClassifier::AllProductions);
15971600
if (!this->IsIdentifier(expr) && !IsValidPattern(expr)) {
15981601
classifier->RecordArrowFormalParametersError(
15991602
Scanner::Location(ellipsis_pos, scanner()->location().end_pos),
Lines changed: 7 additions & 0 deletions
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)