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

Unified Diff: src/parser.cc

Issue 987083003: [es6] support rest parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix preparser bug Created 5 years, 9 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/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 1345a790eb6258d0d0d6d6bdc5bfb95778ac42e8..aa101a8a2a46d1ab89879cf9eb18a9cf6d76913e 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3553,6 +3553,11 @@ bool CheckAndDeclareArrowParameter(ParserTraits* traits, Expression* expression,
// Case for a single parameter:
// (foo) => ...
// foo => ...
+ bool is_rest = false;
arv (Not doing code reviews) 2015/03/10 13:44:02 Maybe this should go after the IsVariableProxy che
+ if (expression->IsSpreadOperation()) {
+ expression = expression->AsSpreadOperation()->expression();
+ is_rest = true;
+ }
if (expression->IsVariableProxy()) {
if (expression->AsVariableProxy()->is_this()) return false;
@@ -3567,7 +3572,7 @@ bool CheckAndDeclareArrowParameter(ParserTraits* traits, Expression* expression,
return false;
}
- scope->DeclareParameter(raw_name, VAR);
+ scope->DeclareParameter(raw_name, VAR, is_rest);
++(*num_params);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698