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

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: Add cctest 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
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 67ff6d876d436923fa47b9396d94d8dd37ec1590..9ace8609f602bf3c1651da18332ed6a1d2885e51 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -893,7 +893,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,
@@ -3651,7 +3651,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) {
@@ -3666,6 +3666,11 @@ void ParserBase<Traits>::CheckArityRestrictions(
MessageTemplate::kBadSetterArity);
*ok = false;
}
+ if (has_rest) {
+ ReportMessageAt(Scanner::Location(formals_start_pos, formals_end_pos),
+ MessageTemplate::kBadSetterRestParameter);
+ *ok = false;
+ }
break;
default:
break;
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698