From 6d4f860aeb4b81e9680cf27a9a813952eee55193 Mon Sep 17 00:00:00 2001 From: Nicolay Mitropolsky Date: Sat, 5 May 2018 13:13:49 +0300 Subject: [PATCH] UAST: `UastUtils.getUParentForIdentifier` cleanup --- uast/uast-common/src/org/jetbrains/uast/UastUtils.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/uast/uast-common/src/org/jetbrains/uast/UastUtils.kt b/uast/uast-common/src/org/jetbrains/uast/UastUtils.kt index 310ffffb8fae..ee40abbdb19a 100644 --- a/uast/uast-common/src/org/jetbrains/uast/UastUtils.kt +++ b/uast/uast-common/src/org/jetbrains/uast/UastUtils.kt @@ -22,7 +22,6 @@ import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.psi.* import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.annotations.ApiStatus import java.io.File inline fun UElement.getParentOfType(strict: Boolean = true): T? = getParentOfType(T::class.java, strict) @@ -176,14 +175,13 @@ fun Collection.toPsiElements() = mapNotNull { it?.psi } /** * A helper function for getting parents for given [PsiElement] that could be considered as identifier. - * Useful for working with gutter accorting to recommendations in [com.intellij.codeInsight.daemon.LineMarkerProvider]. + * Useful for working with gutter according to recommendations in [com.intellij.codeInsight.daemon.LineMarkerProvider]. + * + * @see [getUParentForAnnotationIdentifier] for working with annotations */ -@ApiStatus.Experimental fun getUParentForIdentifier(identifier: PsiElement): UElement? { val uIdentifier = identifier.toUElementOfType() ?: return null return uIdentifier.uastParent - ?: identifier.parent.toUElement() // a workaround for Kotlin < 1.2.30 which identifiers cant get parents - } /**