Extract Function: Do not extract into lambda

This commit is contained in:
Alexey Sedunov
2014-07-04 18:21:13 +04:00
parent 0c49d48a48
commit 30192b4c40
32 changed files with 249 additions and 12 deletions
@@ -180,8 +180,9 @@ fun selectElements(
fun getContainers(element: PsiElement, strict: Boolean): List<JetElement> {
if (allContainersEnabled) return element.getAllExtractionContainers(strict)
val declaration = element.getParentByType(javaClass<JetDeclaration>(), strict)
if (declaration == null) return Collections.emptyList()
val declaration = element.getParentByType(javaClass<JetDeclaration>(), strict)?.let { declaration ->
stream(declaration) { it.getParentByType(javaClass<JetDeclaration>(), true) }.firstOrNull { it !is JetFunctionLiteral }
} ?: return Collections.emptyList()
val parent = declaration.getParent()?.let {
when (it) {