[parser] Throw syntax error for %Foo(...spread)
Bug: chromium:806200 Change-Id: If76a8cb5b988321d38d170dfba7c1fc5354e2667 Reviewed-on: https://chromium-review.googlesource.com/888922 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#50922}
This commit is contained in:
parent
095e62bfcd
commit
3249b162bd
@ -598,6 +598,7 @@ class ErrorUtils : public AllStatic {
|
||||
T(IllegalLanguageModeDirective, \
|
||||
"Illegal '%' directive in function with non-simple parameter list") \
|
||||
T(IllegalReturn, "Illegal return statement") \
|
||||
T(IntrinsicWithSpread, "Intrinsic calls do not support spread arguments") \
|
||||
T(InvalidRestBindingPattern, \
|
||||
"`...` must be followed by an identifier in declaration contexts") \
|
||||
T(InvalidRestAssignmentPattern, \
|
||||
|
@ -4809,7 +4809,12 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic(
|
||||
ExpressionClassifier classifier(this);
|
||||
ExpressionListT args = ParseArguments(&spread_pos, CHECK_OK);
|
||||
|
||||
DCHECK(!spread_pos.IsValid());
|
||||
if (spread_pos.IsValid()) {
|
||||
*ok = false;
|
||||
ReportMessageAt(spread_pos, MessageTemplate::kIntrinsicWithSpread,
|
||||
kSyntaxError);
|
||||
return impl()->NullExpression();
|
||||
}
|
||||
|
||||
return impl()->NewV8Intrinsic(name, args, pos, ok);
|
||||
}
|
||||
|
7
test/mjsunit/regress/regress-crbug-806200.js
Normal file
7
test/mjsunit/regress/regress-crbug-806200.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
assertThrows("%Foo(...spread)", SyntaxError);
|
Loading…
Reference in New Issue
Block a user