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

Unified Diff: src/parsing/parameter-initializer-rewriter.cc

Issue 1564343002: Fix for temporaries in parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/ast/variables.h ('k') | test/mjsunit/harmony/regress/regress-4658.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parameter-initializer-rewriter.cc
diff --git a/src/parsing/parameter-initializer-rewriter.cc b/src/parsing/parameter-initializer-rewriter.cc
index eaf1889392086294270d5526163d4d33c080a866..003bbebae016562d8a4e2696b0fd4e69a0920ba1 100644
--- a/src/parsing/parameter-initializer-rewriter.cc
+++ b/src/parsing/parameter-initializer-rewriter.cc
@@ -60,8 +60,14 @@ void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) {
void Rewriter::VisitVariableProxy(VariableProxy* proxy) {
- DCHECK(!proxy->is_resolved());
- if (old_scope_->RemoveUnresolved(proxy)) {
+ if (proxy->is_resolved()) {
+ Variable* var = proxy->var();
+ DCHECK_EQ(var->mode(), TEMPORARY);
+ if (old_scope_->RemoveTemporary(var)) {
+ var->set_scope(new_scope_);
+ new_scope_->AddTemporary(var);
+ }
+ } else if (old_scope_->RemoveUnresolved(proxy)) {
new_scope_->AddUnresolved(proxy);
}
}
« no previous file with comments | « src/ast/variables.h ('k') | test/mjsunit/harmony/regress/regress-4658.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698