FIR CFG: revise edge kind between local func node and fun enter node

so that local function enter node can be visited by FIR CFA

#KT-42814 Fixed
This commit is contained in:
Jinseong Jeon
2020-10-20 15:32:49 -07:00
committed by Dmitriy Novozhilov
parent ce8d983b2a
commit 1c1e8f7beb
3 changed files with 10 additions and 3 deletions
@@ -31,8 +31,7 @@ digraph inLocalFunction_kt {
}
0 -> {1};
1 -> {2};
2 -> {3};
2 -> {7} [color=red];
2 -> {7 3};
2 -> {7} [style=dashed];
3 -> {4};
4 -> {5};
@@ -192,7 +192,11 @@ class ControlFlowGraphBuilder {
}
if (previousNode != null) {
addEdge(previousNode, enterNode, preferredKind = EdgeKind.DfgForward)
if (localFunctionNode == previousNode) {
addEdge(localFunctionNode, enterNode, preferredKind = EdgeKind.Forward)
} else {
addEdge(previousNode, enterNode, preferredKind = EdgeKind.DfgForward)
}
}
createFunctionExitNode(function).also {
@@ -14,4 +14,8 @@ fun foo(arg: Boolean) {
x.hashCode()
}
}
fun local(): Int {
return x.hashCode()
}
}