FIR/UAST: move multi resolve utils/APIs to the base module/service
This commit is contained in:
committed by
TeamCityServer
parent
e870bf7399
commit
77e8aed995
+2
@@ -19,6 +19,8 @@ interface BaseKotlinUastResolveProviderService {
|
||||
|
||||
fun convertParent(uElement: UElement): UElement?
|
||||
|
||||
fun getReferenceVariants(ktExpression: KtExpression, nameHint: String): Sequence<PsiElement>
|
||||
|
||||
fun resolveToDeclaration(ktExpression: KtExpression): PsiElement?
|
||||
|
||||
fun resolveToType(ktTypeReference: KtTypeReference, source: UElement): PsiType?
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.kotlin.internal
|
||||
|
||||
import com.intellij.psi.PsiSubstitutor
|
||||
import com.intellij.psi.ResolveResult
|
||||
import com.intellij.psi.infos.CandidateInfo
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.uast.kotlin.BaseKotlinUastResolveProviderService
|
||||
|
||||
fun getResolveResultVariants(
|
||||
baseKotlinUastResolveProviderService: BaseKotlinUastResolveProviderService,
|
||||
ktExpression: KtExpression?
|
||||
): Iterable<ResolveResult> {
|
||||
ktExpression ?: return emptyList()
|
||||
|
||||
val referenceVariants = baseKotlinUastResolveProviderService.getReferenceVariants(ktExpression, ktExpression.name ?: ktExpression.text)
|
||||
|
||||
return referenceVariants.mapNotNull { CandidateInfo(it, PsiSubstitutor.EMPTY) }.asIterable()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user