Extracted method.

This commit is contained in:
Evgeny Gerashchenko
2013-02-15 20:40:09 +04:00
parent 48113f036f
commit 30afc99ccf
@@ -234,17 +234,7 @@ public class SignaturesPropagationData {
assert superFun instanceof FunctionDescriptor : superFun.getClass().getName();
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 = ((FunctionDescriptor) superFun).substitute(supertypeSubstitutor);
assert substitutedSuperFun != null;
superFunctions.add(substitutedSuperFun);
superFunctions.add(substituteSuperFunction(superclassToSupertype, (FunctionDescriptor) superFun));
}
// sorting for diagnostic stability
@@ -663,6 +653,23 @@ public class SignaturesPropagationData {
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) {
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
return builtIns.isArray(type) || builtIns.isPrimitiveArray(type);