Extracted method.
This commit is contained in:
+18
-11
@@ -234,17 +234,7 @@ public class SignaturesPropagationData {
|
|||||||
|
|
||||||
assert superFun instanceof FunctionDescriptor : superFun.getClass().getName();
|
assert superFun instanceof FunctionDescriptor : superFun.getClass().getName();
|
||||||
|
|
||||||
DeclarationDescriptor superFunContainer = superFun.getContainingDeclaration();
|
superFunctions.add(substituteSuperFunction(superclassToSupertype, (FunctionDescriptor) superFun));
|
||||||
assert superFunContainer instanceof ClassDescriptor: superFunContainer;
|
|
||||||
|
|
||||||
JetType supertype = superclassToSupertype.get(superFunContainer);
|
|
||||||
assert supertype != null : "Couldn't find super type for super function: " + superFun;
|
|
||||||
TypeSubstitutor supertypeSubstitutor = TypeSubstitutor.create(supertype);
|
|
||||||
|
|
||||||
FunctionDescriptor substitutedSuperFun = ((FunctionDescriptor) superFun).substitute(supertypeSubstitutor);
|
|
||||||
assert substitutedSuperFun != null;
|
|
||||||
|
|
||||||
superFunctions.add(substitutedSuperFun);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sorting for diagnostic stability
|
// sorting for diagnostic stability
|
||||||
@@ -663,6 +653,23 @@ public class SignaturesPropagationData {
|
|||||||
return superclassToSupertype;
|
return superclassToSupertype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static FunctionDescriptor substituteSuperFunction(
|
||||||
|
@NotNull Map<ClassDescriptor, JetType> superclassToSupertype,
|
||||||
|
@NotNull FunctionDescriptor superFun
|
||||||
|
) {
|
||||||
|
DeclarationDescriptor superFunContainer = superFun.getContainingDeclaration();
|
||||||
|
assert superFunContainer instanceof ClassDescriptor: superFunContainer;
|
||||||
|
|
||||||
|
JetType supertype = superclassToSupertype.get(superFunContainer);
|
||||||
|
assert supertype != null : "Couldn't find super type for super function: " + superFun;
|
||||||
|
TypeSubstitutor supertypeSubstitutor = TypeSubstitutor.create(supertype);
|
||||||
|
|
||||||
|
FunctionDescriptor substitutedSuperFun = superFun.substitute(supertypeSubstitutor);
|
||||||
|
assert substitutedSuperFun != null;
|
||||||
|
return substitutedSuperFun;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isArrayType(@NotNull JetType type) {
|
private static boolean isArrayType(@NotNull JetType type) {
|
||||||
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
|
||||||
return builtIns.isArray(type) || builtIns.isPrimitiveArray(type);
|
return builtIns.isArray(type) || builtIns.isPrimitiveArray(type);
|
||||||
|
|||||||
Reference in New Issue
Block a user