Remove CodegenBinding.LOCAL_VARIABLE_DELEGATE
Calculate this value at call sites explicitly instead
This commit is contained in:
-11
@@ -379,17 +379,6 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
KotlinType delegateType = JvmCodegenUtil.getPropertyDelegateType(variableDescriptor, bindingContext);
|
||||
if (delegateType == null) return;
|
||||
|
||||
LocalVariableDescriptor delegateVariableDescriptor = new LocalVariableDescriptor(
|
||||
variableDescriptor.getContainingDeclaration(),
|
||||
Annotations.Companion.getEMPTY(),
|
||||
variableDescriptor.getName(),
|
||||
delegateType,
|
||||
false,
|
||||
false,
|
||||
SourceElement.NO_SOURCE
|
||||
);
|
||||
bindingTrace.record(LOCAL_VARIABLE_DELEGATE, variableDescriptor, delegateVariableDescriptor);
|
||||
|
||||
LocalVariableDescriptor metadataVariableDescriptor = new LocalVariableDescriptor(
|
||||
variableDescriptor.getContainingDeclaration(),
|
||||
Annotations.Companion.getEMPTY(),
|
||||
|
||||
@@ -60,9 +60,6 @@ public class CodegenBinding {
|
||||
public static final WritableSlice<String, List<WhenByEnumsMapping>> MAPPINGS_FOR_WHENS_BY_ENUM_IN_CLASS_FILE =
|
||||
Slices.createSimpleSlice();
|
||||
|
||||
public static final WritableSlice<VariableDescriptor, VariableDescriptor> LOCAL_VARIABLE_DELEGATE =
|
||||
Slices.createSimpleSlice();
|
||||
|
||||
public static final WritableSlice<VariableDescriptor, VariableDescriptor> LOCAL_VARIABLE_PROPERTY_METADATA =
|
||||
Slices.createSimpleSlice();
|
||||
|
||||
|
||||
@@ -55,9 +55,12 @@ public interface LocalLookup {
|
||||
boolean idx = localLookup != null && localLookup.lookupLocal(vd);
|
||||
if (!idx) return null;
|
||||
|
||||
VariableDescriptor delegateVariableDescriptor = state.getBindingContext().get(LOCAL_VARIABLE_DELEGATE, vd);
|
||||
KotlinType delegateType =
|
||||
vd instanceof VariableDescriptorWithAccessors
|
||||
? JvmCodegenUtil.getPropertyDelegateType((VariableDescriptorWithAccessors) vd, state.getBindingContext())
|
||||
: null;
|
||||
Type sharedVarType = state.getTypeMapper().getSharedVarType(vd);
|
||||
Type localType = state.getTypeMapper().mapType(delegateVariableDescriptor != null ? delegateVariableDescriptor : vd);
|
||||
Type localType = state.getTypeMapper().mapType(delegateType != null ? delegateType : vd.getType());
|
||||
Type type = sharedVarType != null ? sharedVarType : localType;
|
||||
|
||||
String fieldName = "$" + vd.getName();
|
||||
|
||||
@@ -1392,11 +1392,11 @@ public class KotlinTypeMapper {
|
||||
Type sharedVarType = getSharedVarType(variableDescriptor);
|
||||
if (sharedVarType == null) {
|
||||
if (isDelegatedLocalVariable(variableDescriptor)) {
|
||||
VariableDescriptor delegateVariableDescriptor = bindingContext.get(LOCAL_VARIABLE_DELEGATE,
|
||||
(VariableDescriptor) variableDescriptor);
|
||||
assert delegateVariableDescriptor != null :
|
||||
"Local delegated property " + variableDescriptor + " delegate descriptor should be not null";
|
||||
sharedVarType = mapType(delegateVariableDescriptor.getType());
|
||||
//noinspection CastConflictsWithInstanceof
|
||||
KotlinType delegateType =
|
||||
JvmCodegenUtil.getPropertyDelegateType((LocalVariableDescriptor) variableDescriptor, bindingContext);
|
||||
assert delegateType != null : "Local delegated property type should not be null: " + variableDescriptor;
|
||||
sharedVarType = mapType(delegateType);
|
||||
}
|
||||
else {
|
||||
sharedVarType = mapType(((VariableDescriptor) variableDescriptor).getType());
|
||||
|
||||
Reference in New Issue
Block a user