Minor. Move recordField call into Closure.captureVariable
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.binding;
|
|||||||
import com.intellij.openapi.util.Pair;
|
import com.intellij.openapi.util.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.kotlin.codegen.StackValue;
|
||||||
import org.jetbrains.kotlin.codegen.context.EnclosedValueDescriptor;
|
import org.jetbrains.kotlin.codegen.context.EnclosedValueDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
@@ -137,7 +138,7 @@ public final class MutableClosure implements CalculatedClosure {
|
|||||||
isSuspendLambda = true;
|
isSuspendLambda = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordField(String name, Type type) {
|
private void recordField(String name, Type type) {
|
||||||
if (recordedFields == null) {
|
if (recordedFields == null) {
|
||||||
recordedFields = new LinkedList<Pair<String, Type>>();
|
recordedFields = new LinkedList<Pair<String, Type>>();
|
||||||
}
|
}
|
||||||
@@ -145,6 +146,8 @@ public final class MutableClosure implements CalculatedClosure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void captureVariable(EnclosedValueDescriptor value) {
|
public void captureVariable(EnclosedValueDescriptor value) {
|
||||||
|
recordField(value.getFieldName(), value.getType());
|
||||||
|
|
||||||
if (captureVariables == null) {
|
if (captureVariables == null) {
|
||||||
captureVariables = new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>();
|
captureVariables = new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ public interface LocalLookup {
|
|||||||
enclosedValueDescriptor = new EnclosedValueDescriptor(fieldName, d, innerValue, type);
|
enclosedValueDescriptor = new EnclosedValueDescriptor(fieldName, d, innerValue, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
closure.recordField(fieldName, type);
|
|
||||||
closure.captureVariable(enclosedValueDescriptor);
|
closure.captureVariable(enclosedValueDescriptor);
|
||||||
|
|
||||||
return innerValue;
|
return innerValue;
|
||||||
@@ -115,7 +114,6 @@ public interface LocalLookup {
|
|||||||
StackValue.StackValueWithSimpleReceiver innerValue = StackValue.field(localType, classType, fieldName, false,
|
StackValue.StackValueWithSimpleReceiver innerValue = StackValue.field(localType, classType, fieldName, false,
|
||||||
StackValue.LOCAL_0, vd);
|
StackValue.LOCAL_0, vd);
|
||||||
|
|
||||||
closure.recordField(fieldName, localType);
|
|
||||||
closure.captureVariable(new EnclosedValueDescriptor(fieldName, d, innerValue, localType));
|
closure.captureVariable(new EnclosedValueDescriptor(fieldName, d, innerValue, localType));
|
||||||
|
|
||||||
return innerValue;
|
return innerValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user