Uast: getMaybeLightElement returns class for annotation primary constructor

This commit is contained in:
Nicolay Mitropolsky
2019-03-20 20:39:43 +03:00
parent 7b590055f8
commit 713f73e414
@@ -268,6 +268,11 @@ internal fun PsiElement.getMaybeLightElement(): PsiElement? {
val lightElement = toLightElements().firstOrNull()
if (lightElement != null) return lightElement
if (this is KtPrimaryConstructor) {
// annotations don't have constructors (but in Kotlin they do), so resolving to the class here
(this.parent as? KtClassOrObject)?.takeIf { it.isAnnotation() }?.toLightClass()?.let { return it }
}
when (val uElement = this.toUElement()) {
is UDeclaration -> uElement.javaPsi
is UDeclarationsExpression -> uElement.declarations.firstOrNull()?.javaPsi