Minor: extract variable
This commit is contained in:
@@ -191,27 +191,30 @@ class DebuggerClassNameProvider(val myDebugProcess: DebugProcess, val scopes: Li
|
|||||||
val context = typeMapper.bindingContext
|
val context = typeMapper.bindingContext
|
||||||
|
|
||||||
val inlineCall = runReadAction {
|
val inlineCall = runReadAction {
|
||||||
element.parents.map {
|
val parentCallsWithLambdas = element.parents.map {
|
||||||
val ktCallExpression: KtCallExpression = when(it) {
|
val ktCallExpression: KtCallExpression =
|
||||||
is KtFunctionLiteral -> {
|
when (it) {
|
||||||
val lambdaExpression = it.parent as? KtLambdaExpression
|
is KtFunctionLiteral -> {
|
||||||
// call(param, { <it> })
|
val lambdaExpression = it.parent as? KtLambdaExpression
|
||||||
lambdaExpression?.typedParent<KtValueArgument>()?.typedParent<KtValueArgumentList>()?.typedParent<KtCallExpression>() ?:
|
// call(param, { <it> })
|
||||||
|
lambdaExpression?.typedParent<KtValueArgument>()?.typedParent<KtValueArgumentList>()?.typedParent<KtCallExpression>() ?:
|
||||||
|
|
||||||
// call { <it> }
|
// call { <it> }
|
||||||
lambdaExpression?.typedParent<KtLambdaArgument>()?.typedParent<KtCallExpression>()
|
lambdaExpression?.typedParent<KtLambdaArgument>()?.typedParent<KtCallExpression>()
|
||||||
}
|
}
|
||||||
|
|
||||||
is KtNamedFunction -> {
|
is KtNamedFunction -> {
|
||||||
// call(fun () {})
|
// call(fun () {})
|
||||||
it.typedParent<KtValueArgument>()?.typedParent<KtValueArgumentList>()?.typedParent<KtCallExpression>()
|
it.typedParent<KtValueArgument>()?.typedParent<KtValueArgumentList>()?.typedParent<KtCallExpression>()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> null
|
else -> null
|
||||||
} ?: return@map null
|
} ?: return@map null
|
||||||
|
|
||||||
ktCallExpression to (it as KtElement)
|
ktCallExpression to (it as KtElement)
|
||||||
}.lastOrNull {
|
}.toList()
|
||||||
|
|
||||||
|
parentCallsWithLambdas.lastOrNull {
|
||||||
it != null && isInlineCall(context, it.component1())
|
it != null && isInlineCall(context, it.component1())
|
||||||
}?.first
|
}?.first
|
||||||
} ?: return emptyList()
|
} ?: return emptyList()
|
||||||
|
|||||||
Reference in New Issue
Block a user