Commit 3249b162 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[parser] Throw syntax error for %Foo(...spread)

Bug: chromium:806200
Change-Id: If76a8cb5b988321d38d170dfba7c1fc5354e2667
Reviewed-on: https://chromium-review.googlesource.com/888922Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50922}
parent 095e62bf
......@@ -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);
}
......
// 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment