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

Unified Diff: src/preparser.h

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.h
diff --git a/src/preparser.h b/src/preparser.h
index aeef700bfe7593a8369b4c4b5f0350fa8dc5b707..072ebca27cbacea94c730e070e792e7d17ee675a 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -881,7 +881,7 @@ class ParserBase : public Traits {
ExpressionClassifier* classifier, bool* ok);
void CheckArityRestrictions(
int param_count, FunctionLiteral::ArityRestriction arity_restriction,
- int formals_start_pos, int formals_end_pos, bool* ok);
+ bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok);
// Checks if the expression is a valid reference expression (e.g., on the
// left-hand side of assignments). Although ruled out by ECMA as early errors,
@@ -3623,7 +3623,7 @@ int ParserBase<Traits>::ParseFormalParameterList(
template <class Traits>
void ParserBase<Traits>::CheckArityRestrictions(
int param_count, FunctionLiteral::ArityRestriction arity_restriction,
- int formals_start_pos, int formals_end_pos, bool* ok) {
+ bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok) {
switch (arity_restriction) {
case FunctionLiteral::GETTER_ARITY:
if (param_count != 0) {
@@ -3638,6 +3638,11 @@ void ParserBase<Traits>::CheckArityRestrictions(
"bad_setter_arity");
*ok = false;
}
+ if (has_rest) {
+ ReportMessageAt(Scanner::Location(formals_start_pos, formals_end_pos),
+ "setter_rest_param");
+ *ok = false;
+ }
break;
default:
break;

Powered by Google App Engine
This is Rietveld 408576698