Rename: Fix processing of functions without light methods

#KT-22461 Fixed
This commit is contained in:
Alexey Sedunov
2018-01-24 13:25:22 +03:00
parent 245d1de2a2
commit 80643c5603
7 changed files with 53 additions and 12 deletions
@@ -198,14 +198,17 @@ fun PsiClass.forEachDeclaredMemberOverride(processor: (superMember: PsiElement,
forEachKotlinOverride(ktClass, members, scope, processor)
}
fun findDeepestSuperMethodsKotlinAware(method: PsiElement): List<PsiMethod> {
fun findDeepestSuperMethodsNoWrapping(method: PsiElement): List<PsiElement> {
val element = method.unwrapped
return when (element) {
is PsiMethod -> element.findDeepestSuperMethods().toList()
is KtCallableDeclaration -> {
val descriptor = element.resolveToDescriptorIfAny() as? CallableMemberDescriptor ?: return emptyList()
descriptor.getDeepestSuperDeclarations(false).mapNotNull { it.source.getPsi()?.getRepresentativeLightMethod() }
descriptor.getDeepestSuperDeclarations(false).mapNotNull { it.source.getPsi() }
}
else -> emptyList()
}
}
}
fun findDeepestSuperMethodsKotlinAware(method: PsiElement) =
findDeepestSuperMethodsNoWrapping(method).mapNotNull { it.getRepresentativeLightMethod() }