FIR: fix lambda labeling in light tree builder

This commit is contained in:
Mikhail Glukhikh
2020-04-20 16:58:47 +03:00
parent 29114fe7b5
commit 42de83c21a
@@ -128,9 +128,8 @@ class ExpressionsConverter(
}
}
val labelName = lambdaExpression.getLabelName() ?: context.firFunctionCalls.lastOrNull()?.calleeReference?.name?.asString()
val target = FirFunctionTarget(labelName = labelName, isLambda = true)
val expressionSource = lambdaExpression.toFirSourceElement()
val target: FirFunctionTarget
return buildAnonymousFunction {
source = expressionSource
session = baseSession
@@ -138,6 +137,10 @@ class ExpressionsConverter(
receiverTypeRef = implicitType
symbol = FirAnonymousFunctionSymbol()
isLambda = true
label = context.firLabels.pop() ?: context.firFunctionCalls.lastOrNull()?.calleeReference?.name?.let {
buildLabel { name = it.asString() }
}
target = FirFunctionTarget(labelName = label?.name, isLambda = true)
context.firFunctionTargets += target
var destructuringBlock: FirExpression? = null
for (valueParameter in valueParameterList) {
@@ -165,10 +168,7 @@ class ExpressionsConverter(
valueParameter.firValueParameter
}
}
label = context.firLabels.pop() ?: context.firFunctionCalls.lastOrNull()?.calleeReference?.name?.let {
buildLabel { name = it.asString() }
}
body = if (block != null) {
declarationsConverter.convertBlockExpressionWithoutBuilding(block!!).apply {
if (statements.isEmpty()) {