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

Unified Diff: src/parsing/parser.h

Issue 1537683002: Partial revert of rest parameter desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures. Created 5 years 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/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.h
diff --git a/src/parsing/parser.h b/src/parsing/parser.h
index ae0c7499663bda4d5d81e0035a43281bdf627047..1d46d9a57d0db660dc285d18c019de6f3a6f18ab 100644
--- a/src/parsing/parser.h
+++ b/src/parsing/parser.h
@@ -1394,8 +1394,7 @@ void ParserTraits::AddFormalParameter(ParserFormalParameters* parameters,
Expression* initializer,
int initializer_end_position,
bool is_rest) {
- bool is_simple =
- !is_rest && pattern->IsVariableProxy() && initializer == nullptr;
+ bool is_simple = pattern->IsVariableProxy() && initializer == nullptr;
const AstRawString* name = is_simple
? pattern->AsVariableProxy()->raw_name()
: parser_->ast_value_factory()->empty_string();
@@ -1411,8 +1410,10 @@ void ParserTraits::DeclareFormalParameter(
ExpressionClassifier* classifier) {
bool is_duplicate = false;
bool is_simple = classifier->is_simple_parameter_list();
- auto name = parameter.name;
- auto mode = is_simple ? VAR : TEMPORARY;
+ auto name = is_simple || parameter.is_rest
+ ? parameter.name
+ : parser_->ast_value_factory()->empty_string();
+ auto mode = is_simple || parameter.is_rest ? 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/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698