Test: FIR CFA: don't output two node fill colors

This commit is contained in:
pyos
2022-12-11 22:45:49 +01:00
committed by Dmitriy Novozhilov
parent 3887c80816
commit a9397b7b23
15 changed files with 35 additions and 39 deletions
@@ -195,7 +195,7 @@ digraph flowFromInplaceLambda_kt {
97 [label="Stub" style="filled" fillcolor=gray];
98 [label="Exit block" style="filled" fillcolor=gray];
}
99 [label="Exit function materialize" style="filled" fillcolor=red style="filled" fillcolor=gray];
99 [label="Exit function materialize" style="filled" fillcolor=gray];
}
91 -> {92};
92 -> {93};
@@ -61,13 +61,13 @@ digraph initBlock_kt {
23 [label="Variable declaration: lval y: R|kotlin/Int|" style="filled" fillcolor=gray];
24 [label="Exit block" style="filled" fillcolor=gray];
}
25 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray];
25 [label="Exit init block" style="filled" fillcolor=gray];
}
28 [label="Exit class Bar" style="filled" fillcolor=red style="filled" fillcolor=gray];
28 [label="Exit class Bar" style="filled" fillcolor=gray];
}
subgraph cluster_7 {
color=blue
12 [label="Enter function <init>" style="filled" fillcolor=red style="filled" fillcolor=gray];
12 [label="Enter function <init>" style="filled" fillcolor=gray];
13 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
14 [label="Exit function <init>" style="filled" fillcolor=red];
}
@@ -16,7 +16,7 @@ digraph inplaceLambdaInControlFlowExpressions_kt {
6 [label="Stub" style="filled" fillcolor=gray];
7 [label="Exit block" style="filled" fillcolor=gray];
}
8 [label="Exit function materialize" style="filled" fillcolor=red style="filled" fillcolor=gray];
8 [label="Exit function materialize" style="filled" fillcolor=gray];
}
0 -> {1};
1 -> {2};
@@ -60,7 +60,7 @@ digraph lambdaReturningObject_kt {
18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit block" style="filled" fillcolor=gray];
}
20 [label="Exit function MyOut" style="filled" fillcolor=red style="filled" fillcolor=gray];
20 [label="Exit function MyOut" style="filled" fillcolor=gray];
}
13 -> {14};
14 -> {15};
@@ -202,7 +202,7 @@ digraph lambdas_kt {
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray];
}
77 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
77 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
65 [label="Postponed exit from lambda"];
66 [label="Function call: R|/getInt|(...)" style="filled" fillcolor=yellow];
@@ -253,7 +253,7 @@ digraph lambdas_kt {
91 [label="Stub" style="filled" fillcolor=gray];
92 [label="Exit block" style="filled" fillcolor=gray];
}
93 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
93 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
81 [label="Postponed exit from lambda"];
82 [label="Function call: R|/getInt|(...)" style="filled" fillcolor=yellow];
+2 -2
View File
@@ -222,7 +222,7 @@ digraph loops_kt {
77 [label="Const: Int(1)" style="filled" fillcolor=gray];
78 [label="Exit block" style="filled" fillcolor=gray];
}
79 [label="Exit function testWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
79 [label="Exit function testWhileTrue" style="filled" fillcolor=gray];
}
65 -> {66};
66 -> {67};
@@ -401,7 +401,7 @@ digraph loops_kt {
133 [label="Const: Int(1)" style="filled" fillcolor=gray];
134 [label="Exit block" style="filled" fillcolor=gray];
}
135 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray];
135 [label="Exit function testDoWhileTrue" style="filled" fillcolor=gray];
}
121 -> {122};
122 -> {123};
@@ -102,13 +102,13 @@ digraph propertiesAndInitBlocks_kt {
70 [label="Stub" style="filled" fillcolor=gray];
71 [label="Exit block" style="filled" fillcolor=gray];
}
72 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray];
72 [label="Exit init block" style="filled" fillcolor=gray];
}
65 [label="Exit class GetterLocalClass" style="filled" fillcolor=red style="filled" fillcolor=gray];
65 [label="Exit class GetterLocalClass" style="filled" fillcolor=gray];
}
subgraph cluster_13 {
color=blue
73 [label="Enter function <init>" style="filled" fillcolor=red style="filled" fillcolor=gray];
73 [label="Enter function <init>" style="filled" fillcolor=gray];
74 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
75 [label="Exit function <init>" style="filled" fillcolor=red];
}
@@ -151,7 +151,7 @@ digraph propertiesAndInitBlocks_kt {
30 [label="Stub" style="filled" fillcolor=gray];
31 [label="Exit block" style="filled" fillcolor=gray];
}
32 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
32 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
subgraph cluster_17 {
color=blue
@@ -169,13 +169,13 @@ digraph propertiesAndInitBlocks_kt {
52 [label="Const: Int(1)" style="filled" fillcolor=gray];
53 [label="Exit block" style="filled" fillcolor=gray];
}
54 [label="Exit init block" style="filled" fillcolor=red style="filled" fillcolor=gray];
54 [label="Exit init block" style="filled" fillcolor=gray];
}
46 [label="Exit class InitializerLocalClass" style="filled" fillcolor=red style="filled" fillcolor=gray];
46 [label="Exit class InitializerLocalClass" style="filled" fillcolor=gray];
}
subgraph cluster_20 {
color=blue
55 [label="Enter function <init>" style="filled" fillcolor=red style="filled" fillcolor=gray];
55 [label="Enter function <init>" style="filled" fillcolor=gray];
56 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
57 [label="Exit function <init>" style="filled" fillcolor=red];
}
@@ -194,7 +194,7 @@ digraph propertiesAndInitBlocks_kt {
41 [label="Stub" style="filled" fillcolor=gray];
42 [label="Exit block" style="filled" fillcolor=gray];
}
43 [label="Exit function foo" style="filled" fillcolor=red style="filled" fillcolor=gray];
43 [label="Exit function foo" style="filled" fillcolor=gray];
}
78 [label="Postponed exit from lambda"];
79 [label="Function call: R|/run|(...)" style="filled" fillcolor=yellow];
@@ -182,7 +182,7 @@ digraph returnValuesFromLambda_kt {
65 [label="Stub" style="filled" fillcolor=gray];
66 [label="Exit block" style="filled" fillcolor=gray];
}
67 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
67 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
56 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
57 [label="Function call: R|kotlin/run|<R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
@@ -623,7 +623,7 @@ digraph endlessLoops_kt {
212 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=gray];
213 [label="Exit block" style="filled" fillcolor=gray];
}
214 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray];
214 [label="Exit function test_7" style="filled" fillcolor=gray];
}
197 -> {198};
198 -> {199};
@@ -268,7 +268,7 @@ digraph safeCalls_kt {
115 [label="Stub" style="filled" fillcolor=gray];
116 [label="Exit block" style="filled" fillcolor=gray];
}
117 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
117 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
98 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
99 [label="Function call: $subj$.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
@@ -37,7 +37,7 @@ digraph smartCastInInit_kt {
11 [label="Stub" style="filled" fillcolor=gray];
12 [label="Exit block" style="filled" fillcolor=gray];
}
13 [label="Exit function s" style="filled" fillcolor=red style="filled" fillcolor=gray];
13 [label="Exit function s" style="filled" fillcolor=gray];
}
6 -> {7};
7 -> {8};
@@ -16,7 +16,7 @@ digraph smartcastToNothing_kt {
6 [label="Stub" style="filled" fillcolor=gray];
7 [label="Exit block" style="filled" fillcolor=gray];
}
8 [label="Exit function getNothing" style="filled" fillcolor=red style="filled" fillcolor=gray];
8 [label="Exit function getNothing" style="filled" fillcolor=gray];
}
0 -> {1};
1 -> {2};
@@ -103,7 +103,7 @@ digraph smartcastToNothing_kt {
36 [label="Stub" style="filled" fillcolor=gray];
37 [label="Exit block" style="filled" fillcolor=gray];
}
38 [label="Exit function myListOf" style="filled" fillcolor=red style="filled" fillcolor=gray];
38 [label="Exit function myListOf" style="filled" fillcolor=gray];
}
30 -> {31};
31 -> {32};
@@ -33,7 +33,7 @@ digraph delegateWithAnonymousObject_kt {
11 [label="Stub" style="filled" fillcolor=gray];
12 [label="Exit block" style="filled" fillcolor=gray];
}
13 [label="Exit function delegate" style="filled" fillcolor=red style="filled" fillcolor=gray];
13 [label="Exit function delegate" style="filled" fillcolor=gray];
}
5 -> {6};
6 -> {7};
@@ -17,20 +17,20 @@ digraph plusAssignWithLambdaInRhs_kt {
7 [label="Postponed enter to lambda" style="filled" fillcolor=gray];
subgraph cluster_2 {
color=blue
12 [label="Enter function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
12 [label="Enter function anonymousFunction" style="filled" fillcolor=gray];
subgraph cluster_3 {
color=blue
13 [label="Enter block" style="filled" fillcolor=gray];
14 [label="Access variable R|<local>/it|" style="filled" fillcolor=gray];
15 [label="Exit block" style="filled" fillcolor=gray];
}
16 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
16 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
}
8 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
9 [label="Function call: R|<local>/list|.R|kotlin/collections/plusAssign|<R|(kotlin/String) -> kotlin/String|>(...)" style="filled" fillcolor=gray];
10 [label="Exit block" style="filled" fillcolor=gray];
}
11 [label="Exit function test" style="filled" fillcolor=red style="filled" fillcolor=gray];
11 [label="Exit function test" style="filled" fillcolor=gray];
}
0 -> {1};
1 -> {2};
@@ -85,18 +85,14 @@ class FirControlFlowGraphRenderVisitor(
}
attributes += "label=\"$label\""
fun fillColor(color: String) {
when {
node.isDead -> "gray"
node == node.owner.enterNode || node == node.owner.exitNode -> "red"
node is UnionNodeMarker -> "yellow"
else -> null
}?.let {
attributes += "style=\"filled\""
attributes += "fillcolor=$color"
}
if (node == node.owner.enterNode || node == node.owner.exitNode) {
fillColor("red")
}
if (node.isDead) {
fillColor("gray")
} else if (node is UnionNodeMarker) {
fillColor("yellow")
attributes += "fillcolor=$it"
}
println(indices.getValue(node), attributes.joinToString(separator = " ", prefix = " [", postfix = "];"))
if (node is ExitNodeMarker) {