mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IDEA-CR-57967 UAST: store empty list for uastByUsageReferenceProvider if there are no usages
GitOrigin-RevId: d4d997a520aeed00f2c4a8332f4abbf2b4ca0b51
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9afc0f753f
commit
9a7be4f1d0
@@ -132,7 +132,8 @@ fun PsiReferenceRegistrar.registerByUsageReferenceProvider(expressionPattern: UE
|
||||
val parentVariable = element.uastParent as? UVariable ?: return emptyArray()
|
||||
|
||||
val usage = getDirectVariableUsages(parentVariable).find { usage ->
|
||||
usagePattern.accepts(usage, context)
|
||||
val refExpression = usage.toUElementOfType<UReferenceExpression>()
|
||||
refExpression != null && usagePattern.accepts(refExpression, context)
|
||||
}
|
||||
|
||||
if (usage == null) return emptyArray()
|
||||
@@ -192,5 +193,5 @@ private fun findDirectVariableUsages(variablePsi: PsiElement): List<PsiElement>
|
||||
true
|
||||
}
|
||||
|
||||
return usages
|
||||
return if (usages.isEmpty()) emptyList() else usages
|
||||
}
|
||||
Reference in New Issue
Block a user