Changes inside init blocks should be considered out of block modifications

This commit is contained in:
Pavel V. Talanov
2016-01-20 15:42:55 +03:00
parent d72bc78550
commit b34a91eeaa
4 changed files with 30 additions and 0 deletions
@@ -28,6 +28,7 @@ import com.intellij.psi.impl.PsiTreeChangePreprocessor
import com.intellij.psi.util.PsiModificationTracker
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
import org.jetbrains.kotlin.psi.psiUtil.parents
/**
* Tested in OutOfBlockModificationTestGenerated
@@ -112,6 +113,7 @@ class KotlinCodeBlockModificationListener(modificationTracker: PsiModificationTr
//TODO: other types
val blockDeclaration = KtPsiUtil.getTopmostParentOfTypes(element, *BLOCK_DECLARATION_TYPES) ?: return false
if (blockDeclaration.parents.any { it !is KtClassBody && it !is KtClassOrObject && it !is KtFile }) return false // should not be local declaration
when (blockDeclaration) {
is KtNamedFunction -> {