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

114 lines
3.7 KiB
Plaintext
Vendored

digraph nestedClass_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file nestedClass.kt" style="filled" fillcolor=red];
1 [label="Exit file nestedClass.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class OuterClass" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
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];
}
subgraph cluster_3 {
color=blue
6 [label="Enter property" style="filled" fillcolor=red];
7 [label="Const: Int(1)"];
8 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_4 {
color=blue
9 [label="Enter property" style="filled" fillcolor=red];
10 [label="Access variable R|/OuterClass.outerProperty|"];
11 [label="Exit property" style="filled" fillcolor=red];
}
12 [label="Exit class OuterClass" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
2 -> {12} [style=dotted];
2 -> {3 6 9} [style=dashed];
3 -> {4};
4 -> {5};
5 -> {6} [color=green];
6 -> {7};
7 -> {8};
8 -> {9} [color=green];
9 -> {10};
10 -> {11};
11 -> {12} [color=green];
subgraph cluster_5 {
color=red
13 [label="Enter function outerFunction" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
14 [label="Enter block"];
15 [label="Exit block"];
}
16 [label="Exit function outerFunction" style="filled" fillcolor=red];
}
13 -> {14};
14 -> {15};
15 -> {16};
subgraph cluster_7 {
color=red
17 [label="Enter class NestedClass" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
18 [label="Enter function <init>" style="filled" fillcolor=red];
19 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
20 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_9 {
color=blue
21 [label="Enter property" style="filled" fillcolor=red];
22 [label="Const: Int(1)"];
23 [label="Exit property" style="filled" fillcolor=red];
}
subgraph cluster_10 {
color=blue
24 [label="Enter property" style="filled" fillcolor=red];
25 [label="Access variable R|/OuterClass.NestedClass.nestedProperty|"];
26 [label="Exit property" style="filled" fillcolor=red];
}
27 [label="Exit class NestedClass" style="filled" fillcolor=red];
}
17 -> {18} [color=green];
17 -> {27} [style=dotted];
17 -> {18 21 24} [style=dashed];
18 -> {19};
19 -> {20};
20 -> {21} [color=green];
21 -> {22};
22 -> {23};
23 -> {24} [color=green];
24 -> {25};
25 -> {26};
26 -> {27} [color=green];
subgraph cluster_11 {
color=red
28 [label="Enter function nestedFUnction" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
29 [label="Enter block"];
30 [label="Exit block"];
}
31 [label="Exit function nestedFUnction" style="filled" fillcolor=red];
}
28 -> {29};
29 -> {30};
30 -> {31};
}