[FIR] Split FirAnonymousObject to expression and declaration

This commit is contained in:
Dmitriy Novozhilov
2021-06-09 14:31:16 +03:00
parent ad89d43186
commit 85b844c748
41 changed files with 769 additions and 546 deletions
@@ -54,20 +54,21 @@ digraph localClassesWithImplicit_kt {
}
22 [label="Exit local class test"];
23 [label="Exit anonymous object"];
24 [label="Variable declaration: lval x: R|<anonymous>|"];
25 [label="Exit block"];
24 [label="Exit anonymous object expression"];
25 [label="Variable declaration: lval x: R|<anonymous>|"];
26 [label="Exit block"];
}
subgraph cluster_7 {
color=blue
29 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
30 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
30 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
31 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
subgraph cluster_8 {
color=blue
27 [label="Enter class A" style="filled" fillcolor=red];
28 [label="Exit class A" style="filled" fillcolor=red];
28 [label="Enter class A" style="filled" fillcolor=red];
29 [label="Exit class A" style="filled" fillcolor=red];
}
26 [label="Exit function test" style="filled" fillcolor=red];
27 [label="Exit function test" style="filled" fillcolor=red];
}
7 -> {8};
8 -> {9};
@@ -79,91 +80,92 @@ digraph localClassesWithImplicit_kt {
14 -> {21};
15 -> {16};
16 -> {17};
17 -> {26};
17 -> {27};
17 -> {18} [style=dotted];
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
20 -> {21} [style=dotted];
21 -> {22};
21 -> {31 34 69 87} [color=red];
21 -> {32 35 70 88} [color=red];
22 -> {23};
22 -> {94 97 132 150} [color=red];
22 -> {31 34 69 87 27} [color=green];
22 -> {31 34 69 87 27} [style=dashed];
22 -> {95 98 133 151} [color=red];
22 -> {32 35 70 88 28} [color=green];
22 -> {32 35 70 88 28} [style=dashed];
23 -> {24};
23 -> {94 97 132 150 29} [color=green];
23 -> {94 97 132 150 29} [style=dashed];
23 -> {95 98 133 151 30} [color=green];
23 -> {95 98 133 151 30} [style=dashed];
24 -> {25};
25 -> {26};
27 -> {28} [color=green];
29 -> {30} [color=green];
26 -> {27};
28 -> {29} [color=green];
30 -> {31} [color=green];
subgraph cluster_9 {
color=red
31 [label="Enter function <init>" style="filled" fillcolor=red];
32 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
33 [label="Exit function <init>" style="filled" fillcolor=red];
32 [label="Enter function <init>" style="filled" fillcolor=red];
33 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
34 [label="Exit function <init>" style="filled" fillcolor=red];
}
31 -> {32};
32 -> {33};
33 -> {34};
subgraph cluster_10 {
color=red
34 [label="Enter function foo" style="filled" fillcolor=red];
35 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
35 [label="Enter block"];
36 [label="Postponed enter to lambda"];
36 [label="Enter block"];
37 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
43 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
44 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
44 [label="Enter block"];
45 [label="Access variable R|<local>/a|"];
46 [label="Access variable R|kotlin/String.length|"];
45 [label="Enter block"];
46 [label="Access variable R|<local>/a|"];
47 [label="Access variable R|kotlin/String.length|"];
subgraph cluster_14 {
color=blue
47 [label="Enter when"];
48 [label="Enter when"];
subgraph cluster_15 {
color=blue
48 [label="Enter when branch condition "];
49 [label="Access variable R|<local>/b|"];
50 [label="Type operator: (R|<local>/b| is R|kotlin/String|)"];
51 [label="Exit when branch condition"];
49 [label="Enter when branch condition "];
50 [label="Access variable R|<local>/b|"];
51 [label="Type operator: (R|<local>/b| is R|kotlin/String|)"];
52 [label="Exit when branch condition"];
}
subgraph cluster_16 {
color=blue
52 [label="Enter when branch condition else"];
53 [label="Exit when branch condition"];
53 [label="Enter when branch condition else"];
54 [label="Exit when branch condition"];
}
54 [label="Enter when branch result"];
55 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
55 [label="Enter block"];
56 [label="Const: Int(1)"];
57 [label="Exit block"];
56 [label="Enter block"];
57 [label="Const: Int(1)"];
58 [label="Exit block"];
}
58 [label="Exit when branch result"];
59 [label="Enter when branch result"];
59 [label="Exit when branch result"];
60 [label="Enter when branch result"];
subgraph cluster_18 {
color=blue
60 [label="Enter block"];
61 [label="Access variable R|<local>/b|"];
62 [label="Access variable R|kotlin/String.length|"];
63 [label="Function call: this@R|/A|.R|<local>/bar|()"];
64 [label="Exit block"];
61 [label="Enter block"];
62 [label="Access variable R|<local>/b|"];
63 [label="Access variable R|kotlin/String.length|"];
64 [label="Function call: this@R|/A|.R|<local>/bar|()"];
65 [label="Exit block"];
}
65 [label="Exit when branch result"];
66 [label="Exit when"];
66 [label="Exit when branch result"];
67 [label="Exit when"];
}
67 [label="Exit block"];
68 [label="Exit block"];
}
68 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
69 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
37 [label="Postponed exit from lambda"];
38 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
39 [label="Jump: ^foo R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
38 [label="Postponed exit from lambda"];
39 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
40 [label="Jump: ^foo R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
R|<local>/a|.R|kotlin/String.length|
^ when () {
(R|<local>/b| is R|kotlin/String|) -> {
@@ -177,39 +179,38 @@ digraph localClassesWithImplicit_kt {
}
)"];
40 [label="Stub" style="filled" fillcolor=gray];
41 [label="Exit block" style="filled" fillcolor=gray];
41 [label="Stub" style="filled" fillcolor=gray];
42 [label="Exit block" style="filled" fillcolor=gray];
}
42 [label="Exit function foo" style="filled" fillcolor=red];
43 [label="Exit function foo" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
36 -> {43};
36 -> {37} [color=red];
36 -> {43} [style=dashed];
37 -> {38};
36 -> {37};
37 -> {44};
37 -> {38} [color=red];
37 -> {44} [style=dashed];
38 -> {39};
39 -> {42};
39 -> {40} [style=dotted];
39 -> {40};
40 -> {43};
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
43 -> {68 44};
44 -> {45};
42 -> {43} [style=dotted];
44 -> {69 45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {59 52};
52 -> {53};
51 -> {52};
52 -> {60 53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {66};
59 -> {60};
58 -> {59};
59 -> {67};
60 -> {61};
61 -> {62};
62 -> {63};
@@ -218,153 +219,154 @@ digraph localClassesWithImplicit_kt {
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {37} [color=green];
68 -> {43} [color=green style=dashed];
68 -> {69};
69 -> {38} [color=green];
69 -> {44} [color=green style=dashed];
subgraph cluster_19 {
color=red
69 [label="Enter function bar" style="filled" fillcolor=red];
70 [label="Enter function bar" style="filled" fillcolor=red];
subgraph cluster_20 {
color=blue
70 [label="Enter block"];
71 [label="Postponed enter to lambda"];
71 [label="Enter block"];
72 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
78 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
79 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
79 [label="Enter block"];
80 [label="Access variable R|<local>/b|"];
81 [label="Access variable <Unresolved name: length>#"];
82 [label="Access variable R|<local>/a|"];
83 [label="Access variable R|kotlin/String.length|"];
84 [label="Function call: this@R|/A|.R|<local>/baz|()"];
85 [label="Exit block"];
80 [label="Enter block"];
81 [label="Access variable R|<local>/b|"];
82 [label="Access variable <Unresolved name: length>#"];
83 [label="Access variable R|<local>/a|"];
84 [label="Access variable R|kotlin/String.length|"];
85 [label="Function call: this@R|/A|.R|<local>/baz|()"];
86 [label="Exit block"];
}
86 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
87 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
72 [label="Postponed exit from lambda"];
73 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
74 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
73 [label="Postponed exit from lambda"];
74 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
75 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
R|<local>/b|.<Unresolved name: length>#
R|<local>/a|.R|kotlin/String.length|
^ this@R|/A|.R|<local>/baz|()
}
)"];
75 [label="Stub" style="filled" fillcolor=gray];
76 [label="Exit block" style="filled" fillcolor=gray];
76 [label="Stub" style="filled" fillcolor=gray];
77 [label="Exit block" style="filled" fillcolor=gray];
}
77 [label="Exit function bar" style="filled" fillcolor=red];
78 [label="Exit function bar" style="filled" fillcolor=red];
}
69 -> {70};
70 -> {71};
71 -> {78};
71 -> {72} [color=red];
71 -> {78} [style=dashed];
72 -> {73};
71 -> {72};
72 -> {79};
72 -> {73} [color=red];
72 -> {79} [style=dashed];
73 -> {74};
74 -> {77};
74 -> {75} [style=dotted];
74 -> {75};
75 -> {78};
75 -> {76} [style=dotted];
76 -> {77} [style=dotted];
78 -> {86 79};
79 -> {80};
77 -> {78} [style=dotted];
79 -> {87 80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {72} [color=green];
86 -> {78} [color=green style=dashed];
86 -> {87};
87 -> {73} [color=green];
87 -> {79} [color=green style=dashed];
subgraph cluster_23 {
color=red
87 [label="Enter function baz" style="filled" fillcolor=red];
88 [label="Enter function baz" style="filled" fillcolor=red];
subgraph cluster_24 {
color=blue
88 [label="Enter block"];
89 [label="Const: Int(1)"];
90 [label="Jump: ^baz Int(1)"];
91 [label="Stub" style="filled" fillcolor=gray];
92 [label="Exit block" style="filled" fillcolor=gray];
89 [label="Enter block"];
90 [label="Const: Int(1)"];
91 [label="Jump: ^baz Int(1)"];
92 [label="Stub" style="filled" fillcolor=gray];
93 [label="Exit block" style="filled" fillcolor=gray];
}
93 [label="Exit function baz" style="filled" fillcolor=red];
94 [label="Exit function baz" style="filled" fillcolor=red];
}
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {93};
90 -> {91} [style=dotted];
90 -> {91};
91 -> {94};
91 -> {92} [style=dotted];
92 -> {93} [style=dotted];
93 -> {94} [style=dotted];
subgraph cluster_25 {
color=red
94 [label="Enter function <init>" style="filled" fillcolor=red];
95 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
96 [label="Exit function <init>" style="filled" fillcolor=red];
95 [label="Enter function <init>" style="filled" fillcolor=red];
96 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
97 [label="Exit function <init>" style="filled" fillcolor=red];
}
94 -> {95};
95 -> {96};
96 -> {97};
subgraph cluster_26 {
color=red
97 [label="Enter function foo" style="filled" fillcolor=red];
98 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_27 {
color=blue
98 [label="Enter block"];
99 [label="Postponed enter to lambda"];
99 [label="Enter block"];
100 [label="Postponed enter to lambda"];
subgraph cluster_28 {
color=blue
106 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
107 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_29 {
color=blue
107 [label="Enter block"];
108 [label="Access variable R|<local>/a|"];
109 [label="Access variable R|kotlin/String.length|"];
108 [label="Enter block"];
109 [label="Access variable R|<local>/a|"];
110 [label="Access variable R|kotlin/String.length|"];
subgraph cluster_30 {
color=blue
110 [label="Enter when"];
111 [label="Enter when"];
subgraph cluster_31 {
color=blue
111 [label="Enter when branch condition "];
112 [label="Access variable R|<local>/b|"];
113 [label="Type operator: (R|<local>/b| is R|kotlin/String|)"];
114 [label="Exit when branch condition"];
112 [label="Enter when branch condition "];
113 [label="Access variable R|<local>/b|"];
114 [label="Type operator: (R|<local>/b| is R|kotlin/String|)"];
115 [label="Exit when branch condition"];
}
subgraph cluster_32 {
color=blue
115 [label="Enter when branch condition else"];
116 [label="Exit when branch condition"];
116 [label="Enter when branch condition else"];
117 [label="Exit when branch condition"];
}
117 [label="Enter when branch result"];
118 [label="Enter when branch result"];
subgraph cluster_33 {
color=blue
118 [label="Enter block"];
119 [label="Const: Int(1)"];
120 [label="Exit block"];
119 [label="Enter block"];
120 [label="Const: Int(1)"];
121 [label="Exit block"];
}
121 [label="Exit when branch result"];
122 [label="Enter when branch result"];
122 [label="Exit when branch result"];
123 [label="Enter when branch result"];
subgraph cluster_34 {
color=blue
123 [label="Enter block"];
124 [label="Access variable R|<local>/b|"];
125 [label="Access variable R|kotlin/String.length|"];
126 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.bar|()"];
127 [label="Exit block"];
124 [label="Enter block"];
125 [label="Access variable R|<local>/b|"];
126 [label="Access variable R|kotlin/String.length|"];
127 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.bar|()"];
128 [label="Exit block"];
}
128 [label="Exit when branch result"];
129 [label="Exit when"];
129 [label="Exit when branch result"];
130 [label="Exit when"];
}
130 [label="Exit block"];
131 [label="Exit block"];
}
131 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
132 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
100 [label="Postponed exit from lambda"];
101 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
102 [label="Jump: ^foo R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
101 [label="Postponed exit from lambda"];
102 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
103 [label="Jump: ^foo R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
R|<local>/a|.R|kotlin/String.length|
^ when () {
(R|<local>/b| is R|kotlin/String|) -> {
@@ -378,39 +380,38 @@ digraph localClassesWithImplicit_kt {
}
)"];
103 [label="Stub" style="filled" fillcolor=gray];
104 [label="Exit block" style="filled" fillcolor=gray];
104 [label="Stub" style="filled" fillcolor=gray];
105 [label="Exit block" style="filled" fillcolor=gray];
}
105 [label="Exit function foo" style="filled" fillcolor=red];
106 [label="Exit function foo" style="filled" fillcolor=red];
}
97 -> {98};
98 -> {99};
99 -> {106};
99 -> {100} [color=red];
99 -> {106} [style=dashed];
100 -> {101};
99 -> {100};
100 -> {107};
100 -> {101} [color=red];
100 -> {107} [style=dashed];
101 -> {102};
102 -> {105};
102 -> {103} [style=dotted];
102 -> {103};
103 -> {106};
103 -> {104} [style=dotted];
104 -> {105} [style=dotted];
106 -> {131 107};
107 -> {108};
105 -> {106} [style=dotted];
107 -> {132 108};
108 -> {109};
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {122 115};
115 -> {116};
114 -> {115};
115 -> {123 116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {121};
121 -> {129};
122 -> {123};
121 -> {122};
122 -> {130};
123 -> {124};
124 -> {125};
125 -> {126};
@@ -419,85 +420,86 @@ digraph localClassesWithImplicit_kt {
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {100} [color=green];
131 -> {106} [color=green style=dashed];
131 -> {132};
132 -> {101} [color=green];
132 -> {107} [color=green style=dashed];
subgraph cluster_35 {
color=red
132 [label="Enter function bar" style="filled" fillcolor=red];
133 [label="Enter function bar" style="filled" fillcolor=red];
subgraph cluster_36 {
color=blue
133 [label="Enter block"];
134 [label="Postponed enter to lambda"];
134 [label="Enter block"];
135 [label="Postponed enter to lambda"];
subgraph cluster_37 {
color=blue
141 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
142 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_38 {
color=blue
142 [label="Enter block"];
143 [label="Access variable R|<local>/a|"];
144 [label="Access variable R|kotlin/String.length|"];
145 [label="Access variable R|<local>/b|"];
146 [label="Access variable <Unresolved name: length>#"];
147 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.baz|()"];
148 [label="Exit block"];
143 [label="Enter block"];
144 [label="Access variable R|<local>/a|"];
145 [label="Access variable R|kotlin/String.length|"];
146 [label="Access variable R|<local>/b|"];
147 [label="Access variable <Unresolved name: length>#"];
148 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.baz|()"];
149 [label="Exit block"];
}
149 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
150 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
135 [label="Postponed exit from lambda"];
136 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
137 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
136 [label="Postponed exit from lambda"];
137 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
138 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
R|<local>/a|.R|kotlin/String.length|
R|<local>/b|.<Unresolved name: length>#
^ this@R|/<anonymous>|.R|/<anonymous>.baz|()
}
)"];
138 [label="Stub" style="filled" fillcolor=gray];
139 [label="Exit block" style="filled" fillcolor=gray];
139 [label="Stub" style="filled" fillcolor=gray];
140 [label="Exit block" style="filled" fillcolor=gray];
}
140 [label="Exit function bar" style="filled" fillcolor=red];
141 [label="Exit function bar" style="filled" fillcolor=red];
}
132 -> {133};
133 -> {134};
134 -> {141};
134 -> {135} [color=red];
134 -> {141} [style=dashed];
135 -> {136};
134 -> {135};
135 -> {142};
135 -> {136} [color=red];
135 -> {142} [style=dashed];
136 -> {137};
137 -> {140};
137 -> {138} [style=dotted];
137 -> {138};
138 -> {141};
138 -> {139} [style=dotted];
139 -> {140} [style=dotted];
141 -> {149 142};
142 -> {143};
140 -> {141} [style=dotted];
142 -> {150 143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {148};
148 -> {149};
149 -> {135} [color=green];
149 -> {141} [color=green style=dashed];
149 -> {150};
150 -> {136} [color=green];
150 -> {142} [color=green style=dashed];
subgraph cluster_39 {
color=red
150 [label="Enter function baz" style="filled" fillcolor=red];
151 [label="Enter function baz" style="filled" fillcolor=red];
subgraph cluster_40 {
color=blue
151 [label="Enter block"];
152 [label="Const: Int(1)"];
153 [label="Jump: ^baz Int(1)"];
154 [label="Stub" style="filled" fillcolor=gray];
155 [label="Exit block" style="filled" fillcolor=gray];
152 [label="Enter block"];
153 [label="Const: Int(1)"];
154 [label="Jump: ^baz Int(1)"];
155 [label="Stub" style="filled" fillcolor=gray];
156 [label="Exit block" style="filled" fillcolor=gray];
}
156 [label="Exit function baz" style="filled" fillcolor=red];
157 [label="Exit function baz" style="filled" fillcolor=red];
}
150 -> {151};
151 -> {152};
152 -> {153};
153 -> {156};
153 -> {154} [style=dotted];
153 -> {154};
154 -> {157};
154 -> {155} [style=dotted];
155 -> {156} [style=dotted];
156 -> {157} [style=dotted];
}