Index: pkg/compiler/lib/src/js_model/closure.dart |
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart |
index 0d9a9df1764227379ffeda3a30605821a994d4bf..61cc575f151c06307dee6954abcabd24fc2e6ba7 100644 |
--- a/pkg/compiler/lib/src/js_model/closure.dart |
+++ b/pkg/compiler/lib/src/js_model/closure.dart |
@@ -293,8 +293,15 @@ class JsScopeInfo extends ScopeInfo { |
info.hasThisLocal ? new ThisLocal(localsMap.currentMember) : null, |
this.localsUsedInTryOrSync = |
info.localsUsedInTryOrSync.map(localsMap.getLocalVariable).toSet(), |
- this.freeVariables = |
- info.freeVariables.map(localsMap.getLocalVariable).toSet(); |
+ this.freeVariables = new Set<Local>() { |
+ for (var variable in info.freeVariables) { |
+ if (variable is ThisVariable) { |
+ freeVariables.add(thisLocal); |
+ } else { |
+ freeVariables.add(localsMap.getLocalVariable(variable)); |
+ } |
+ } |
+ } |
void forEachBoxedVariable(f(Local local, FieldEntity field)) { |
boxedVariables.forEach((Local l, JRecordField box) { |