From a721f87f994d713a5b605158df51215c59b40273 Mon Sep 17 00:00:00 2001 From: Emily Fortuna Date: Wed, 21 Jun 2017 10:47:50 -0700 Subject: [PATCH] More rearranging the deck chairs on the titanic. According to the comments, only closures proper have free variables. Running tests support this. So let's move it into that branch. BUG= R=sigmund@google.com Review-Url: https://codereview.chromium.org/2951923002 . --- pkg/compiler/lib/src/ssa/locals_handler.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart index b7afc131e2b..889270f4483 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);