FIR CFA: remove redundant entries from followingCfgNodes
Edges to subgraphs should now be correctly added, so there's no need to look at them separately.
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
package org.jetbrains.kotlin.fir.analysis.cfa.util
|
package org.jetbrains.kotlin.fir.analysis.cfa.util
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode
|
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNode
|
||||||
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNodeWithSubgraphs
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
|
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
|
||||||
|
|
||||||
fun ControlFlowGraph.getEnterNode(direction: TraverseDirection): CFGNode<*> = when (direction) {
|
fun ControlFlowGraph.getEnterNode(direction: TraverseDirection): CFGNode<*> = when (direction) {
|
||||||
@@ -30,14 +29,7 @@ val CFGNode<*>.previousCfgNodes: List<CFGNode<*>>
|
|||||||
}
|
}
|
||||||
|
|
||||||
val CFGNode<*>.followingCfgNodes: List<CFGNode<*>>
|
val CFGNode<*>.followingCfgNodes: List<CFGNode<*>>
|
||||||
get() {
|
get() = followingNodes.filter {
|
||||||
val nodes = mutableListOf<CFGNode<*>>()
|
val kind = edgeTo(it).kind
|
||||||
|
kind.usedInCfa && !kind.isDead
|
||||||
followingNodes.filterTo(nodes) {
|
|
||||||
val kind = edgeTo(it).kind
|
|
||||||
kind.usedInCfa && !kind.isDead
|
|
||||||
}
|
|
||||||
(this as? CFGNodeWithSubgraphs<*>)?.subGraphs?.mapTo(nodes) { it.enterNode }
|
|
||||||
|
|
||||||
return nodes
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user