Minor refactoring in delegate codegen
This commit is contained in:
@@ -794,16 +794,16 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
}
|
||||
}
|
||||
|
||||
public void genDelegate(FunctionDescriptor functionDescriptor, CallableMemberDescriptor overriddenDescriptor, StackValue field) {
|
||||
genDelegate(functionDescriptor, overriddenDescriptor, field,
|
||||
public void genDelegate(FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenDescriptor, StackValue field) {
|
||||
genDelegate(functionDescriptor, (ClassDescriptor) overriddenDescriptor.getContainingDeclaration(), field,
|
||||
typeMapper.mapSignature(functionDescriptor.getName(), functionDescriptor),
|
||||
typeMapper.mapSignature(overriddenDescriptor.getName(), (FunctionDescriptor) overriddenDescriptor.getOriginal())
|
||||
typeMapper.mapSignature(overriddenDescriptor.getName(), overriddenDescriptor.getOriginal())
|
||||
);
|
||||
}
|
||||
|
||||
public void genDelegate(
|
||||
CallableMemberDescriptor functionDescriptor,
|
||||
CallableMemberDescriptor overriddenDescriptor,
|
||||
FunctionDescriptor functionDescriptor,
|
||||
ClassDescriptor toClass,
|
||||
StackValue field,
|
||||
JvmMethodSignature jvmDelegateMethodSignature,
|
||||
JvmMethodSignature jvmOverriddenMethodSignature
|
||||
@@ -832,10 +832,8 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
reg += argTypes[i].getSize();
|
||||
}
|
||||
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) overriddenDescriptor.getContainingDeclaration();
|
||||
String internalName =
|
||||
state.getTypeMapper().mapType(classDescriptor).getInternalName();
|
||||
if (classDescriptor.getKind() == ClassKind.TRAIT) {
|
||||
String internalName = typeMapper.mapType(toClass).getInternalName();
|
||||
if (toClass.getKind() == ClassKind.TRAIT) {
|
||||
iv.invokeinterface(internalName, overriddenMethod.getName(), overriddenMethod.getDescriptor());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1542,8 +1542,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
propertyCodegen
|
||||
.genDelegate((PropertyDescriptor) declaration, (PropertyDescriptor) overriddenDescriptor, field);
|
||||
}
|
||||
else if (declaration instanceof SimpleFunctionDescriptor) {
|
||||
functionCodegen.genDelegate((SimpleFunctionDescriptor) declaration, overriddenDescriptor, field);
|
||||
else if (declaration instanceof FunctionDescriptor) {
|
||||
functionCodegen
|
||||
.genDelegate((FunctionDescriptor) declaration, (FunctionDescriptor) overriddenDescriptor, field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,14 +342,16 @@ public class PropertyCodegen extends GenerationStateAware {
|
||||
}
|
||||
|
||||
public void genDelegate(PropertyDescriptor declaration, PropertyDescriptor overriddenDescriptor, StackValue field) {
|
||||
ClassDescriptor toClass = (ClassDescriptor) overriddenDescriptor.getContainingDeclaration();
|
||||
|
||||
JvmMethodSignature getterSignature =
|
||||
typeMapper.mapGetterSignature(declaration.getOriginal(), OwnerKind.IMPLEMENTATION).getJvmMethodSignature();
|
||||
functionCodegen.genDelegate(declaration, overriddenDescriptor, field, getterSignature, getterSignature);
|
||||
functionCodegen.genDelegate(declaration.getGetter(), toClass, field, getterSignature, getterSignature);
|
||||
|
||||
if (declaration.isVar()) {
|
||||
JvmMethodSignature setterSignature =
|
||||
typeMapper.mapSetterSignature(declaration.getOriginal(), OwnerKind.IMPLEMENTATION).getJvmMethodSignature();
|
||||
functionCodegen.genDelegate(declaration, overriddenDescriptor, field, setterSignature, setterSignature);
|
||||
functionCodegen.genDelegate(declaration.getSetter(), toClass, field, setterSignature, setterSignature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user