| 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..b80c91da0b74833d0717d27551bd243671490004 100644
|
| --- a/pkg/compiler/lib/src/js_model/closure.dart
|
| +++ b/pkg/compiler/lib/src/js_model/closure.dart
|
| @@ -253,6 +253,11 @@ class KernelScopeInfo {
|
| /// this scope.
|
| Set<ir.VariableDeclaration> freeVariables = new Set<ir.VariableDeclaration>();
|
|
|
| + /// If true, `this` is used as a free variable, in this scope. It is stored
|
| + /// separately from [freeVariables] because there is no single
|
| + /// `VariableDeclaration` node that represents `this`.
|
| + bool thisUsedAsFreeVariable = false;
|
| +
|
| KernelScopeInfo(this.hasThisLocal)
|
| : localsUsedInTryOrSync = new Set<ir.VariableDeclaration>(),
|
| boxedVariables = new Set<ir.VariableDeclaration>(),
|
| @@ -294,7 +299,11 @@ class JsScopeInfo extends ScopeInfo {
|
| this.localsUsedInTryOrSync =
|
| info.localsUsedInTryOrSync.map(localsMap.getLocalVariable).toSet(),
|
| this.freeVariables =
|
| - info.freeVariables.map(localsMap.getLocalVariable).toSet();
|
| + info.freeVariables.map(localsMap.getLocalVariable).toSet() {
|
| + if (info.thisUsedAsFreeVariable) {
|
| + this.freeVariables.add(this.thisLocal);
|
| + }
|
| + }
|
|
|
| void forEachBoxedVariable(f(Local local, FieldEntity field)) {
|
| boxedVariables.forEach((Local l, JRecordField box) {
|
|
|