[FIR, by demiurg] Fix exception in DFA for a case with lambda empty body

This commit is contained in:
Mikhail Glukhikh
2020-02-04 11:02:42 +03:00
parent 64c7ab1302
commit b1436804b3
2 changed files with 7 additions and 2 deletions
@@ -19,4 +19,7 @@ class FirControlFlowGraphReferenceImpl(val controlFlowGraph: ControlFlowGraph) :
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirControlFlowGraphReference {
return this
}
}
}
val FirControlFlowGraphReference.controlFlowGraph: ControlFlowGraph?
get() = (this as? FirControlFlowGraphReferenceImpl)?.controlFlowGraph
@@ -173,7 +173,9 @@ class ControlFlowGraphBuilder {
is StubNode -> firstPreviousNode.extractArgument()
else -> fir.extractArgument()
}
return exitsOfAnonymousFunctions.getValue(function).previousNodes.mapNotNull {
val exitNode = function.controlFlowGraphReference.controlFlowGraph?.exitNode ?: exitsOfAnonymousFunctions.getValue(function)
return exitNode.previousNodes.mapNotNull {
it.extractArgument() as FirStatement?
}
}