File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/kotlin/com/interfaced/brs/lang/psi Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,16 @@ import com.intellij.psi.search.GlobalSearchScope
99import com.intellij.util.indexing.FileBasedIndex
1010import com.interfaced.brs.lang.BrsFileType
1111import com.intellij.psi.util.PsiTreeUtil
12- import com.intellij.psi.util.parentOfType
1312
1413class BrsUtil {
1514 companion object {
1615 private inline fun <reified T : PsiElement > getChildrenFromFiles (files : List <PsiFile >): List <Array <T >> {
1716 return files.mapNotNull { PsiTreeUtil .getChildrenOfType(it, T ::class .java) }
1817 }
1918
19+ private inline fun <reified T : PsiElement > PsiElement.ancestorOfType (): T ? =
20+ PsiTreeUtil .getParentOfType(this , T ::class .java, /* strict */ false )
21+
2022 fun isPropertyIdentifier (element : PsiElement ): Boolean {
2123 val prevSibling = element.prevSibling
2224
@@ -51,11 +53,11 @@ class BrsUtil {
5153 }
5254
5355 fun getOwnedFunction (element : PsiElement ): BrsFunctionStmt ? {
54- return element.parentOfType ()
56+ return element.ancestorOfType ()
5557 }
5658
5759 fun getOwnedSub (element : PsiElement ): BrsSubStmt ? {
58- return element.parentOfType ()
60+ return element.ancestorOfType ()
5961 }
6062 }
6163}
You can’t perform that action at this time.
0 commit comments