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

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: Rebase + fix brokenness Created 5 years, 4 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.h
diff --git a/src/parser.h b/src/parser.h
index effa562e2bc9d25862bd37e8d57ac6ae9f87ee57..130b68b4e6a1964dec0e0a0c3d5975f39b42a73b 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -980,6 +980,7 @@ class Parser : public ParserBase<ParserTraits> {
Scope* hoist_scope;
VariableMode mode;
bool is_const;
+ bool is_rest;
bool needs_init;
int declaration_pos;
int initialization_pos;
@@ -998,6 +999,8 @@ class Parser : public ParserBase<ParserTraits> {
Expression* pattern;
int initializer_position;
Expression* initializer;
+ bool is_rest = false;
adamk 2015/08/28 23:26:37 Does this compile? I think this and the below shou
caitp (gmail) 2015/08/28 23:58:01 Compiles with clang version 3.8.0 (trunk 242792),
adamk 2015/08/29 01:01:07 Huh, I may just be out of date. Feel free to leave
caitp (gmail) 2015/08/29 15:51:59 It turns out these members were unused anyways, so
+ int rest_literal_index = 0;
};
DeclarationParsingResult()
@@ -1338,10 +1341,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(

Powered by Google App Engine
This is Rietveld 408576698