Files
Brian Norman 17a1871b83 [FIR] Make sure the primary constructor is first in class CFG
The primary constructor of a class needs to be the first subgraph of the
class control-flow graph. Based on the Kotlin specification, class
initialization order goes first primary constructor, in-place
declarations (properties and init blocks), and then secondary
constructors. If the class doesn't have a primary constructor, then it
is just skipped in the order.

Unfortunately, the class control-flow graph had in-place declarations
first and then all constructors. Instead, we should treat the primary
constructor as the first in-place declaration, and then continue with
the existing processing as secondary constructors. This will guarantee
that super constructor calls have the correct property initialization
information.

^KT-65093 Fixed
2024-01-23 23:16:00 +00:00

112 lines
3.9 KiB
Plaintext
Vendored

digraph initBlockAndInPlaceLambda_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file initBlockAndInPlaceLambda.kt" style="filled" fillcolor=red];
1 [label="Exit file initBlockAndInPlaceLambda.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class B" style="filled" fillcolor=red];
3 [label="Exit class B" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
subgraph cluster_2 {
color=red
4 [label="Enter class A" style="filled" fillcolor=red];
5 [label="Exit class A" style="filled" fillcolor=red];
}
4 -> {5} [color=green];
subgraph cluster_3 {
color=red
6 [label="Enter class C" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
7 [label="Enter function <init>" style="filled" fillcolor=red];
8 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
9 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_5 {
color=blue
10 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
11 [label="Enter block"];
12 [label="Access variable R|<local>/a|"];
13 [label="Access variable R|/A.b|"];
14 [label="Enter safe call"];
subgraph cluster_7 {
color=blue
15 [label="Function call arguments enter"];
16 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
17 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
18 [label="Enter block"];
subgraph cluster_10 {
color=blue
19 [label="Function call arguments enter"];
20 [label="Access variable R|<local>/a|"];
21 [label="Access variable R|<local>/it|"];
22 [label="Function call arguments exit"];
}
23 [label="Function call: R|/C.C|(...)" style="filled" fillcolor=yellow];
24 [label="Exit block"];
}
25 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
26 [label="Function call arguments exit"];
}
27 [label="Postponed exit from lambda"];
28 [label="Function call: $subj$.R|kotlin/let|<R|B|, R|C|>(...)" style="filled" fillcolor=yellow];
29 [label="Exit safe call"];
30 [label="Variable declaration: lval c: R|C?|"];
31 [label="Exit block"];
}
32 [label="Exit init block" style="filled" fillcolor=red];
}
33 [label="Exit class C" style="filled" fillcolor=red];
}
6 -> {7} [color=green];
6 -> {33} [style=dotted];
6 -> {7 10} [style=dashed];
7 -> {8};
8 -> {9};
9 -> {10} [color=green];
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 29};
14 -> {15};
15 -> {16};
16 -> {17 26};
16 -> {27} [style=dotted];
16 -> {17} [style=dashed];
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {27};
26 -> {28};
27 -> {28} [label="Postponed"];
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33} [color=green];
}