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 .
This commit is contained in:
Emily Fortuna 2017-06-21 10:47:50 -07:00
parent 53e01faa43
commit a721f87f99

View file

@ -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);