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

Unified Diff: src/parser.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: 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 3d61c7e71b0ba921ffae9a0ebf2cf5efadbf7b36..dcc28251b37f4e59f3591f9163dc03ff5f956ddd 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -14,6 +14,7 @@
#include "src/codegen.h"
#include "src/compiler.h"
#include "src/messages.h"
+#include "src/parameter-initializer-rewriter.h"
#include "src/preparser.h"
#include "src/runtime/runtime.h"
#include "src/scanner-character-streams.h"
@@ -4047,6 +4048,10 @@ void ParserTraits::ParseArrowFunctionFormalParameters(
DCHECK(!assignment->is_compound());
initializer = assignment->value();
expr = assignment->target();
+
+ // TODO(adamk): Only call this if necessary.
+ RewriteParameterInitializerScope(parser_->stack_limit(), initializer,
+ parser_->scope_, parameters->scope);
}
AddFormalParameter(parameters, expr, initializer, is_rest);
@@ -4903,7 +4908,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
} else {
// Unnamed classes should not have scopes (the scope will be empty).
DCHECK_EQ(block_scope->num_var_or_const(), 0);
- block_scope = nullptr;
+ block_scope = block_scope->FinalizeBlockScope();
}
return factory()->NewClassLiteral(name, block_scope, proxy, extends,

Powered by Google App Engine
This is Rietveld 408576698