FIR CFG traverser: do not skip graph enter node
#KT-42348 fixed
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
a154cf4c45
commit
2d001a46fc
@@ -58,19 +58,17 @@ private fun <I : ControlFlowInfo<I, K, V>, K : Any, V : Any> ControlFlowGraph.co
|
|||||||
if (direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) {
|
if (direction == TraverseDirection.Backward && node is CFGNodeWithCfgOwner<*>) {
|
||||||
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
||||||
}
|
}
|
||||||
if (!(node.isEnterNode(direction) && node.owner.owner == null)) {
|
val previousNodes = when (direction) {
|
||||||
val previousNodes = when (direction) {
|
TraverseDirection.Forward -> node.previousCfgNodes
|
||||||
TraverseDirection.Forward -> node.previousCfgNodes
|
TraverseDirection.Backward -> node.followingCfgNodes
|
||||||
TraverseDirection.Backward -> node.followingCfgNodes
|
}
|
||||||
}
|
val previousData = previousNodes.mapNotNull { nodeMap[it] }
|
||||||
val previousData = previousNodes.mapNotNull { nodeMap[it] }
|
val data = nodeMap[node]
|
||||||
val data = nodeMap[node]
|
val newData = node.accept(visitor, previousData)
|
||||||
val newData = node.accept(visitor, previousData)
|
val hasChanged = newData != data
|
||||||
val hasChanged = newData != data
|
changed[node] = hasChanged
|
||||||
changed[node] = hasChanged
|
if (hasChanged) {
|
||||||
if (hasChanged) {
|
nodeMap[node] = newData
|
||||||
nodeMap[node] = newData
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) {
|
if (direction == TraverseDirection.Forward && node is CFGNodeWithCfgOwner<*>) {
|
||||||
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
node.subGraphs.forEach { it.collectDataForNodeInternal(direction, initialInfo, visitor, nodeMap, changed) }
|
||||||
|
|||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
fun foo(arg: Boolean) {
|
|
||||||
val x : Int
|
|
||||||
if (arg) {
|
|
||||||
x = 4
|
|
||||||
} else {
|
|
||||||
x = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
x.hashCode()
|
|
||||||
|
|
||||||
class Local {
|
|
||||||
fun bar() {
|
|
||||||
<!UNINITIALIZED_VARIABLE!>x<!>.hashCode()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
fun foo(arg: Boolean) {
|
fun foo(arg: Boolean) {
|
||||||
val x : Int
|
val x : Int
|
||||||
if (arg) {
|
if (arg) {
|
||||||
|
|||||||
Reference in New Issue
Block a user