[AA] Document analyzeInDependedAnalysisSession and related classes
This commit is contained in:
committed by
Space Team
parent
ed13d6b3a4
commit
2db8f31966
@@ -73,6 +73,12 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
|
||||
override val analysisSession: KtAnalysisSession get() = this
|
||||
|
||||
/**
|
||||
* Creates a new [KtAnalysisSession] which depends on this analysis session, but additionally provides its own symbols derived from
|
||||
* analyzing [elementToReanalyze].
|
||||
*
|
||||
* @see analyzeInDependedAnalysisSession
|
||||
*/
|
||||
public abstract fun createContextDependentCopy(originalKtFile: KtFile, elementToReanalyze: KtElement): KtAnalysisSession
|
||||
|
||||
internal val smartCastProvider: KtSmartCastProvider get() = smartCastProviderImpl
|
||||
|
||||
@@ -43,11 +43,18 @@ public inline fun <R> analyze(
|
||||
return sessionProvider.analyze(useSiteKtModule, action)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executes the given [action] in the context of a [KtAnalysisSession] that depends on an original analysis session determined by
|
||||
* [originalFile]. In addition to the symbols provided by the original analysis session, the dependent analysis session provides its own
|
||||
* symbols derived from analyzing [elementToReanalyze]. This allows analyzing some new or copied (and modified) element in the larger
|
||||
* context of the original analysis session.
|
||||
*
|
||||
* @see KtAnalysisSession.createContextDependentCopy
|
||||
*/
|
||||
public inline fun <R> analyzeInDependedAnalysisSession(
|
||||
originalFile: KtFile,
|
||||
elementToReanalyze: KtElement,
|
||||
action: KtAnalysisSession.() -> R
|
||||
): R =
|
||||
KtAnalysisSessionProvider.getInstance(originalFile.project)
|
||||
.analyseInDependedAnalysisSession(originalFile, elementToReanalyze, action)
|
||||
.analyseInDependedAnalysisSession(originalFile, elementToReanalyze, action)
|
||||
|
||||
+8
@@ -32,6 +32,14 @@ import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.originalDeclaration
|
||||
|
||||
/**
|
||||
* An [LLFirResolveSession] which *depends* on an [originalFirResolveSession], but can provide its own FIR elements and symbols selectively.
|
||||
* The dependent session mostly provides FIR elements and symbols from the original resolve session, but additionally provides FIR elements
|
||||
* (and their associated symbols) from its own [ktToFirMapping].
|
||||
*
|
||||
* [LLFirResolveSessionDepended] is used by on-air resolve to provide FIR elements for a copied declaration in the larger context of the
|
||||
* original resolve session.
|
||||
*/
|
||||
internal class LLFirResolveSessionDepended(
|
||||
val originalFirResolveSession: LLFirResolvableResolveSession,
|
||||
val towerProviderBuiltUponElement: FirTowerContextProvider,
|
||||
|
||||
Reference in New Issue
Block a user