FIR: thread control flow through anonymous object init blocks
^KT-39646 Fixed
This commit is contained in:
+3
-3
@@ -20,7 +20,7 @@ fun <D> ControlFlowGraph.traverse(
|
||||
) {
|
||||
for (node in getNodesInOrder(direction)) {
|
||||
node.accept(visitor, data)
|
||||
(node as? CFGNodeWithCfgOwner<*>)?.subGraphs?.forEach { it.traverse(direction, visitor, data) }
|
||||
(node as? CFGNodeWithSubgraphs<*>)?.subGraphs?.forEach { it.traverse(direction, visitor, data) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ private fun <I> ControlFlowGraph.collectDataForNodeInternal(
|
||||
) {
|
||||
val nodes = getNodesInOrder(direction)
|
||||
for (node in nodes) {
|
||||
if (visitSubGraphs && direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) {
|
||||
if (visitSubGraphs && direction == TraverseDirection.Backward && node is CFGNodeWithSubgraphs<*>) {
|
||||
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
||||
}
|
||||
val previousNodes = when (direction) {
|
||||
@@ -85,7 +85,7 @@ private fun <I> ControlFlowGraph.collectDataForNodeInternal(
|
||||
if (hasChanged) {
|
||||
nodeMap[node] = newData
|
||||
}
|
||||
if (visitSubGraphs && direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) {
|
||||
if (visitSubGraphs && direction == TraverseDirection.Forward && node is CFGNodeWithSubgraphs<*>) {
|
||||
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
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.CFGNodeWithCfgOwner
|
||||
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNodeWithSubgraphs
|
||||
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
|
||||
|
||||
fun ControlFlowGraph.getEnterNode(direction: TraverseDirection): CFGNode<*> = when (direction) {
|
||||
@@ -42,7 +42,7 @@ val CFGNode<*>.followingCfgNodes: List<CFGNode<*>>
|
||||
val kind = outgoingEdges.getValue(it).kind
|
||||
kind.usedInCfa && !kind.isDead
|
||||
}
|
||||
(this as? CFGNodeWithCfgOwner<*>)?.subGraphs?.mapTo(nodes) { it.enterNode }
|
||||
(this as? CFGNodeWithSubgraphs<*>)?.subGraphs?.mapTo(nodes) { it.enterNode }
|
||||
|
||||
return nodes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user