mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "UAnnotationUtils#getContainingUAnnotationEntry: avoid expensive parent.kind call when not in the annotation"
This reverts commit 9b998539: the patch doesn't actually help to avoid analyze call, just defers it to the later phase GitOrigin-RevId: d6fbbc154e279baca46590d65684bf65183a45f8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
67f148edf0
commit
afc89639cf
@@ -96,23 +96,7 @@ fun getContainingUAnnotationEntry(uElement: UElement?): Pair<UAnnotation, String
|
||||
}
|
||||
}
|
||||
|
||||
// The sole purpose of this function is to avoid possibly expensive parent.kind call
|
||||
// inside retrievePsiAnnotationEntry above
|
||||
tailrec fun isAnnotationComponent(uElement: UElement?): Boolean {
|
||||
if (uElement == null) return false
|
||||
val parent = uElement.uastParent
|
||||
return when (parent) {
|
||||
is UAnnotation -> true
|
||||
is UReferenceExpression -> uElement is UExpression && parent.sourcePsi.toUElementOfType<UAnnotation>() != null
|
||||
is UCallExpression ->
|
||||
if (uElement is UExpression && parent.sourcePsi.toUElementOfType<UAnnotation>() != null) true
|
||||
else isAnnotationComponent(parent)
|
||||
is UPolyadicExpression, is UNamedExpression -> isAnnotationComponent(parent)
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
return if (isAnnotationComponent(uElement)) retrievePsiAnnotationEntry(uElement, null) else null
|
||||
return retrievePsiAnnotationEntry(uElement, null)
|
||||
}
|
||||
|
||||
fun getContainingAnnotationEntry(uElement: UElement?): Pair<PsiAnnotation, String?>? {
|
||||
|
||||
Reference in New Issue
Block a user