[FIR] Create CFG for files to track top-level property initialization
In order to properly analyze top-level property initialization, a control-flow graph must be created for FirFiles. This change adds the foundation for the file CFG and updates body resolve to create the CFG. Checking the CFG for proper initialization is separated into a following change to ease code review. KT-56683
This commit is contained in:
+84
-77
@@ -5,106 +5,113 @@ digraph postponedLambdaInConstructor_kt {
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class A" style="filled" fillcolor=red];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
1 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
2 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
3 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
4 [label="Exit class A" style="filled" fillcolor=red];
|
||||
0 [label="Enter file postponedLambdaInConstructor.kt" style="filled" fillcolor=red];
|
||||
1 [label="Exit file postponedLambdaInConstructor.kt" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
0 -> {4} [style=dotted];
|
||||
0 -> {1} [style=dashed];
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4} [color=green];
|
||||
|
||||
subgraph cluster_2 {
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
5 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_3 {
|
||||
2 [label="Enter class A" style="filled" fillcolor=red];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
6 [label="Enter property" style="filled" fillcolor=red];
|
||||
7 [label="Access variable R|<local>/s|"];
|
||||
8 [label="Exit property" style="filled" fillcolor=red];
|
||||
3 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
5 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
6 [label="Exit class A" style="filled" fillcolor=red];
|
||||
}
|
||||
2 -> {3} [color=green];
|
||||
2 -> {6} [style=dotted];
|
||||
2 -> {3} [style=dashed];
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6} [color=green];
|
||||
|
||||
subgraph cluster_3 {
|
||||
color=red
|
||||
7 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
9 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
10 [label="Access variable R|<local>/s|"];
|
||||
11 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
12 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
13 [label="Enter block"];
|
||||
14 [label="Exit anonymous function expression"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
15 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
16 [label="Enter block"];
|
||||
17 [label="Access variable R|<local>/it|"];
|
||||
18 [label="Exit block"];
|
||||
}
|
||||
19 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
20 [label="Exit block"];
|
||||
}
|
||||
21 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
22 [label="Postponed exit from lambda"];
|
||||
23 [label="Function call: R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
24 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
|
||||
25 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
8 [label="Enter property" style="filled" fillcolor=red];
|
||||
9 [label="Access variable R|<local>/s|"];
|
||||
10 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
26 [label="Exit class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
11 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
12 [label="Access variable R|<local>/s|"];
|
||||
13 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
14 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
15 [label="Enter block"];
|
||||
16 [label="Exit anonymous function expression"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
17 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
18 [label="Enter block"];
|
||||
19 [label="Access variable R|<local>/it|"];
|
||||
20 [label="Exit block"];
|
||||
}
|
||||
21 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
22 [label="Exit block"];
|
||||
}
|
||||
23 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
24 [label="Postponed exit from lambda"];
|
||||
25 [label="Function call: R|<local>/s|.R|kotlin/let|<R|kotlin/String|, R|() -> kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
26 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
|
||||
27 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
28 [label="Exit class B" style="filled" fillcolor=red];
|
||||
}
|
||||
5 -> {6} [color=green];
|
||||
5 -> {26} [style=dotted];
|
||||
5 -> {6 9} [style=dashed];
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9} [color=green];
|
||||
7 -> {8} [color=green];
|
||||
7 -> {28} [style=dotted];
|
||||
7 -> {8 11} [style=dashed];
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12 23};
|
||||
11 -> {22} [style=dotted];
|
||||
11 -> {12} [style=dashed];
|
||||
10 -> {11} [color=green];
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15 20};
|
||||
14 -> {15} [style=dashed];
|
||||
13 -> {14 25};
|
||||
13 -> {24} [style=dotted];
|
||||
13 -> {14} [style=dashed];
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
16 -> {17 22};
|
||||
16 -> {17} [style=dashed];
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23} [color=green];
|
||||
22 -> {24} [color=red];
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26} [color=green];
|
||||
24 -> {25} [color=green];
|
||||
24 -> {26} [color=red];
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28} [color=green];
|
||||
|
||||
subgraph cluster_9 {
|
||||
subgraph cluster_10 {
|
||||
color=red
|
||||
27 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
subgraph cluster_10 {
|
||||
29 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
28 [label="Enter block"];
|
||||
29 [label="Function call: this@R|/B|.R|/B.foo|()" style="filled" fillcolor=yellow];
|
||||
30 [label="Exit block"];
|
||||
30 [label="Enter block"];
|
||||
31 [label="Function call: this@R|/B|.R|/B.foo|()" style="filled" fillcolor=yellow];
|
||||
32 [label="Exit block"];
|
||||
}
|
||||
31 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
33 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
}
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user