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

Unified Diff: src/parser.h

Issue 1272673003: [es6] Re-implement rest parameters via desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Oops. Created 5 years, 3 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/mips64/code-stubs-mips64.cc ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index effa562e2bc9d25862bd37e8d57ac6ae9f87ee57..29dbb099547fe88073c659017b44ab8bb796cbfa 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -1320,7 +1320,8 @@ Expression* ParserTraits::SpreadCallNew(
void ParserTraits::AddFormalParameter(
ParserFormalParameters* parameters,
Expression* pattern, Expression* initializer, bool is_rest) {
- bool is_simple = pattern->IsVariableProxy() && initializer == nullptr;
+ bool is_simple =
+ !is_rest && pattern->IsVariableProxy() && initializer == nullptr;
caitp (gmail) 2015/09/02 20:11:31 This makes sure the empty string is used instead o
rossberg 2015/09/02 20:44:10 Yes, this looks right to me.
DCHECK(parser_->allow_harmony_destructuring() ||
parser_->allow_harmony_rest_parameters() ||
parser_->allow_harmony_default_parameters() || is_simple);
@@ -1338,10 +1339,8 @@ void ParserTraits::DeclareFormalParameter(
ExpressionClassifier* classifier) {
bool is_duplicate = false;
bool is_simple = classifier->is_simple_parameter_list();
- // TODO(caitp): Remove special handling for rest once desugaring is in.
- auto name = is_simple || parameter.is_rest
- ? parameter.name : parser_->ast_value_factory()->empty_string();
- auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY;
+ auto name = parameter.name;
+ auto mode = is_simple ? VAR : TEMPORARY;
if (!is_simple) scope->SetHasNonSimpleParameters();
bool is_optional = parameter.initializer != nullptr;
Variable* var = scope->DeclareParameter(
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698