Postpone counting light elements till all psi checks done
This commit is contained in:
+15
-8
@@ -110,17 +110,24 @@ class KotlinOverridingMethodReferenceSearcher : MethodUsagesSearcher() {
|
||||
return true
|
||||
}
|
||||
|
||||
var lightMethods = refElement.toLightMethods()
|
||||
fun countNonFinalLightMethods() = refElement
|
||||
.toLightMethods()
|
||||
.filterNot { it.hasModifierProperty(PsiModifier.FINAL) }
|
||||
.ifEmpty { return true }
|
||||
if (refElement is KtProperty || refElement is KtParameter) {
|
||||
if (isWrongAccessorReference()) return true
|
||||
lightMethods = lightMethods.filter { JvmAbi.isGetterName(it.name) == isGetter }
|
||||
}
|
||||
if (refElement is KtNamedFunction) {
|
||||
lightMethods = lightMethods.filter { it.name == method.name }
|
||||
|
||||
val lightMethods = when (refElement) {
|
||||
is KtProperty, is KtParameter -> {
|
||||
if (isWrongAccessorReference()) return true
|
||||
countNonFinalLightMethods().filter { JvmAbi.isGetterName(it.name) == isGetter }
|
||||
}
|
||||
|
||||
is KtNamedFunction ->
|
||||
countNonFinalLightMethods().filter { it.name == method.name }
|
||||
|
||||
else ->
|
||||
countNonFinalLightMethods()
|
||||
}
|
||||
|
||||
|
||||
return lightMethods.all { super.processInexactReference(ref, it, method, consumer) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user