Minor. Move recordField call into Closure.captureVariable

This commit is contained in:
Denis Zharkov
2017-02-01 14:22:25 +03:00
parent 212f6e0432
commit a167539d2e
2 changed files with 4 additions and 3 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.binding;
import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.StackValue;
import org.jetbrains.kotlin.codegen.context.EnclosedValueDescriptor;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.types.KotlinType;
@@ -137,7 +138,7 @@ public final class MutableClosure implements CalculatedClosure {
isSuspendLambda = true;
}
public void recordField(String name, Type type) {
private void recordField(String name, Type type) {
if (recordedFields == null) {
recordedFields = new LinkedList<Pair<String, Type>>();
}
@@ -145,6 +146,8 @@ public final class MutableClosure implements CalculatedClosure {
}
public void captureVariable(EnclosedValueDescriptor value) {
recordField(value.getFieldName(), value.getType());
if (captureVariables == null) {
captureVariables = new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>();
}
@@ -75,7 +75,6 @@ public interface LocalLookup {
enclosedValueDescriptor = new EnclosedValueDescriptor(fieldName, d, innerValue, type);
}
closure.recordField(fieldName, type);
closure.captureVariable(enclosedValueDescriptor);
return innerValue;
@@ -115,7 +114,6 @@ public interface LocalLookup {
StackValue.StackValueWithSimpleReceiver innerValue = StackValue.field(localType, classType, fieldName, false,
StackValue.LOCAL_0, vd);
closure.recordField(fieldName, localType);
closure.captureVariable(new EnclosedValueDescriptor(fieldName, d, innerValue, localType));
return innerValue;