Refactoring: remove usages of analyzeFully
Function isn't removed because it has usages from other plugins
This commit is contained in:
@@ -14,7 +14,7 @@ import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.search.searches.DefinitionsScopedSearch
|
||||
import org.jetbrains.kotlin.cfg.LeakingThisDescriptor.*
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks
|
||||
import org.jetbrains.kotlin.idea.quickfix.AddModifierFix
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtClass
|
||||
@@ -28,11 +28,12 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
class LeakingThisInspection : AbstractKotlinInspection() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
|
||||
return expressionVisitor { expression ->
|
||||
// We still use analyzeFully() here.
|
||||
// We still use analyzeWithAllCompilerChecks() here.
|
||||
// It's possible to use analyze(), but then we should repeat class constructor consistency check
|
||||
// for different class internal elements, like KtProperty and KtClassInitializer.
|
||||
// It can affect performance, so yet we want to avoid this.
|
||||
val context = expression.analyzeFully()
|
||||
@Suppress("DEPRECATION")
|
||||
val context = expression.analyzeWithAllCompilerChecks().bindingContext
|
||||
val leakingThisDescriptor = context.get(LEAKING_THIS, expression) ?: return@expressionVisitor
|
||||
val description = when (leakingThisDescriptor) {
|
||||
is NonFinalClass ->
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.asJava.unwrapped
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
@@ -191,7 +191,8 @@ fun KtElement.processInternalReferencesToUpdateOnPackageNameChange(
|
||||
return null
|
||||
}
|
||||
|
||||
val bindingContext = analyzeFully()
|
||||
@Suppress("DEPRECATION")
|
||||
val bindingContext = analyzeWithAllCompilerChecks().bindingContext
|
||||
forEachDescendantOfType<KtReferenceExpression> { refExpr ->
|
||||
if (refExpr !is KtSimpleNameExpression || refExpr.parent is KtThisExpression) return@forEachDescendantOfType
|
||||
|
||||
|
||||
Reference in New Issue
Block a user