Postpone counting light elements till all psi checks done

This commit is contained in:
Nikolay Krasko
2017-06-30 16:19:53 +03:00
parent fe17d616b9
commit 25109671b1
@@ -110,17 +110,24 @@ class KotlinOverridingMethodReferenceSearcher : MethodUsagesSearcher() {
return true return true
} }
var lightMethods = refElement.toLightMethods() fun countNonFinalLightMethods() = refElement
.toLightMethods()
.filterNot { it.hasModifierProperty(PsiModifier.FINAL) } .filterNot { it.hasModifierProperty(PsiModifier.FINAL) }
.ifEmpty { return true }
if (refElement is KtProperty || refElement is KtParameter) { val lightMethods = when (refElement) {
if (isWrongAccessorReference()) return true is KtProperty, is KtParameter -> {
lightMethods = lightMethods.filter { JvmAbi.isGetterName(it.name) == isGetter } if (isWrongAccessorReference()) return true
} countNonFinalLightMethods().filter { JvmAbi.isGetterName(it.name) == isGetter }
if (refElement is KtNamedFunction) { }
lightMethods = lightMethods.filter { it.name == method.name }
is KtNamedFunction ->
countNonFinalLightMethods().filter { it.name == method.name }
else ->
countNonFinalLightMethods()
} }
return lightMethods.all { super.processInexactReference(ref, it, method, consumer) } return lightMethods.all { super.processInexactReference(ref, it, method, consumer) }
} }
} }