[FIR] don't transform analyzed lambda

Inside `transformDeclarationContent` current tower data context is saved. Previously, stored context could be incomplete, because `dataFlowAnalyzer.enterFunction(function)` wasn't called in all cases.
^KTIJ-26419 Fixed
This commit is contained in:
aleksandrina-streltsova
2023-07-28 15:34:15 +03:00
committed by Space Team
parent 673ac2227a
commit 9548486b55
7 changed files with 390 additions and 9 deletions
@@ -666,16 +666,12 @@ open class FirDeclarationsResolveTransformer(
function: FirFunction,
data: ResolutionMode
): FirStatement = whileAnalysing(session, function) {
val functionIsNotAnalyzed = !function.bodyResolved
if (functionIsNotAnalyzed) {
dataFlowAnalyzer.enterFunction(function)
}
if (function.bodyResolved) return function
dataFlowAnalyzer.enterFunction(function)
return transformDeclarationContent(function, data).also {
if (functionIsNotAnalyzed) {
val result = it as FirFunction
val controlFlowGraphReference = dataFlowAnalyzer.exitFunction(result)
result.replaceControlFlowGraphReference(controlFlowGraphReference)
}
val result = it as FirFunction
val controlFlowGraphReference = dataFlowAnalyzer.exitFunction(result)
result.replaceControlFlowGraphReference(controlFlowGraphReference)
} as FirStatement
}