Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/preparser.cc

Issue 1141223002: [parser] report SyntaxError if rest parameter used in Setter MethodDefinition (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index f2502bbbb72fa84ea6f8fa3adc4819547a10e591..d8b33120f61119783eb881c4cf713c06825bead0 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -1026,21 +1026,21 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
&factory);
ExpressionClassifier formals_classifier;
- bool is_rest = false;
+ bool has_rest = false;
Expect(Token::LPAREN, CHECK_OK);
int start_position = scanner()->location().beg_pos;
function_scope->set_start_position(start_position);
int num_parameters;
{
DuplicateFinder duplicate_finder(scanner()->unicode_cache());
- num_parameters = ParseFormalParameterList(&duplicate_finder, &is_rest,
+ num_parameters = ParseFormalParameterList(&duplicate_finder, &has_rest,
&formals_classifier, CHECK_OK);
}
Expect(Token::RPAREN, CHECK_OK);
int formals_end_position = scanner()->location().end_pos;
- CheckArityRestrictions(num_parameters, arity_restriction, start_position,
- formals_end_position, CHECK_OK);
+ CheckArityRestrictions(num_parameters, arity_restriction, has_rest,
+ start_position, formals_end_position, CHECK_OK);
// See Parser::ParseFunctionLiteral for more information about lazy parsing
// and lazy compilation.
@@ -1060,7 +1060,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// function, since the function can declare itself strict.
CheckFunctionName(language_mode(), kind, function_name,
name_is_strict_reserved, function_name_location, CHECK_OK);
- const bool strict_formal_parameters = is_rest || IsConciseMethod(kind);
+ const bool strict_formal_parameters = has_rest || IsConciseMethod(kind);
const bool allow_duplicate_parameters =
is_sloppy(language_mode()) && !strict_formal_parameters;
ValidateFormalParameters(&formals_classifier, language_mode(),

Powered by Google App Engine
This is Rietveld 408576698