FIR: Do not complete finally parts of try-finally

It's been processed via Body transformer explicitly
This commit is contained in:
Denis.Zharkov
2021-01-20 15:50:50 +03:00
parent 7df4f67f7c
commit 4dc2653736
@@ -555,19 +555,13 @@ class FirCallCompletionResultsWriterTransformer(
val declaration = calleeReference?.candidate?.symbol?.fir as? FirSimpleFunction
if (calleeReference == null || declaration == null) {
syntheticCall.transformChildren(
this,
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
)
transformSyntheticCallChildren(syntheticCall, data)
return syntheticCall.compose()
}
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
syntheticCall.transformChildren(
this,
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
)
transformSyntheticCallChildren(syntheticCall, data)
return (syntheticCall.transformCalleeReference(
StoreCalleeReference,
@@ -575,6 +569,25 @@ class FirCallCompletionResultsWriterTransformer(
) as D).compose()
}
private inline fun <reified D> transformSyntheticCallChildren(
syntheticCall: D,
data: ExpectedArgumentType?
) where D : FirResolvable, D : FirExpression {
val newData = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
if (syntheticCall is FirTryExpression) {
syntheticCall.transformCalleeReference(this, newData)
syntheticCall.transformTryBlock(this, newData)
syntheticCall.transformCatches(this, newData)
return
}
syntheticCall.transformChildren(
this,
data = newData
)
}
override fun <T> transformConstExpression(
constExpression: FirConstExpression<T>,
data: ExpectedArgumentType?,