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

Unified Diff: src/pattern-rewriter.cc

Issue 1405313002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix class literal handling Created 5 years, 2 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.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pattern-rewriter.cc
diff --git a/src/pattern-rewriter.cc b/src/pattern-rewriter.cc
index 1a85ff77e4a54b8ee494cd04ae6a9ab02df63bce..ce0689404e0526d089aa402e5d68b10fae064181 100644
--- a/src/pattern-rewriter.cc
+++ b/src/pattern-rewriter.cc
@@ -4,6 +4,7 @@
#include "src/ast.h"
#include "src/messages.h"
+#include "src/parameter-initializer-rewriter.h"
#include "src/parser.h"
namespace v8 {
@@ -359,8 +360,16 @@ void Parser::PatternRewriter::VisitAssignment(Assignment* node) {
Token::EQ_STRICT, factory()->NewVariableProxy(temp),
factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
RelocInfo::kNoPosition);
+ Expression* initializer = node->value();
+ if (descriptor_->declaration_kind == DeclarationDescriptor::PARAMETER &&
+ descriptor_->scope->is_arrow_scope()) {
+ // TODO(adamk): Only call this if necessary.
+ RewriteParameterInitializerScope(
+ descriptor_->parser->stack_limit(), initializer,
+ descriptor_->scope->outer_scope(), descriptor_->scope);
+ }
Expression* value = factory()->NewConditional(
- is_undefined, node->value(), factory()->NewVariableProxy(temp),
+ is_undefined, initializer, factory()->NewVariableProxy(temp),
RelocInfo::kNoPosition);
RecurseIntoSubpattern(node->target(), value);
}
« no previous file with comments | « src/parser.cc ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698