Refactoring: remove usages of analyzeFully
Function isn't removed because it has usages from other plugins
This commit is contained in:
@@ -128,21 +128,30 @@ fun KtDeclaration.analyzeWithContent(): BindingContext =
|
||||
inline fun <reified T> T.analyzeWithContent(): BindingContext where T : KtDeclarationContainer, T : KtElement =
|
||||
getResolutionFacade().analyzeWithAllCompilerChecks(listOf(this)).bindingContext
|
||||
|
||||
// NB: for statements / expressions, usually should be replaced with analyze(),
|
||||
// for declarations, analyzeWithContent() will do what you want.
|
||||
@Deprecated(
|
||||
"Use analyzeWithContent() instead, or use just analyze()",
|
||||
ReplaceWith("analyze()")
|
||||
)
|
||||
fun KtElement.analyzeFully(): BindingContext = getResolutionFacade().analyzeWithAllCompilerChecks(listOf(this)).bindingContext
|
||||
|
||||
// This and next function are expected to produce the same result as compiler
|
||||
// for the given element and its children (including diagnostics, trace slices, descriptors, etc.)
|
||||
// Not recommended to call both of them without real need
|
||||
// See also KotlinResolveCache, KotlinResolveDataProvider
|
||||
/**
|
||||
* This function is expected to produce the same result as compiler for the whole file content (including diagnostics,
|
||||
* trace slices, descriptors, etc.).
|
||||
*
|
||||
* It's not recommended to call this function without real need.
|
||||
*
|
||||
* @ref [KotlinCacheService]
|
||||
* @ref [org.jetbrains.kotlin.idea.caches.resolve.PerFileAnalysisCache]
|
||||
*/
|
||||
fun KtFile.analyzeWithAllCompilerChecks(vararg extraFiles: KtFile): AnalysisResult =
|
||||
KotlinCacheService.getInstance(project).getResolutionFacade(listOf(this) + extraFiles.toList()).analyzeWithAllCompilerChecks(listOf(this))
|
||||
|
||||
/**
|
||||
* This function is expected to produce the same result as compiler for the given element and its children (including diagnostics,
|
||||
* trace slices, descriptors, etc.). For some expression element it actually performs analyze for some parent (usually declaration).
|
||||
*
|
||||
* It's not recommended to call this function without real need.
|
||||
*
|
||||
* NB: for statements / expressions, usually should be replaced with analyze(),
|
||||
* for declarations, analyzeWithContent() will do what you want.
|
||||
*
|
||||
* @ref [KotlinCacheService]
|
||||
* @ref [org.jetbrains.kotlin.idea.caches.resolve.PerFileAnalysisCache]
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use either KtFile.analyzeWithAllCompilerChecks() or KtElement.analyzeAndGetResult()",
|
||||
ReplaceWith("analyzeAndGetResult()")
|
||||
@@ -158,4 +167,12 @@ fun ResolutionFacade.resolveImportReference(
|
||||
val qualifiedExpressionResolver = this.getFrontendService(moduleDescriptor, QualifiedExpressionResolver::class.java)
|
||||
return qualifiedExpressionResolver.processImportReference(
|
||||
importDirective, moduleDescriptor, BindingTraceContext(), excludedImportNames = emptyList(), packageFragmentForVisibilityCheck = null)?.getContributedDescriptors() ?: emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"This method is going to be removed in 1.3.0 release",
|
||||
ReplaceWith("analyzeWithAllCompilerChecks().bindingContext"),
|
||||
DeprecationLevel.ERROR
|
||||
)
|
||||
fun KtElement.analyzeFully(): BindingContext = analyzeWithAllCompilerChecks().bindingContext
|
||||
Reference in New Issue
Block a user