mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Fix compatibility problem with 2020.3
This commit is contained in:
parent
5e95cdd5b0
commit
9cf459ec89
@ -10,17 +10,12 @@
|
||||
package net.mamoe.mirai.console.intellij.resolve
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementFactory
|
||||
import com.intellij.psi.PsiModifierListOwner
|
||||
import com.intellij.psi.util.parents
|
||||
import com.intellij.psi.*
|
||||
import net.mamoe.mirai.console.compiler.common.resolve.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
|
||||
import org.jetbrains.kotlin.idea.refactoring.fqName.fqName
|
||||
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
|
||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.references.resolveToDescriptors
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@ -31,7 +26,6 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.referenceExpression
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue
|
||||
@ -76,6 +70,15 @@ val KtPureClassOrObject.allSuperTypes: Sequence<KtSuperTypeListEntry>
|
||||
}
|
||||
}
|
||||
|
||||
fun PsiElement.parents(withSelf: Boolean): Sequence<PsiElement> {
|
||||
val seed = if (withSelf) this else parentWithoutWalkingDirectories(this)
|
||||
return generateSequence(seed, ::parentWithoutWalkingDirectories)
|
||||
}
|
||||
|
||||
private fun parentWithoutWalkingDirectories(element: PsiElement): PsiElement? {
|
||||
return if (element is PsiFile) null else element.parent
|
||||
}
|
||||
|
||||
val PsiClass.allSuperTypes: Sequence<PsiClass>
|
||||
get() = sequence {
|
||||
interfaces.forEach {
|
||||
|
Loading…
Reference in New Issue
Block a user