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

282 lines
9.5 KiB
Plaintext
Vendored

digraph lambdaInWhenBranch_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file lambdaInWhenBranch.kt" style="filled" fillcolor=red];
1 [label="Exit file lambdaInWhenBranch.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter class Sealed" 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];
}
6 [label="Exit class Sealed" 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 SubClass1" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
8 [label="Enter function <init>" style="filled" fillcolor=red];
9 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
10 [label="Exit function <init>" style="filled" fillcolor=red];
}
subgraph cluster_5 {
color=blue
11 [label="Enter property" style="filled" fillcolor=red];
12 [label="Access variable R|<local>/t|"];
13 [label="Exit property" style="filled" fillcolor=red];
}
14 [label="Exit class SubClass1" style="filled" fillcolor=red];
}
7 -> {8} [color=green];
7 -> {14} [style=dotted];
7 -> {8 11} [style=dashed];
8 -> {9};
9 -> {10};
10 -> {11} [color=green];
11 -> {12};
12 -> {13};
13 -> {14} [color=green];
subgraph cluster_6 {
color=red
15 [label="Enter function component1" style="filled" fillcolor=red];
16 [label="Exit function component1" style="filled" fillcolor=red];
}
15 -> {16};
subgraph cluster_7 {
color=red
17 [label="Enter function copy" style="filled" fillcolor=red];
18 [label="Enter default value of t"];
subgraph cluster_8 {
color=blue
19 [label="Enter default value of t" style="filled" fillcolor=red];
20 [label="Access variable R|/SubClass1.t|"];
21 [label="Exit default value of t" style="filled" fillcolor=red];
}
22 [label="Exit default value of t"];
23 [label="Exit function copy" style="filled" fillcolor=red];
}
17 -> {18};
18 -> {19 22};
18 -> {19} [style=dashed];
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
subgraph cluster_9 {
color=red
24 [label="Enter class SubClass2" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
25 [label="Enter function <init>" style="filled" fillcolor=red];
26 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
27 [label="Exit function <init>" style="filled" fillcolor=red];
}
28 [label="Exit class SubClass2" style="filled" fillcolor=red];
}
24 -> {25} [color=green];
24 -> {28} [style=dotted];
24 -> {25} [style=dashed];
25 -> {26};
26 -> {27};
27 -> {28} [color=green];
subgraph cluster_11 {
color=red
29 [label="Enter function copy" style="filled" fillcolor=red];
30 [label="Exit function copy" style="filled" fillcolor=red];
}
29 -> {30};
subgraph cluster_12 {
color=red
31 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
32 [label="Enter block"];
subgraph cluster_14 {
color=blue
33 [label="Enter when"];
34 [label="Access variable R|<local>/p|"];
subgraph cluster_15 {
color=blue
35 [label="Enter when branch condition "];
36 [label="Exit $subj"];
37 [label="Type operator: ($subj$ is R|SubClass1|)"];
38 [label="Exit when branch condition"];
}
subgraph cluster_16 {
color=blue
39 [label="Enter when branch condition "];
40 [label="Exit $subj"];
41 [label="Type operator: ($subj$ is R|SubClass2|)"];
42 [label="Exit when branch condition"];
}
43 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
44 [label="Enter block"];
45 [label="Const: String()"];
46 [label="Exit block"];
}
47 [label="Exit when branch result"];
48 [label="Enter when branch result"];
subgraph cluster_18 {
color=blue
49 [label="Enter block"];
subgraph cluster_19 {
color=blue
50 [label="Function call arguments enter"];
51 [label="Const: String()"];
52 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
53 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
54 [label="Enter block"];
55 [label="Access variable R|<local>/it|"];
56 [label="Exit block"];
}
57 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
58 [label="Function call arguments exit"];
}
59 [label="Postponed exit from lambda"];
60 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
61 [label="Exit block"];
}
62 [label="Exit when branch result"];
63 [label="Exit when"];
}
64 [label="Access variable R|<local>/p|"];
65 [label="Access variable <Unresolved name: t>#"];
subgraph cluster_22 {
color=blue
66 [label="Enter when"];
67 [label="Access variable R|<local>/p|"];
subgraph cluster_23 {
color=blue
68 [label="Enter when branch condition "];
69 [label="Exit $subj"];
70 [label="Type operator: ($subj$ is R|SubClass1|)"];
71 [label="Exit when branch condition"];
}
subgraph cluster_24 {
color=blue
72 [label="Enter when branch condition "];
73 [label="Exit $subj"];
74 [label="Type operator: ($subj$ is R|SubClass2|)"];
75 [label="Exit when branch condition"];
}
76 [label="Enter when branch result"];
subgraph cluster_25 {
color=blue
77 [label="Enter block"];
78 [label="Const: String(2)"];
79 [label="Exit block"];
}
80 [label="Exit when branch result"];
81 [label="Enter when branch result"];
subgraph cluster_26 {
color=blue
82 [label="Enter block"];
83 [label="Access variable R|<local>/p|"];
84 [label="Smart cast: R|<local>/p|"];
85 [label="Access variable R|/SubClass1.t|"];
86 [label="Exit block"];
}
87 [label="Exit when branch result"];
88 [label="Exit when"];
}
89 [label="Access variable R|kotlin/String.length|"];
90 [label="Exit block"];
}
91 [label="Exit function foo" style="filled" fillcolor=red];
}
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39 48};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {63};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53 58};
52 -> {59} [style=dotted];
52 -> {53} [style=dashed];
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {59};
58 -> {60};
59 -> {60} [color=green];
59 -> {63} [color=red label="Postponed"];
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72 81};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
80 -> {88};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
}