From 30afc99ccfd040ff3c93e885b7015943b338a8eb Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Fri, 15 Feb 2013 20:40:09 +0400 Subject: [PATCH] Extracted method. --- .../SignaturesPropagationData.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java index cfbc80a03e3..2f8f9fb8945 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java @@ -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 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);