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..978fa740f62e01e6163644a1d8554fbf85d46919 100644 |
--- a/src/parsing/parameter-initializer-rewriter.cc |
+++ b/src/parsing/parameter-initializer-rewriter.cc |
@@ -60,8 +60,16 @@ void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) { |
void Rewriter::VisitVariableProxy(VariableProxy* proxy) { |
- DCHECK(!proxy->is_resolved()); |
- if (old_scope_->RemoveUnresolved(proxy)) { |
+ // TODO(nikolaos): This is the point that I'm not sure whether I have |
+ // done the right thing (changing the scope of temporary variables). |
+ 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); |
} |
} |