[Analysis API] Remove components of obsolete on-air analysis
On-air analysis only worked correctly inside declaration bodies, and
required special handling ('analyzeInDependedAnalysisSession()').
Dangling files, the on-air replacement, works seamlessly, and it is
available in all contexts.
This commit is contained in:
@@ -13,8 +13,6 @@ import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.ProjectStructureProvider
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
/**
|
||||
* [KtAnalysisSession] is the entry point to all frontend-related work. It has the following contracts:
|
||||
@@ -100,15 +98,6 @@ 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
|
||||
*/
|
||||
@Deprecated("On-air analysis is obsolete. Use 'analyzeCopy()' instead")
|
||||
public abstract fun createContextDependentCopy(originalKtFile: KtFile, elementToReanalyze: KtElement): KtAnalysisSession
|
||||
|
||||
internal val smartCastProvider: KtSmartCastProvider get() = smartCastProviderImpl
|
||||
protected abstract val smartCastProviderImpl: KtSmartCastProvider
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModuleStructureInternals
|
||||
import org.jetbrains.kotlin.analysis.project.structure.withDanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
/**
|
||||
* Executes the given [action] in a [KtAnalysisSession] context.
|
||||
@@ -46,32 +45,6 @@ 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
|
||||
*/
|
||||
@Deprecated(
|
||||
"On-air analysis is obsolete. Use 'analyzeCopy()' instead",
|
||||
ReplaceWith(
|
||||
"analyzeCopy(elementToReanalyze, DanglingFileResolutionMode.IGNORE.SELF)",
|
||||
imports = [
|
||||
"org.jetbrains.kotlin.analysis.api.analyzeCopy",
|
||||
"org.jetbrains.kotlin.analysis.project.structure.DanglingFileResolutionMode"
|
||||
]
|
||||
)
|
||||
)
|
||||
public inline fun <R> analyzeInDependedAnalysisSession(
|
||||
@Suppress("unused", "UNUSED_PARAMETER") originalFile: KtFile,
|
||||
elementToReanalyze: KtElement,
|
||||
crossinline action: KtAnalysisSession.() -> R
|
||||
): R {
|
||||
return analyzeCopy(elementToReanalyze, DanglingFileResolutionMode.IGNORE_SELF, action)
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given [action] in a [KtAnalysisSession] context.
|
||||
* Depending on the passed [resolutionMode], declarations inside a file copy will be treated in a specific way.
|
||||
|
||||
-18
@@ -39,24 +39,6 @@ public abstract class KtAnalysisSessionProvider(public val project: Project) : D
|
||||
|
||||
public abstract fun getAnalysisSessionByUseSiteKtModule(useSiteKtModule: KtModule): KtAnalysisSession
|
||||
|
||||
@Deprecated(
|
||||
"On-air analysis is obsolete. Use 'analyzeCopy()' instead",
|
||||
replaceWith = ReplaceWith(
|
||||
"analyzeCopy(elementToReanalyze, DanglingFileAnalysisMode.IGNORE_SELF, action)",
|
||||
imports = [
|
||||
"org.jetbrains.kotlin.analysis.api.analyzeCopy",
|
||||
"org.jetbrains.kotlin.analysis.project.structure.DanglingFileResolutionMode"
|
||||
]
|
||||
)
|
||||
)
|
||||
public inline fun <R> analyseInDependedAnalysisSession(
|
||||
@Suppress("unused", "UNUSED_PARAMETER") originalFile: KtFile,
|
||||
elementToReanalyze: KtElement,
|
||||
crossinline action: KtAnalysisSession.() -> R,
|
||||
): R {
|
||||
return analyzeCopy(elementToReanalyze, DanglingFileResolutionMode.IGNORE_SELF, action)
|
||||
}
|
||||
|
||||
public inline fun <R> analyse(
|
||||
useSiteKtElement: KtElement,
|
||||
action: KtAnalysisSession.() -> R,
|
||||
|
||||
Reference in New Issue
Block a user