Index: pkg/compiler/lib/src/ssa/locals_handler.dart |
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart |
index b7afc131e2b69c8467613eb2789a9060ae322970..889270f448362c5fa1e6f3eedab002916240d0d1 100644 |
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart |
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart |
@@ -223,13 +223,13 @@ class LocalsHandler { |
enterScope(scopeData, |
forGenerativeConstructorBody: isGenerativeConstructorBody); |
- // If the freeVariableMapping is not empty, then this function was a |
- // nested closure that captures variables. Redirect the captured |
- // variables to fields in the closure. |
- closureData.forEachFreeVariable((Local from, FieldEntity to) { |
- redirectElement(from, to); |
- }); |
if (closureData.isClosure) { |
+ // If the freeVariableMapping is not empty, then this function was a |
+ // nested closure that captures variables. Redirect the captured |
+ // variables to fields in the closure. |
+ closureData.forEachFreeVariable((Local from, FieldEntity to) { |
+ redirectElement(from, to); |
+ }); |
// Inside closure redirect references to itself to [:this:]. |
HThis thisInstruction = |
new HThis(closureData.thisLocal, commonMasks.nonNullType); |