From e78bd73ba37424e31838c2609a0b4f1cb8c20850 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 13 Feb 2018 17:10:50 +0300 Subject: [PATCH] LeakingThisInspection: add comment about analyzeFully --- .../kotlin/idea/inspections/LeakingThisInspection.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt index 67dfc1f7938..84947be7bd1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt @@ -28,6 +28,10 @@ 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. + // 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() val leakingThisDescriptor = context.get(LEAKING_THIS, expression) ?: return@expressionVisitor val description = when (leakingThisDescriptor) {