Index: src/parsing/parameter-initializer-rewriter.cc |
diff --git a/src/parsing/parameter-initializer-rewriter.cc b/src/parsing/parameter-initializer-rewriter.cc |
index cbbf8deec7997c0f1bc5665c394c848ac3676baa..6362c63f8ec65863e97ffac96f362a1e6ced4c9d 100644 |
--- a/src/parsing/parameter-initializer-rewriter.cc |
+++ b/src/parsing/parameter-initializer-rewriter.cc |
@@ -90,6 +90,10 @@ void Rewriter::VisitVariableProxy(VariableProxy* proxy) { |
if (proxy->is_resolved()) { |
Variable* var = proxy->var(); |
if (var->mode() != TEMPORARY) return; |
+ // For rewriting inside the same ClosureScope (e.g., putting default |
+ // parameter values in their own inner scope in certain cases), refrain |
+ // from invalidly moving temporaries to a block scope. |
+ if (var->scope()->ClosureScope() == new_scope_->ClosureScope()) return; |
int index = old_scope_->RemoveTemporary(var); |
if (index >= 0) { |
temps_.push_back(std::make_pair(var, index)); |