diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt index 39dea83a0ad..b7ba57f61f7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt @@ -255,22 +255,6 @@ public fun JetElement.getQualifiedElementSelector(): JetElement? { } } -/** - * Returns outermost qualified element ([[JetQualifiedExpression]] or [[JetUserType]]) in the non-interleaving chain - * of qualified elements which enclose given expression - * If there is no such elements original expression is returned - */ -public fun JetSimpleNameExpression.getOutermostNonInterleavingQualifiedElement(): JetElement { - var element = ((getParent() as? JetCallExpression) ?: this).getParent() - if (element !is JetQualifiedExpression && element !is JetUserType) return this - - while (true) { - val parent = element!!.getParent() - if (parent !is JetQualifiedExpression && parent !is JetUserType) return element as JetElement - element = parent - } -} - public fun PsiDirectory.getPackage(): PsiPackage? = JavaDirectoryService.getInstance()!!.getPackage(this) public fun JetModifierListOwner.isPrivate(): Boolean = hasModifier(JetTokens.PRIVATE_KEYWORD) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt index ecf04c20c90..0251d529bbb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/psiUtils.kt @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.psi.psiUtil -import com.intellij.lang.ASTNode import com.intellij.openapi.util.TextRange import com.intellij.psi.* import com.intellij.psi.search.PsiSearchScopeUtil @@ -39,22 +38,11 @@ public fun PsiElement.siblings(forward: Boolean = true, withItself: Boolean = tr return if (withItself) sequence else sequence.drop(1) } -public fun ASTNode.siblings(forward: Boolean = true, withItself: Boolean = true): Sequence { - val stepFun = if (forward) { node: ASTNode -> node.getTreeNext() } else { e: ASTNode -> e.getTreeNext() } - val sequence = sequence(this, stepFun) - return if (withItself) sequence else sequence.drop(1) -} - public fun PsiElement.parents(withItself: Boolean = true): Sequence { val sequence = sequence(this) { if (it is PsiFile) null else it.getParent() } return if (withItself) sequence else sequence.drop(1) } -public fun ASTNode.parents(withItself: Boolean = true): Sequence { - val sequence = sequence(this) { it.getTreeParent() } - return if (withItself) sequence else sequence.drop(1) -} - public fun PsiElement.prevLeaf(skipEmptyElements: Boolean = false): PsiElement? = PsiTreeUtil.prevLeaf(this, skipEmptyElements)