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

167 lines
5.4 KiB
Plaintext
Vendored

digraph overridenOpenVal_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file overridenOpenVal.kt" style="filled" fillcolor=red];
1 [label="Exit file overridenOpenVal.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class A" 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="Access variable R|<local>/x|"];
8 [label="Exit property" style="filled" fillcolor=red];
}
9 [label="Exit class A" style="filled" fillcolor=red];
}
2 -> {3} [color=green];
2 -> {9} [style=dotted];
2 -> {3 6} [style=dashed];
3 -> {4};
4 -> {5};
5 -> {6} [color=green];
6 -> {7};
7 -> {8};
8 -> {9} [color=green];
subgraph cluster_4 {
color=red
10 [label="Enter 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>/x|"];
13 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
14 [label="Exit function <init>" style="filled" fillcolor=red];
}
15 [label="Exit class B" style="filled" fillcolor=red];
}
10 -> {11} [color=green];
10 -> {15} [style=dotted];
10 -> {11} [style=dashed];
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15} [color=green];
subgraph cluster_6 {
color=red
16 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
17 [label="Enter block"];
subgraph cluster_8 {
color=blue
18 [label="Enter when"];
subgraph cluster_9 {
color=blue
19 [label="Enter when branch condition "];
20 [label="Access variable R|/A.x|"];
21 [label="Type operator: (this@R|/B|.R|/A.x| is R|kotlin/String|)"];
22 [label="Exit when branch condition"];
}
23 [label="Synthetic else branch"];
24 [label="Enter when branch result"];
subgraph cluster_10 {
color=blue
25 [label="Enter block"];
26 [label="Access variable R|/A.x|"];
27 [label="Smart cast: this@R|/B|.R|/A.x|"];
28 [label="Access variable R|kotlin/String.length|"];
29 [label="Exit block"];
}
30 [label="Exit when branch result"];
31 [label="Exit when"];
}
32 [label="Exit block"];
}
33 [label="Exit function test_1" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23 24};
23 -> {31};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
subgraph cluster_11 {
color=red
34 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
35 [label="Enter block"];
subgraph cluster_13 {
color=blue
36 [label="Enter when"];
subgraph cluster_14 {
color=blue
37 [label="Enter when branch condition "];
38 [label="Access variable R|<local>/b|"];
39 [label="Access variable R|/A.x|"];
40 [label="Type operator: (R|<local>/b|.R|/A.x| is R|kotlin/String|)"];
41 [label="Exit when branch condition"];
}
42 [label="Synthetic else branch"];
43 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/b|"];
46 [label="Access variable R|/A.x|"];
47 [label="Smart cast: R|<local>/b|.R|/A.x|"];
48 [label="Access variable R|kotlin/String.length|"];
49 [label="Exit block"];
}
50 [label="Exit when branch result"];
51 [label="Exit when"];
}
52 [label="Exit block"];
}
53 [label="Exit function test_2" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42 43};
42 -> {51};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
}