FIR IDE: Make KtFirReference implement KtSymbolBasedReference
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
This commit is contained in:
committed by
Ilya Kirillov
parent
2eb439899e
commit
a4a2d92c08
+1
-1
@@ -19,6 +19,6 @@ fun KtReference.resolveToSymbols(analysisSession: KtAnalysisSession): Collection
|
||||
}
|
||||
|
||||
fun KtSimpleReference<*>.resolveToSymbol(analysisSession: KtAnalysisSession): KtSymbol? {
|
||||
check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference" }
|
||||
check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference but was ${this::class}" }
|
||||
return resolveToSymbols(analysisSession).singleOrNull()
|
||||
}
|
||||
@@ -7,11 +7,10 @@ package org.jetbrains.kotlin.idea.references
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtSymbolBasedReference
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol
|
||||
|
||||
interface KtFirReference : KtReference {
|
||||
fun resolveToSymbols(analysisSession: KtAnalysisSession): Collection<KtSymbol>
|
||||
|
||||
interface KtFirReference : KtReference, KtSymbolBasedReference {
|
||||
fun getResolvedToPsi(analysisSession: KtAnalysisSession): Collection<PsiElement> =
|
||||
resolveToSymbols(analysisSession).mapNotNull(KtSymbol::psi)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user