Analysis API: add KtReference..Provider to fix reference resolve in FE10
This commit is contained in:
@@ -139,6 +139,9 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
internal val analysisScopeProvider: KtAnalysisScopeProvider get() = analysisScopeProviderImpl
|
||||
protected abstract val analysisScopeProviderImpl: KtAnalysisScopeProvider
|
||||
|
||||
internal val referenceResolveProvider: KtReferenceResolveProvider get() = referenceResolveProviderImpl
|
||||
protected abstract val referenceResolveProviderImpl: KtReferenceResolveProvider
|
||||
|
||||
@PublishedApi
|
||||
internal val typesCreator: KtTypeCreator
|
||||
get() = typesCreatorImpl
|
||||
|
||||
+1
-4
@@ -5,18 +5,15 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.components
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtSymbolBasedReference
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.idea.references.KtReference
|
||||
|
||||
public interface KtReferenceResolveMixIn : KtAnalysisSessionMixIn {
|
||||
public fun KtReference.resolveToSymbols(): Collection<KtSymbol> {
|
||||
check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference" }
|
||||
return analysisSession.resolveToSymbols()
|
||||
return analysisSession.referenceResolveProvider.resolveToSymbols(this)
|
||||
}
|
||||
|
||||
public fun KtReference.resolveToSymbol(): KtSymbol? {
|
||||
check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference but was ${this::class}" }
|
||||
return resolveToSymbols().singleOrNull()
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.kotlin.analysis.api.components
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.idea.references.KtReference
|
||||
|
||||
public abstract class KtReferenceResolveProvider {
|
||||
public abstract fun resolveToSymbols(reference: KtReference): Collection<KtSymbol>
|
||||
}
|
||||
Reference in New Issue
Block a user