FIR CFA: remove infinite loops from toposort
Finally, no more tests getting stuck on `orderNodes`. Only took me what, 75 commits to fix enough things to make this actually work?
This commit is contained in:
-6
@@ -73,11 +73,6 @@ class ControlFlowGraphBuilder {
|
||||
|
||||
private val notCompletedFunctionCalls: Stack<MutableList<FunctionCallNode>> = stackOf()
|
||||
|
||||
// ----------------------------------- API for node builders -----------------------------------
|
||||
|
||||
private var idCounter: Int = Random.nextInt()
|
||||
fun createId(): Int = idCounter++
|
||||
|
||||
// ----------------------------------- Public API -----------------------------------
|
||||
|
||||
fun returnExpressionsOfAnonymousFunction(function: FirAnonymousFunction): Collection<FirExpression>? {
|
||||
@@ -130,7 +125,6 @@ class ControlFlowGraphBuilder {
|
||||
|
||||
private fun popGraph(): ControlFlowGraph {
|
||||
levelCounter--
|
||||
// TODO: count nodes per graph, validate the list after sorting
|
||||
return graphs.pop().also { it.complete() }
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -9,6 +9,9 @@ import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
|
||||
@OptIn(CfgInternals::class)
|
||||
private fun ControlFlowGraphBuilder.createId(): Int = currentGraph.nodeCount++
|
||||
|
||||
fun ControlFlowGraphBuilder.createStubNode(): StubNode = StubNode(currentGraph, levelCounter, createId())
|
||||
|
||||
fun ControlFlowGraphBuilder.createFakeExpressionEnterNode(): FakeExpressionEnterNode =
|
||||
|
||||
Reference in New Issue
Block a user