[test] Remove mermaid diagrams from test output
Sathya Gunasekaran committed
Dec 14, 2022 at 15:47 UTC
4b6653123732549aaa12f106f44f418dc7dbb2e2
99 files changed
+2
-4275
compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md
-32
@@ -60,38 +60,6 @@ function Component(
60
61
```
62
63
-### CFG
64
-
65
-```mermaid
66
-flowchart TB
67
- %% Basic Blocks
68
- subgraph bb0
69
- bb0_instrs["
70
- [1] Const mutate a$4_@0:TFunction[1:7] = Array []
71
- [2] Call mutate a$4_@0.push(read props$3.a)
72
- "]
73
- bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
74
- end
75
- subgraph bb2
76
- bb2_instrs["
77
- [4] Call mutate a$4_@0.push(read props$3.c)
78
- "]
79
- bb2_instrs --> bb2_terminal(["Goto"])
80
- end
81
- subgraph bb1
82
- bb1_instrs["
83
- [6] Call mutate a$4_@0.push(read props$3.d)
84
- "]
85
- bb1_instrs --> bb1_terminal(["Return freeze a$4_@0:TFunction"])
86
- end
87
-
88
- %% Jumps
89
- bb0_terminal -- "then" --> bb1
90
- bb0_terminal -- "else" --> bb2
91
- bb2_terminal --> bb1
92
-
93
-```
94
-
63
## Code
64
65
```javascript
compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md
-19
@@ -42,25 +42,6 @@ function f(
42
43
```
44
45
-### CFG
46
-
47
-```mermaid
48
-flowchart TB
49
- %% Basic Blocks
50
- subgraph bb0
51
- bb0_instrs["
52
- [1] Const mutate x$4_@0:TPrimitive = 1
53
- [2] Const mutate x$5_@1:TPrimitive = 2
54
- [3] Const mutate $6_@2:TPrimitive = Binary read x$5_@1:TPrimitive + read x$5_@1:TPrimitive
55
- [4] Const mutate $7_@3:TPrimitive = Binary read $6_@2:TPrimitive + read x$5_@1:TPrimitive
56
- "]
57
- bb0_instrs --> bb0_terminal(["Return read $7_@3:TPrimitive"])
58
- end
59
-
60
- %% Jumps
61
- %% empty
62
-```
63
-
45
## Code
46
47
```javascript
compiler/forget/src/__tests__/fixtures/hir/_bug_inverted-if-else.expect.md
-35
@@ -56,41 +56,6 @@ function foo(
56
57
```
58
59
-### CFG
60
-
61
-```mermaid
62
-flowchart TB
63
- %% Basic Blocks
64
- subgraph bb0
65
- bb0_instrs["
66
- [1] Const mutate x$8_@0:TPrimitive = null
67
- "]
68
- bb0_instrs --> bb0_terminal(["If (read a$5)"])
69
- end
70
- subgraph bb3
71
- bb3_instrs["
72
- [3] Const mutate x$9_@1 = read b$6
73
- "]
74
- bb3_instrs --> bb3_terminal(["Goto"])
75
- end
76
- subgraph bb2
77
- bb2_instrs["
78
- [5] Const mutate x$10_@2 = read c$7
79
- "]
80
- bb2_instrs --> bb2_terminal(["Goto"])
81
- end
82
- subgraph bb1
83
- bb1_terminal(["Return read x$11"])
84
- end
85
-
86
- %% Jumps
87
- bb0_terminal -- "then" --> bb3
88
- bb0_terminal -- "else" --> bb2
89
- bb3_terminal --> bb1
90
- bb2_terminal --> bb1
91
-
92
-```
93
-
59
## Code
60
61
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md
-21
@@ -45,27 +45,6 @@ function component(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_instrs["
55
- [1] Const mutate z$5_@0[1:7] = Array []
56
- [2] Const mutate y$6_@0:TObject[1:7] = Object { }
57
- [3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0
58
- [4] Const mutate x$7_@0:TObject[1:7] = Object { }
59
- [5] Reassign mutate x$7_@0.y[1:7] = read y$6_@0:TObject
60
- [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z)
61
- "]
62
- bb0_instrs --> bb0_terminal(["Return"])
63
- end
64
-
65
- %% Jumps
66
- %% empty
67
-```
68
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md
-20
@@ -50,26 +50,6 @@ function component(
50
51
```
52
53
-### CFG
54
-
55
-```mermaid
56
-flowchart TB
57
- %% Basic Blocks
58
- subgraph bb0
59
- bb0_instrs["
60
- [1] Const mutate z$4_@0 = Array []
61
- [2] Const mutate y$5_@1:TObject[2:4] = Object { }
62
- [3] Reassign mutate y$5_@1.z[2:4] = read z$4_@0
63
- [4] Const mutate x$6_@2:TObject[4:6] = Object { }
64
- [5] Reassign mutate x$6_@2.y[4:6] = read y$5_@1:TObject
65
- "]
66
- bb0_instrs --> bb0_terminal(["Return freeze x$6_@2:TObject"])
67
- end
68
-
69
- %% Jumps
70
- %% empty
71
-```
72
-
53
## Code
54
55
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
-58
@@ -80,51 +80,6 @@ function foo(
80
81
```
82
83
-### CFG
84
-
85
-```mermaid
86
-flowchart TB
87
- %% Basic Blocks
88
- subgraph bb0
89
- bb0_instrs["
90
- [1] Let mutate a$8_@0:TObject[1:12] = Object { }
91
- [2] Let mutate b$9_@0:TObject[1:12] = Object { }
92
- [3] Let mutate c$10_@0:TObject[1:12] = Object { }
93
- "]
94
- bb0_instrs --> bb0_terminal(["While"])
95
- end
96
- subgraph bb1
97
- bb1_terminal(["If (read cond$7)"])
98
- end
99
- subgraph bb3
100
- bb3_instrs["
101
- [6] Const mutate z$13_@0[1:12] = read a$8_@0:TObject
102
- [7] Reassign mutate a$8_@0:TObject[1:12] = read b$9_@0:TObject
103
- [8] Reassign mutate b$9_@0:TObject[1:12] = read c$10_@0:TObject
104
- [9] Reassign mutate c$10_@0:TObject[1:12] = read z$13_@0
105
- [10] Call mutate mutate$6:TFunction(mutate a$8_@0:TObject, mutate b$9_@0:TObject)
106
- "]
107
- bb3_instrs --> bb3_terminal(["Goto"])
108
- end
109
- subgraph bb2
110
- bb2_instrs["
111
- [12] read a$8_@0:TObject
112
- [13] read b$9_@0:TObject
113
- [14] read c$10_@0:TObject
114
- "]
115
- bb2_instrs --> bb2_terminal(["Return freeze a$8_@0:TObject"])
116
- end
117
-
118
- %% Jumps
119
- bb0_terminal -- "test" --> bb1
120
- bb0_terminal -- "loop" --> bb3
121
- bb0_terminal -- "fallthrough" --> bb2
122
- bb1_terminal -- "then" --> bb3
123
- bb1_terminal -- "else" --> bb2
124
- bb3_terminal --> bb1
125
-
126
-```
127
-
83
## Code
84
85
```javascript
@@ -167,19 +122,6 @@ function mutate(
122
123
```
124
170
-### CFG
171
-
172
-```mermaid
173
-flowchart TB
174
- %% Basic Blocks
175
- subgraph bb0
176
- bb0_terminal(["Return"])
177
- end
178
-
179
- %% Jumps
180
- %% empty
181
-```
182
-
125
## Code
126
127
```javascript
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
-41
@@ -56,28 +56,6 @@ function f(
56
57
```
58
59
-### CFG
60
-
61
-```mermaid
62
-flowchart TB
63
- %% Basic Blocks
64
- subgraph bb0
65
- bb0_instrs["
66
- [1] Const mutate x$5_@0:TPrimitive = 1
67
- [2] Const mutate $6_@1:TPrimitive = 1
68
- [3] Const mutate x$7_@2:TPrimitive = Binary read x$5_@0:TPrimitive + read $6_@1:TPrimitive
69
- [4] Const mutate $8_@3:TPrimitive = 1
70
- [5] Const mutate x$9_@4:TPrimitive = Binary read x$7_@2:TPrimitive + read $8_@3:TPrimitive
71
- [6] Const mutate $10_@5:TPrimitive = 1
72
- [7] Const mutate x$11_@6:TPrimitive = Binary read x$9_@4:TPrimitive >>> read $10_@5:TPrimitive
73
- "]
74
- bb0_instrs --> bb0_terminal(["Return"])
75
- end
76
-
77
- %% Jumps
78
- %% empty
79
-```
80
-
59
## Code
60
61
```javascript
@@ -119,25 +97,6 @@ function g(
97
98
```
99
122
-### CFG
123
-
124
-```mermaid
125
-flowchart TB
126
- %% Basic Blocks
127
- subgraph bb0
128
- bb0_instrs["
129
- [1] Const mutate $5_@0:TPrimitive = 1
130
- [2] Reassign mutate a$4_@1.b.c[0:5] = Binary read a$4_@1.b.c + read $5_@0:TPrimitive
131
- [3] Const mutate $6_@2:TPrimitive = 2
132
- [4] Reassign mutate a$4_@1.b.c[0:5] = Binary read a$4_@1.b.c * read $6_@2:TPrimitive
133
- "]
134
- bb0_instrs --> bb0_terminal(["Return"])
135
- end
136
-
137
- %% Jumps
138
- %% empty
139
-```
140
-
100
## Code
101
102
```javascript
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
-36
@@ -33,19 +33,6 @@ function foo(
33
34
```
35
36
-### CFG
37
-
38
-```mermaid
39
-flowchart TB
40
- %% Basic Blocks
41
- subgraph bb0
42
- bb0_terminal(["Return"])
43
- end
44
-
45
- %% Jumps
46
- %% empty
47
-```
48
-
36
## Code
37
38
```javascript
@@ -98,29 +85,6 @@ function Component(
85
86
```
87
101
-### CFG
102
-
103
-```mermaid
104
-flowchart TB
105
- %% Basic Blocks
106
- subgraph bb0
107
- bb0_instrs["
108
- [1] Const mutate a$10_@0:TObject[1:7] = Array []
109
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
110
- [3] Call mutate foo$4:TFunction(mutate a$10_@0:TObject, mutate b$11_@0:TObject)
111
- [4] Const mutate $12_@1:TPrimitive = 'div'
112
- [5] Const mutate _$13_@2 = JSX <read $12_@1:TPrimitive a={freeze a$10_@0:TObject} ></read $12_@1:TPrimitive>
113
- [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
114
- [7] Const mutate $14_@3:TPrimitive = 'div'
115
- [8] Const mutate $15_@4 = JSX <read $14_@3:TPrimitive a={read a$10_@0:TObject} b={freeze b$11_@0:TObject} ></read $14_@3:TPrimitive>
116
- "]
117
- bb0_instrs --> bb0_terminal(["Return read $15_@4"])
118
- end
119
-
120
- %% Jumps
121
- %% empty
122
-```
123
-
88
## Code
89
90
```javascript
compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md
-38
@@ -59,44 +59,6 @@ function foo(
59
60
```
61
62
-### CFG
63
-
64
-```mermaid
65
-flowchart TB
66
- %% Basic Blocks
67
- subgraph bb0
68
- bb0_terminal(["If (read a$4)"])
69
- end
70
- subgraph bb3
71
- bb3_terminal(["While"])
72
- end
73
- subgraph bb4
74
- bb4_terminal(["If (read b$5)"])
75
- end
76
- subgraph bb6
77
- bb6_terminal(["If (read c$6)"])
78
- end
79
- subgraph bb7
80
- bb7_terminal(["Goto"])
81
- end
82
- subgraph bb1
83
- bb1_terminal(["Return"])
84
- end
85
-
86
- %% Jumps
87
- bb0_terminal -- "then" --> bb3
88
- bb0_terminal -- "else" --> bb1
89
- bb3_terminal -- "test" --> bb4
90
- bb3_terminal -- "loop" --> bb6
91
- bb3_terminal -- "fallthrough" --> bb1
92
- bb4_terminal -- "then" --> bb6
93
- bb4_terminal -- "else" --> bb1
94
- bb6_terminal -- "then" --> bb1
95
- bb6_terminal -- "else" --> bb7
96
- bb7_terminal --> bb4
97
-
98
-```
99
-
62
## Code
63
64
```javascript
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
-115
@@ -193,121 +193,6 @@ function Component(
193
194
```
195
196
-### CFG
197
-
198
-```mermaid
199
-flowchart TB
200
- %% Basic Blocks
201
- subgraph bb0
202
- bb0_instrs["
203
- [1] Const mutate items$30_@0:TProp = read props$29.items
204
- [2] Const mutate maxItems$31_@1:TProp = read props$29.maxItems
205
- [3] Const mutate renderedItems$32_@2:TFunction[3:33] = Array []
206
- [4] Const mutate seen$33_@2:TFunction[3:33] = New mutate Set$6()
207
- [5] Const mutate $34_@4:TPrimitive = 0
208
- [6] Const mutate max$35_@5:TPrimitive = Call mutate Math$8.max(read $34_@4:TPrimitive, read maxItems$31_@1:TProp)
209
- "]
210
- bb0_instrs --> bb0_terminal(["For"])
211
- end
212
- subgraph bb3
213
- bb3_instrs["
214
- [8] Let mutate i$36_@2:TPrimitive[3:33] = 0
215
- "]
216
- bb3_instrs --> bb3_terminal(["Goto"])
217
- end
218
- subgraph bb1
219
- bb1_instrs["
220
- [10] Const mutate $39_@2:TPrimitive[3:33] = Binary read i$36_@2:TPrimitive < read items$30_@0.length
221
- "]
222
- bb1_instrs --> bb1_terminal(["If (read $39_@2:TPrimitive)"])
223
- end
224
- subgraph bb5
225
- bb5_instrs["
226
- [12] Const mutate item$40_@2:TPrimitive[3:33] = Call read items$30_@0.at(read i$36_@2:TPrimitive)
227
- [13] Const mutate $41_@6:TPrimitive = null
228
- [14] Const mutate $42_@2:TPrimitive[3:33] = Binary read item$40_@2:TPrimitive == read $41_@6:TPrimitive
229
- [15] Let mutate $43_@2:TPrimitive[3:33] = undefined
230
- "]
231
- bb5_instrs --> bb5_terminal(["If (read $42_@2:TPrimitive)"])
232
- end
233
- subgraph bb10
234
- bb10_instrs["
235
- [16] Const mutate $43_@2:TPrimitive[3:33] = read $42_@2:TPrimitive
236
- "]
237
- bb10_instrs --> bb10_terminal(["Goto"])
238
- end
239
- subgraph bb11
240
- bb11_instrs["
241
- [18] Const mutate $43_@2:TPrimitive[3:33] = Call mutate seen$33_@2.has(mutate item$40_@2:TPrimitive)
242
- "]
243
- bb11_instrs --> bb11_terminal(["Goto"])
244
- end
245
- subgraph bb9
246
- bb9_terminal(["If (read $43_@2:TPrimitive)"])
247
- end
248
- subgraph bb7
249
- bb7_terminal(["Goto"])
250
- end
251
- subgraph bb6
252
- bb6_instrs["
253
- [22] Call mutate seen$33_@2.add(mutate item$40_@2:TPrimitive)
254
- [23] Const mutate $49_@7:TPrimitive = 'div'
255
- [24] Const mutate $50_@8 = JSX <read $49_@7:TPrimitive>{freeze item$40_@2:TPrimitive}</read $49_@7:TPrimitive>
256
- [25] Call mutate renderedItems$32_@2.push(read $50_@8)
257
- [26] Const mutate $55_@9:TPrimitive = Binary read renderedItems$32_@2.length >= read max$35_@5:TPrimitive
258
- "]
259
- bb6_instrs --> bb6_terminal(["If (read $55_@9:TPrimitive)"])
260
- end
261
- subgraph bb12
262
- bb12_terminal(["Goto"])
263
- end
264
- subgraph bb4
265
- bb4_instrs["
266
- [29] Const mutate $56_@2:TPrimitive[3:33] = 1
267
- [30] Reassign mutate i$36_@2:TPrimitive[3:33] = Binary read i$36_@2:TPrimitive + read $56_@2:TPrimitive
268
- [31] read i$36_@2:TPrimitive
269
- "]
270
- bb4_instrs --> bb4_terminal(["Goto"])
271
- end
272
- subgraph bb2
273
- bb2_instrs["
274
- [33] Const mutate count$66_@11:TProp = read renderedItems$32_@2.length
275
- [34] Const mutate $67_@12:TPrimitive = 'div'
276
- [35] Const mutate $68_@13 = '\n '
277
- [36] Const mutate $69_@14:TPrimitive = 'h1'
278
- [37] Const mutate $70_@15 = ' Items'
279
- [38] Const mutate $71_@16 = JSX <read $69_@14:TPrimitive>{freeze count$66_@11:TProp}{read $70_@15}</read $69_@14:TPrimitive>
280
- [39] Const mutate $72_@17 = '\n '
281
- [40] Const mutate $73_@18 = '\n '
282
- [41] Const mutate $74_@19 = JSX <read $67_@12:TPrimitive>{read $68_@13}{read $71_@16}{read $72_@17}{freeze renderedItems$32_@2:TFunction}{read $73_@18}</read $67_@12:TPrimitive>
283
- "]
284
- bb2_instrs --> bb2_terminal(["Return read $74_@19"])
285
- end
286
-
287
- %% Jumps
288
- bb0_terminal -- "init" --> bb3
289
- bb0_terminal -- "test" --> bb1
290
- bb0_terminal -- "update" --> bb4
291
- bb0_terminal -- "loop" --> bb5
292
- bb0_terminal -- "fallthrough" --> bb2
293
- bb3_terminal --> bb1
294
- bb1_terminal -- "then" --> bb5
295
- bb1_terminal -- "else" --> bb2
296
- bb5_terminal -- "then" --> bb10
297
- bb5_terminal -- "else" --> bb11
298
- bb5_terminal -- "fallthrough" --> bb9
299
- bb10_terminal --> bb9
300
- bb11_terminal --> bb9
301
- bb9_terminal -- "then" --> bb7
302
- bb9_terminal -- "else" --> bb6
303
- bb7_terminal --> bb4
304
- bb6_terminal -- "then" --> bb2
305
- bb6_terminal -- "else" --> bb12
306
- bb12_terminal --> bb4
307
- bb4_terminal --> bb1
308
-
309
-```
310
-
196
## Code
197
198
```javascript
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
-158
@@ -115,37 +115,6 @@ function Component(
115
116
```
117
118
-### CFG
119
-
120
-```mermaid
121
-flowchart TB
122
- %% Basic Blocks
123
- subgraph bb0
124
- bb0_instrs["
125
- [1] Const mutate a_DEBUG$5_@0:TFunction[1:7] = Array []
126
- [2] Call mutate a_DEBUG$5_@0.push(read props$4.a)
127
- "]
128
- bb0_instrs --> bb0_terminal(["If (read props$4.b)"])
129
- end
130
- subgraph bb2
131
- bb2_instrs["
132
- [4] Const mutate $6_@1:TPrimitive = null
133
- "]
134
- bb2_instrs --> bb2_terminal(["Return read $6_@1:TPrimitive"])
135
- end
136
- subgraph bb1
137
- bb1_instrs["
138
- [6] Call mutate a_DEBUG$5_@0.push(read props$4.d)
139
- "]
140
- bb1_instrs --> bb1_terminal(["Return freeze a_DEBUG$5_@0:TFunction"])
141
- end
142
-
143
- %% Jumps
144
- bb0_terminal -- "then" --> bb2
145
- bb0_terminal -- "else" --> bb1
146
-
147
-```
148
-
118
## Code
119
120
```javascript
@@ -202,38 +171,6 @@ function Component(
171
172
```
173
205
-### CFG
206
-
207
-```mermaid
208
-flowchart TB
209
- %% Basic Blocks
210
- subgraph bb0
211
- bb0_instrs["
212
- [1] Const mutate a$4_@0:TFunction[1:7] = Array []
213
- [2] Call mutate a$4_@0.push(read props$3.a)
214
- "]
215
- bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
216
- end
217
- subgraph bb2
218
- bb2_instrs["
219
- [4] Call mutate a$4_@0.push(read props$3.c)
220
- "]
221
- bb2_instrs --> bb2_terminal(["Goto"])
222
- end
223
- subgraph bb1
224
- bb1_instrs["
225
- [6] Call mutate a$4_@0.push(read props$3.d)
226
- "]
227
- bb1_instrs --> bb1_terminal(["Return freeze a$4_@0:TFunction"])
228
- end
229
-
230
- %% Jumps
231
- bb0_terminal -- "then" --> bb2
232
- bb0_terminal -- "else" --> bb1
233
- bb2_terminal --> bb1
234
-
235
-```
236
-
174
## Code
175
176
```javascript
@@ -293,38 +230,6 @@ function Component(
230
231
```
232
296
-### CFG
297
-
298
-```mermaid
299
-flowchart TB
300
- %% Basic Blocks
301
- subgraph bb0
302
- bb0_instrs["
303
- [1] Const mutate a$5_@0:TFunction[1:8] = Array []
304
- [2] Call mutate a$5_@0.push(read props$4.a)
305
- "]
306
- bb0_instrs --> bb0_terminal(["If (read props$4.b)"])
307
- end
308
- subgraph bb2
309
- bb2_instrs["
310
- [4] Call mutate a$5_@0.push(read props$4.c)
311
- [5] Const mutate $6_@1:TPrimitive = null
312
- "]
313
- bb2_instrs --> bb2_terminal(["Return read $6_@1:TPrimitive"])
314
- end
315
- subgraph bb1
316
- bb1_instrs["
317
- [7] Call mutate a$5_@0.push(read props$4.d)
318
- "]
319
- bb1_instrs --> bb1_terminal(["Return freeze a$5_@0:TFunction"])
320
- end
321
-
322
- %% Jumps
323
- bb0_terminal -- "then" --> bb2
324
- bb0_terminal -- "else" --> bb1
325
-
326
-```
327
-
233
## Code
234
235
```javascript
@@ -383,37 +288,6 @@ function Component(
288
289
```
290
386
-### CFG
387
-
388
-```mermaid
389
-flowchart TB
390
- %% Basic Blocks
391
- subgraph bb0
392
- bb0_instrs["
393
- [1] Const mutate a$4_@0:TFunction[1:7] = Array []
394
- [2] Call mutate a$4_@0.push(read props$3.a)
395
- "]
396
- bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
397
- end
398
- subgraph bb2
399
- bb2_instrs["
400
- [4] Call mutate a$4_@0.push(read props$3.c)
401
- "]
402
- bb2_instrs --> bb2_terminal(["Return freeze a$4_@0:TFunction"])
403
- end
404
- subgraph bb1
405
- bb1_instrs["
406
- [6] Call mutate a$4_@0.push(read props$3.d)
407
- "]
408
- bb1_instrs --> bb1_terminal(["Return freeze a$4_@0:TFunction"])
409
- end
410
-
411
- %% Jumps
412
- bb0_terminal -- "then" --> bb2
413
- bb0_terminal -- "else" --> bb1
414
-
415
-```
416
-
291
## Code
292
293
```javascript
@@ -470,38 +344,6 @@ function Component(
344
345
```
346
473
-### CFG
474
-
475
-```mermaid
476
-flowchart TB
477
- %% Basic Blocks
478
- subgraph bb0
479
- bb0_instrs["
480
- [1] Const mutate a$4_@0:TFunction[1:7] = Array []
481
- [2] Call mutate a$4_@0.push(read props$3.a)
482
- "]
483
- bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
484
- end
485
- subgraph bb2
486
- bb2_instrs["
487
- [4] Call mutate a$4_@0.push(read props$3.c)
488
- "]
489
- bb2_instrs --> bb2_terminal(["Goto"])
490
- end
491
- subgraph bb1
492
- bb1_instrs["
493
- [6] Call mutate a$4_@0.push(read props$3.d)
494
- "]
495
- bb1_instrs --> bb1_terminal(["Return freeze a$4_@0:TFunction"])
496
- end
497
-
498
- %% Jumps
499
- bb0_terminal -- "then" --> bb1
500
- bb0_terminal -- "else" --> bb2
501
- bb2_terminal --> bb1
502
-
503
-```
504
-
347
## Code
348
349
```javascript
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
-115
@@ -82,50 +82,6 @@ function Component(
82
83
```
84
85
-### CFG
86
-
87
-```mermaid
88
-flowchart TB
89
- %% Basic Blocks
90
- subgraph bb0
91
- bb0_instrs["
92
- [1] Const mutate a$7_@0:TFunction[1:9] = Array []
93
- [2] Const mutate b$8_@0:TFunction[1:9] = Array []
94
- "]
95
- bb0_instrs --> bb0_terminal(["If (read b$8_@0:TFunction)"])
96
- end
97
- subgraph bb2
98
- bb2_instrs["
99
- [4] Call mutate a$7_@0.push(read props$6.p0)
100
- "]
101
- bb2_instrs --> bb2_terminal(["Goto"])
102
- end
103
- subgraph bb1
104
- bb1_terminal(["If (read props$6.p1)"])
105
- end
106
- subgraph bb4
107
- bb4_instrs["
108
- [7] Call mutate b$8_@0.push(read props$6.p2)
109
- "]
110
- bb4_instrs --> bb4_terminal(["Goto"])
111
- end
112
- subgraph bb3
113
- bb3_instrs["
114
- [9] Const mutate $16_@2 = JSX <read Foo$4 a={freeze a$7_@0:TFunction} b={freeze b$8_@0:TFunction} ></read Foo$4>
115
- "]
116
- bb3_instrs --> bb3_terminal(["Return read $16_@2"])
117
- end
118
-
119
- %% Jumps
120
- bb0_terminal -- "then" --> bb2
121
- bb0_terminal -- "else" --> bb1
122
- bb2_terminal --> bb1
123
- bb1_terminal -- "then" --> bb4
124
- bb1_terminal -- "else" --> bb3
125
- bb4_terminal --> bb3
126
-
127
-```
128
-
85
## Code
86
87
```javascript
@@ -197,51 +153,6 @@ function Component(
153
154
```
155
200
-### CFG
201
-
202
-```mermaid
203
-flowchart TB
204
- %% Basic Blocks
205
- subgraph bb0
206
- bb0_instrs["
207
- [1] Const mutate a$9_@0:TFunction[1:10] = Array []
208
- [2] Const mutate b$10_@0:TFunction[1:10] = Array []
209
- [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0:TFunction)
210
- "]
211
- bb0_instrs --> bb0_terminal(["If (read $11_@0)"])
212
- end
213
- subgraph bb2
214
- bb2_instrs["
215
- [5] Call mutate a$9_@0.push(read props$8.p0)
216
- "]
217
- bb2_instrs --> bb2_terminal(["Goto"])
218
- end
219
- subgraph bb1
220
- bb1_terminal(["If (read props$8.p1)"])
221
- end
222
- subgraph bb4
223
- bb4_instrs["
224
- [8] Call mutate b$10_@0.push(read props$8.p2)
225
- "]
226
- bb4_instrs --> bb4_terminal(["Goto"])
227
- end
228
- subgraph bb3
229
- bb3_instrs["
230
- [10] Const mutate $19_@2 = JSX <read Foo$6 a={freeze a$9_@0:TFunction} b={freeze b$10_@0:TFunction} ></read Foo$6>
231
- "]
232
- bb3_instrs --> bb3_terminal(["Return read $19_@2"])
233
- end
234
-
235
- %% Jumps
236
- bb0_terminal -- "then" --> bb2
237
- bb0_terminal -- "else" --> bb1
238
- bb2_terminal --> bb1
239
- bb1_terminal -- "then" --> bb4
240
- bb1_terminal -- "else" --> bb3
241
- bb4_terminal --> bb3
242
-
243
-```
244
-
156
## Code
157
158
```javascript
@@ -278,19 +189,6 @@ function Foo(
189
190
```
191
281
-### CFG
282
-
283
-```mermaid
284
-flowchart TB
285
- %% Basic Blocks
286
- subgraph bb0
287
- bb0_terminal(["Return"])
288
- end
289
-
290
- %% Jumps
291
- %% empty
292
-```
293
-
192
## Code
193
194
```javascript
@@ -315,19 +213,6 @@ function mayMutate(
213
214
```
215
318
-### CFG
319
-
320
-```mermaid
321
-flowchart TB
322
- %% Basic Blocks
323
- subgraph bb0
324
- bb0_terminal(["Return"])
325
- end
326
-
327
- %% Jumps
328
- %% empty
329
-```
330
-
216
## Code
217
218
```javascript
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
-36
@@ -33,19 +33,6 @@ function Foo(
33
34
```
35
36
-### CFG
37
-
38
-```mermaid
39
-flowchart TB
40
- %% Basic Blocks
41
- subgraph bb0
42
- bb0_terminal(["Return"])
43
- end
44
-
45
- %% Jumps
46
- %% empty
47
-```
48
-
36
## Code
37
38
```javascript
@@ -98,29 +85,6 @@ function Component(
85
86
```
87
101
-### CFG
102
-
103
-```mermaid
104
-flowchart TB
105
- %% Basic Blocks
106
- subgraph bb0
107
- bb0_instrs["
108
- [1] Const mutate a$10_@0[1:7] = Array []
109
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
110
- [3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject)
111
- [4] Const mutate $12_@1:TPrimitive = 'div'
112
- [5] Const mutate _$13_@2 = JSX <read $12_@1:TPrimitive a={freeze a$10_@0} ></read $12_@1:TPrimitive>
113
- [6] New mutate Foo$4(mutate b$11_@0:TObject)
114
- [7] Const mutate $14_@3:TPrimitive = 'div'
115
- [8] Const mutate $15_@4 = JSX <read $14_@3:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14_@3:TPrimitive>
116
- "]
117
- bb0_instrs --> bb0_terminal(["Return read $15_@4"])
118
- end
119
-
120
- %% Jumps
121
- %% empty
122
-```
123
-
88
## Code
89
90
```javascript
compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md
-44
@@ -80,50 +80,6 @@ function foo(
80
81
```
82
83
-### CFG
84
-
85
-```mermaid
86
-flowchart TB
87
- %% Basic Blocks
88
- subgraph bb0
89
- bb0_instrs["
90
- [1] Const mutate x$8_@0:TFunction[1:3] = Array []
91
- [2] Call mutate x$8_@0.push(read a$6)
92
- [3] Const mutate $9_@1:TPrimitive = 'div'
93
- [4] JSX <read $9_@1:TPrimitive>{freeze x$8_@0:TFunction}</read $9_@1:TPrimitive>
94
- [5] Const mutate y$10_@2:TFunction[5:12] = Array []
95
- "]
96
- bb0_instrs --> bb0_terminal(["If (read x$8_@0.length)"])
97
- end
98
- subgraph bb2
99
- bb2_instrs["
100
- [7] Call mutate y$10_@2.push(read x$8_@0:TFunction)
101
- "]
102
- bb2_instrs --> bb2_terminal(["Goto"])
103
- end
104
- subgraph bb1
105
- bb1_terminal(["If (read b$7:TFunction)"])
106
- end
107
- subgraph bb4
108
- bb4_instrs["
109
- [10] Call mutate y$10_@2.push(read b$7:TFunction)
110
- "]
111
- bb4_instrs --> bb4_terminal(["Goto"])
112
- end
113
- subgraph bb3
114
- bb3_terminal(["Return"])
115
- end
116
-
117
- %% Jumps
118
- bb0_terminal -- "then" --> bb2
119
- bb0_terminal -- "else" --> bb1
120
- bb2_terminal --> bb1
121
- bb1_terminal -- "then" --> bb4
122
- bb1_terminal -- "else" --> bb3
123
- bb4_terminal --> bb3
124
-
125
-```
126
-
83
## Code
84
85
```javascript
compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md
-42
@@ -78,48 +78,6 @@ function foo(
78
79
```
80
81
-### CFG
82
-
83
-```mermaid
84
-flowchart TB
85
- %% Basic Blocks
86
- subgraph bb0
87
- bb0_instrs["
88
- [1] Const mutate items$9_@0:TFunction[1:10] = Array [read z$8]
89
- [2] Call mutate items$9_@0.push(read x$6)
90
- [3] Const mutate items2$10_@1:TFunction[3:7] = Array []
91
- "]
92
- bb0_instrs --> bb0_terminal(["If (read x$6)"])
93
- end
94
- subgraph bb2
95
- bb2_instrs["
96
- [5] Call mutate items2$10_@1.push(read y$7)
97
- "]
98
- bb2_instrs --> bb2_terminal(["Goto"])
99
- end
100
- subgraph bb1
101
- bb1_terminal(["If (read y$7)"])
102
- end
103
- subgraph bb4
104
- bb4_instrs["
105
- [8] Call mutate items$9_@0.push(read x$6)
106
- "]
107
- bb4_instrs --> bb4_terminal(["Goto"])
108
- end
109
- subgraph bb3
110
- bb3_terminal(["Return freeze items2$10_@1:TFunction"])
111
- end
112
-
113
- %% Jumps
114
- bb0_terminal -- "then" --> bb2
115
- bb0_terminal -- "else" --> bb1
116
- bb2_terminal --> bb1
117
- bb1_terminal -- "then" --> bb4
118
- bb1_terminal -- "else" --> bb3
119
- bb4_terminal --> bb3
120
-
121
-```
122
-
81
## Code
82
83
```javascript
compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md
-50
@@ -80,56 +80,6 @@ function foo(
80
81
```
82
83
-### CFG
84
-
85
-```mermaid
86
-flowchart TB
87
- %% Basic Blocks
88
- subgraph bb0
89
- bb0_instrs["
90
- [1] Const mutate x$10_@0:TFunction[1:8] = Array []
91
- "]
92
- bb0_instrs --> bb0_terminal(["If (read a$7)"])
93
- end
94
- subgraph bb2
95
- bb2_terminal(["If (read b$8)"])
96
- end
97
- subgraph bb4
98
- bb4_terminal(["If (read c$9)"])
99
- end
100
- subgraph bb6
101
- bb6_instrs["
102
- [5] Const mutate $11_@1:TPrimitive = 0
103
- [6] Call mutate x$10_@0.push(read $11_@1:TPrimitive)
104
- "]
105
- bb6_instrs --> bb6_terminal(["Goto"])
106
- end
107
- subgraph bb1
108
- bb1_terminal(["If (read a$7.length)"])
109
- end
110
- subgraph bb8
111
- bb8_terminal(["Return read a$7"])
112
- end
113
- subgraph bb7
114
- bb7_instrs["
115
- [10] Const mutate $13_@2:TPrimitive = null
116
- "]
117
- bb7_instrs --> bb7_terminal(["Return read $13_@2:TPrimitive"])
118
- end
119
-
120
- %% Jumps
121
- bb0_terminal -- "then" --> bb2
122
- bb0_terminal -- "else" --> bb1
123
- bb2_terminal -- "then" --> bb4
124
- bb2_terminal -- "else" --> bb1
125
- bb4_terminal -- "then" --> bb6
126
- bb4_terminal -- "else" --> bb1
127
- bb6_terminal --> bb1
128
- bb1_terminal -- "then" --> bb8
129
- bb1_terminal -- "else" --> bb7
130
-
131
-```
132
-
83
## Code
84
85
```javascript
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
-45
@@ -44,25 +44,6 @@ function Component(
44
45
```
46
47
-### CFG
48
-
49
-```mermaid
50
-flowchart TB
51
- %% Basic Blocks
52
- subgraph bb0
53
- bb0_instrs["
54
- [1] Const mutate a$5_@0 = Array []
55
- [2] Const mutate b$6_@1 = read a$5_@0
56
- [3] Call read useFreeze$3:TFunction(freeze a$5_@0)
57
- [4] Call mutate foo$4:TFunction(read b$6_@1)
58
- "]
59
- bb0_instrs --> bb0_terminal(["Return"])
60
- end
61
-
62
- %% Jumps
63
- %% empty
64
-```
65
-
47
## Code
48
49
```javascript
@@ -92,19 +73,6 @@ function useFreeze(
73
74
```
75
95
-### CFG
96
-
97
-```mermaid
98
-flowchart TB
99
- %% Basic Blocks
100
- subgraph bb0
101
- bb0_terminal(["Return"])
102
- end
103
-
104
- %% Jumps
105
- %% empty
106
-```
107
-
76
## Code
77
78
```javascript
@@ -130,19 +98,6 @@ function foo(
98
99
```
100
133
-### CFG
134
-
135
-```mermaid
136
-flowchart TB
137
- %% Basic Blocks
138
- subgraph bb0
139
- bb0_terminal(["Return"])
140
- end
141
-
142
- %% Jumps
143
- %% empty
144
-```
145
-
101
## Code
102
103
```javascript
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
-48
@@ -37,19 +37,6 @@ function useFreeze(
37
38
```
39
40
-### CFG
41
-
42
-```mermaid
43
-flowchart TB
44
- %% Basic Blocks
45
- subgraph bb0
46
- bb0_terminal(["Return"])
47
- end
48
-
49
- %% Jumps
50
- %% empty
51
-```
52
-
40
## Code
41
42
```javascript
@@ -74,19 +61,6 @@ function foo(
61
62
```
63
77
-### CFG
78
-
79
-```mermaid
80
-flowchart TB
81
- %% Basic Blocks
82
- subgraph bb0
83
- bb0_terminal(["Return"])
84
- end
85
-
86
- %% Jumps
87
- %% empty
88
-```
89
-
64
## Code
65
66
```javascript
@@ -141,28 +115,6 @@ function Component(
115
116
```
117
144
-### CFG
145
-
146
-```mermaid
147
-flowchart TB
148
- %% Basic Blocks
149
- subgraph bb0
150
- bb0_instrs["
151
- [1] Const mutate x$11_@0 = Array []
152
- [2] Const mutate y$12_@1 = Call read useFreeze$4:TFunction(freeze x$11_@0)
153
- [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0)
154
- [4] Const mutate $13_@2 = '\n '
155
- [5] Const mutate $14_@3 = '\n '
156
- [6] Const mutate $15_@4 = '\n '
157
- [7] Const mutate $16_@5 = JSX <read Component$0>{read $13_@2}{read x$11_@0}{read $14_@3}{read y$12_@1}{read $15_@4}</read Component$0>
158
- "]
159
- bb0_instrs --> bb0_terminal(["Return read $16_@5"])
160
- end
161
-
162
- %% Jumps
163
- %% empty
164
-```
165
-
118
## Code
119
120
```javascript
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
-45
@@ -43,25 +43,6 @@ function Component(
43
44
```
45
46
-### CFG
47
-
48
-```mermaid
49
-flowchart TB
50
- %% Basic Blocks
51
- subgraph bb0
52
- bb0_instrs["
53
- [1] Const mutate a$4_@0 = Array []
54
- [2] Call read useFreeze$2:TFunction(freeze a$4_@0)
55
- [3] Call read useFreeze$2:TFunction(read a$4_@0)
56
- [4] Call mutate call$3:TFunction(read a$4_@0)
57
- "]
58
- bb0_instrs --> bb0_terminal(["Return read a$4_@0"])
59
- end
60
-
61
- %% Jumps
62
- %% empty
63
-```
64
-
46
## Code
47
48
```javascript
@@ -93,19 +74,6 @@ function useFreeze(
74
75
```
76
96
-### CFG
97
-
98
-```mermaid
99
-flowchart TB
100
- %% Basic Blocks
101
- subgraph bb0
102
- bb0_terminal(["Return"])
103
- end
104
-
105
- %% Jumps
106
- %% empty
107
-```
108
-
77
## Code
78
79
```javascript
@@ -131,19 +99,6 @@ function call(
99
100
```
101
134
-### CFG
135
-
136
-```mermaid
137
-flowchart TB
138
- %% Basic Blocks
139
- subgraph bb0
140
- bb0_terminal(["Return"])
141
- end
142
-
143
- %% Jumps
144
- %% empty
145
-```
146
-
102
## Code
103
104
```javascript
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
-70
@@ -79,50 +79,6 @@ function Component(
79
80
```
81
82
-### CFG
83
-
84
-```mermaid
85
-flowchart TB
86
- %% Basic Blocks
87
- subgraph bb0
88
- bb0_instrs["
89
- [1] Const mutate cond$8_@0:TProp = read props$7.cond
90
- [2] Const mutate x$9_@1:TProp = read props$7.x
91
- [3] Const mutate a$10_@2:TPrimitive = undefined
92
- [4] Let mutate a$11_@3:TProp[4:9] = undefined
93
- "]
94
- bb0_instrs --> bb0_terminal(["If (read cond$8_@0:TProp)"])
95
- end
96
- subgraph bb2
97
- bb2_instrs["
98
- [5] Reassign mutate a$11_@3:TProp[4:9] = read x$9_@1:TProp
99
- "]
100
- bb2_instrs --> bb2_terminal(["Goto"])
101
- end
102
- subgraph bb3
103
- bb3_instrs["
104
- [7] Reassign mutate a$11_@3:TProp[4:9] = Array []
105
- "]
106
- bb3_instrs --> bb3_terminal(["Goto"])
107
- end
108
- subgraph bb1
109
- bb1_instrs["
110
- [9] Call read useFreeze$5:TFunction(freeze a$11_@3:TProp)
111
- [10] Call read useFreeze$5:TFunction(read a$11_@3:TProp)
112
- [11] Call mutate call$6:TFunction(read a$11_@3:TProp)
113
- "]
114
- bb1_instrs --> bb1_terminal(["Return read a$11_@3:TProp"])
115
- end
116
-
117
- %% Jumps
118
- bb0_terminal -- "then" --> bb2
119
- bb0_terminal -- "else" --> bb3
120
- bb0_terminal -- "fallthrough" --> bb1
121
- bb2_terminal --> bb1
122
- bb3_terminal --> bb1
123
-
124
-```
125
-
82
## Code
83
84
```javascript
@@ -163,19 +119,6 @@ function useFreeze(
119
120
```
121
166
-### CFG
167
-
168
-```mermaid
169
-flowchart TB
170
- %% Basic Blocks
171
- subgraph bb0
172
- bb0_terminal(["Return"])
173
- end
174
-
175
- %% Jumps
176
- %% empty
177
-```
178
-
122
## Code
123
124
```javascript
@@ -201,19 +144,6 @@ function call(
144
145
```
146
204
-### CFG
205
-
206
-```mermaid
207
-flowchart TB
208
- %% Basic Blocks
209
- subgraph bb0
210
- bb0_terminal(["Return"])
211
- end
212
-
213
- %% Jumps
214
- %% empty
215
-```
216
-
147
## Code
148
149
```javascript
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
-85
@@ -51,19 +51,6 @@ function compute(
51
52
```
53
54
-### CFG
55
-
56
-```mermaid
57
-flowchart TB
58
- %% Basic Blocks
59
- subgraph bb0
60
- bb0_terminal(["Return"])
61
- end
62
-
63
- %% Jumps
64
- %% empty
65
-```
66
-
54
## Code
55
56
```javascript
@@ -88,19 +75,6 @@ function mutate(
75
76
```
77
91
-### CFG
92
-
93
-```mermaid
94
-flowchart TB
95
- %% Basic Blocks
96
- subgraph bb0
97
- bb0_terminal(["Return"])
98
- end
99
-
100
- %% Jumps
101
- %% empty
102
-```
103
-
78
## Code
79
80
```javascript
@@ -125,19 +99,6 @@ function foo(
99
100
```
101
128
-### CFG
129
-
130
-```mermaid
131
-flowchart TB
132
- %% Basic Blocks
133
- subgraph bb0
134
- bb0_terminal(["Return"])
135
- end
136
-
137
- %% Jumps
138
- %% empty
139
-```
140
-
102
## Code
103
104
```javascript
@@ -162,19 +123,6 @@ function Foo(
123
124
```
125
165
-### CFG
166
-
167
-```mermaid
168
-flowchart TB
169
- %% Basic Blocks
170
- subgraph bb0
171
- bb0_terminal(["Return"])
172
- end
173
-
174
- %% Jumps
175
- %% empty
176
-```
177
-
126
## Code
127
128
```javascript
@@ -226,39 +174,6 @@ function Component(
174
175
```
176
229
-### CFG
230
-
231
-```mermaid
232
-flowchart TB
233
- %% Basic Blocks
234
- subgraph bb0
235
- bb0_instrs["
236
- [1] Const mutate a$9_@1[1:7] = Call mutate compute$3:TFunction(read props$8.a)
237
- [2] Const mutate b$10_@1[1:7] = Call mutate compute$3:TFunction(read props$8.b)
238
- "]
239
- bb0_instrs --> bb0_terminal(["If (read props$8.c)"])
240
- end
241
- subgraph bb2
242
- bb2_instrs["
243
- [4] Call mutate mutate$5:TFunction(mutate a$9_@1)
244
- [5] Call mutate mutate$5:TFunction(mutate b$10_@1)
245
- "]
246
- bb2_instrs --> bb2_terminal(["Goto"])
247
- end
248
- subgraph bb1
249
- bb1_instrs["
250
- [7] Const mutate $14_@2 = JSX <read Foo$6 a={freeze a$9_@1} b={freeze b$10_@1} ></read Foo$6>
251
- "]
252
- bb1_instrs --> bb1_terminal(["Return read $14_@2"])
253
- end
254
-
255
- %% Jumps
256
- bb0_terminal -- "then" --> bb2
257
- bb0_terminal -- "else" --> bb1
258
- bb2_terminal --> bb1
259
-
260
-```
261
-
177
## Code
178
179
```javascript
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
-57
@@ -61,24 +61,6 @@ function Component(
61
62
```
63
64
-### CFG
65
-
66
-```mermaid
67
-flowchart TB
68
- %% Basic Blocks
69
- subgraph bb0
70
- bb0_instrs["
71
- [1] Const mutate a$8_@0 = Call mutate compute$3:TFunction(read props$7.a)
72
- [2] Const mutate b$9_@1 = Call mutate compute$3:TFunction(read props$7.b)
73
- [3] Const mutate $10_@2 = JSX <read Foo$5 a={freeze a$8_@0} b={freeze b$9_@1} ></read Foo$5>
74
- "]
75
- bb0_instrs --> bb0_terminal(["Return read $10_@2"])
76
- end
77
-
78
- %% Jumps
79
- %% empty
80
-```
81
-
64
## Code
65
66
```javascript
@@ -107,19 +89,6 @@ function compute(
89
90
```
91
110
-### CFG
111
-
112
-```mermaid
113
-flowchart TB
114
- %% Basic Blocks
115
- subgraph bb0
116
- bb0_terminal(["Return"])
117
- end
118
-
119
- %% Jumps
120
- %% empty
121
-```
122
-
92
## Code
93
94
```javascript
@@ -144,19 +113,6 @@ function foo(
113
114
```
115
147
-### CFG
148
-
149
-```mermaid
150
-flowchart TB
151
- %% Basic Blocks
152
- subgraph bb0
153
- bb0_terminal(["Return"])
154
- end
155
-
156
- %% Jumps
157
- %% empty
158
-```
159
-
116
## Code
117
118
```javascript
@@ -181,19 +137,6 @@ function Foo(
137
138
```
139
184
-### CFG
185
-
186
-```mermaid
187
-flowchart TB
188
- %% Basic Blocks
189
- subgraph bb0
190
- bb0_terminal(["Return"])
191
- end
192
-
193
- %% Jumps
194
- %% empty
195
-```
196
-
140
## Code
141
142
```javascript
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
-71
@@ -45,19 +45,6 @@ function compute(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_terminal(["Return"])
55
- end
56
-
57
- %% Jumps
58
- %% empty
59
-```
60
-
48
## Code
49
50
```javascript
@@ -82,19 +69,6 @@ function foo(
69
70
```
71
85
-### CFG
86
-
87
-```mermaid
88
-flowchart TB
89
- %% Basic Blocks
90
- subgraph bb0
91
- bb0_terminal(["Return"])
92
- end
93
-
94
- %% Jumps
95
- %% empty
96
-```
97
-
72
## Code
73
74
```javascript
@@ -119,19 +93,6 @@ function Foo(
93
94
```
95
122
-### CFG
123
-
124
-```mermaid
125
-flowchart TB
126
- %% Basic Blocks
127
- subgraph bb0
128
- bb0_terminal(["Return"])
129
- end
130
-
131
- %% Jumps
132
- %% empty
133
-```
134
-
96
## Code
97
98
```javascript
@@ -183,38 +144,6 @@ function Component(
144
145
```
146
186
-### CFG
187
-
188
-```mermaid
189
-flowchart TB
190
- %% Basic Blocks
191
- subgraph bb0
192
- bb0_instrs["
193
- [1] Const mutate a$9_@0[1:6] = Call mutate compute$3:TFunction(read props$8.a)
194
- [2] Const mutate b$10_@0[1:6] = Call mutate compute$3:TFunction(read props$8.b)
195
- "]
196
- bb0_instrs --> bb0_terminal(["If (read props$8.c)"])
197
- end
198
- subgraph bb2
199
- bb2_instrs["
200
- [4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
201
- "]
202
- bb2_instrs --> bb2_terminal(["Goto"])
203
- end
204
- subgraph bb1
205
- bb1_instrs["
206
- [6] Const mutate $14_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
207
- "]
208
- bb1_instrs --> bb1_terminal(["Return read $14_@1"])
209
- end
210
-
211
- %% Jumps
212
- bb0_terminal -- "then" --> bb2
213
- bb0_terminal -- "else" --> bb1
214
- bb2_terminal --> bb1
215
-
216
-```
217
-
147
## Code
148
149
```javascript
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
-58
@@ -60,25 +60,6 @@ function Component(
60
61
```
62
63
-### CFG
64
-
65
-```mermaid
66
-flowchart TB
67
- %% Basic Blocks
68
- subgraph bb0
69
- bb0_instrs["
70
- [1] Const mutate a$9_@0[1:4] = Call mutate compute$3:TFunction(read props$8.a)
71
- [2] Const mutate b$10_@0[1:4] = Call mutate compute$3:TFunction(read props$8.b)
72
- [3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
73
- [4] Const mutate $11_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
74
- "]
75
- bb0_instrs --> bb0_terminal(["Return read $11_@1"])
76
- end
77
-
78
- %% Jumps
79
- %% empty
80
-```
81
-
63
## Code
64
65
```javascript
@@ -108,19 +89,6 @@ function compute(
89
90
```
91
111
-### CFG
112
-
113
-```mermaid
114
-flowchart TB
115
- %% Basic Blocks
116
- subgraph bb0
117
- bb0_terminal(["Return"])
118
- end
119
-
120
- %% Jumps
121
- %% empty
122
-```
123
-
92
## Code
93
94
```javascript
@@ -145,19 +113,6 @@ function foo(
113
114
```
115
148
-### CFG
149
-
150
-```mermaid
151
-flowchart TB
152
- %% Basic Blocks
153
- subgraph bb0
154
- bb0_terminal(["Return"])
155
- end
156
-
157
- %% Jumps
158
- %% empty
159
-```
160
-
116
## Code
117
118
```javascript
@@ -182,19 +137,6 @@ function Foo(
137
138
```
139
185
-### CFG
186
-
187
-```mermaid
188
-flowchart TB
189
- %% Basic Blocks
190
- subgraph bb0
191
- bb0_terminal(["Return"])
192
- end
193
-
194
- %% Jumps
195
- %% empty
196
-```
197
-
140
## Code
141
142
```javascript
compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md
-33
@@ -57,39 +57,6 @@ function foo(
57
58
```
59
60
-### CFG
61
-
62
-```mermaid
63
-flowchart TB
64
- %% Basic Blocks
65
- subgraph bb0
66
- bb0_instrs["
67
- [1] Const mutate y$8_@0:TFunction[1:6] = Array []
68
- "]
69
- bb0_instrs --> bb0_terminal(["If (read a$5)"])
70
- end
71
- subgraph bb3
72
- bb3_terminal(["If (read b$6)"])
73
- end
74
- subgraph bb5
75
- bb5_instrs["
76
- [4] Call mutate y$8_@0.push(read c$7)
77
- "]
78
- bb5_instrs --> bb5_terminal(["Goto"])
79
- end
80
- subgraph bb1
81
- bb1_terminal(["Return"])
82
- end
83
-
84
- %% Jumps
85
- bb0_terminal -- "then" --> bb3
86
- bb0_terminal -- "else" --> bb1
87
- bb3_terminal -- "then" --> bb5
88
- bb3_terminal -- "else" --> bb1
89
- bb5_terminal --> bb1
90
-
91
-```
92
-
60
## Code
61
62
```javascript
compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md
-19
@@ -45,25 +45,6 @@ function Component(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_instrs["
55
- [1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 }
56
- [2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject)
57
- [3] Const mutate a$8_@1:TObject = read x$7_@0:TObject
58
- [4] Const mutate b$9_@2:TObject = read a$8_@1:TObject
59
- "]
60
- bb0_instrs --> bb0_terminal(["Return"])
61
- end
62
-
63
- %% Jumps
64
- %% empty
65
-```
66
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
-26
@@ -75,32 +75,6 @@ function Foo(
75
76
```
77
78
-### CFG
79
-
80
-```mermaid
81
-flowchart TB
82
- %% Basic Blocks
83
- subgraph bb0
84
- bb0_instrs["
85
- [1] Const mutate $14_@0 = '\n Hello '
86
- [2] Const mutate $15_@1:TPrimitive = ' '
87
- [3] Const mutate $16_@2 = '\n '
88
- [4] Const mutate $17_@3:TPrimitive = 'div'
89
- [5] Const mutate $18_@4 = '\n '
90
- [6] Const mutate $19_@5 = 'Text'
91
- [7] Const mutate $20_@6 = JsxFragment [read $19_@5]
92
- [8] Const mutate $21_@7 = '\n '
93
- [9] Const mutate $22_@8 = JSX <read $17_@3:TPrimitive>{read $18_@4}{read $20_@6}{read $21_@7}</read $17_@3:TPrimitive>
94
- [10] Const mutate $23_@9 = '\n '
95
- [11] Const mutate $24_@10 = JsxFragment [read $14_@0, read props$13.greeting, read $15_@1:TPrimitive, read $16_@2, read $22_@8, read $23_@9]
96
- "]
97
- bb0_instrs --> bb0_terminal(["Return read $24_@10"])
98
- end
99
-
100
- %% Jumps
101
- %% empty
102
-```
103
-
78
## Code
79
80
```javascript
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
-139
@@ -63,43 +63,6 @@ function And(
63
64
```
65
66
-### CFG
67
-
68
-```mermaid
69
-flowchart TB
70
- %% Basic Blocks
71
- subgraph bb0
72
- bb0_instrs["
73
- [1] Const mutate $5_@0 = Call mutate f$1:TFunction()
74
- [2] Let mutate $6_@1[2:7] = undefined
75
- "]
76
- bb0_instrs --> bb0_terminal(["If (read $5_@0)"])
77
- end
78
- subgraph bb2
79
- bb2_instrs["
80
- [3] Const mutate $6_@1[2:7] = Call mutate g$4:TFunction()
81
- "]
82
- bb2_instrs --> bb2_terminal(["Goto"])
83
- end
84
- subgraph bb3
85
- bb3_instrs["
86
- [5] Const mutate $6_@1[2:7] = read $5_@0
87
- "]
88
- bb3_instrs --> bb3_terminal(["Goto"])
89
- end
90
- subgraph bb1
91
- bb1_terminal(["Return freeze $6_@1"])
92
- end
93
-
94
- %% Jumps
95
- bb0_terminal -- "then" --> bb2
96
- bb0_terminal -- "else" --> bb3
97
- bb0_terminal -- "fallthrough" --> bb1
98
- bb2_terminal --> bb1
99
- bb3_terminal --> bb1
100
-
101
-```
102
-
66
## Code
67
68
```javascript
@@ -155,43 +118,6 @@ function Or(
118
119
```
120
158
-### CFG
159
-
160
-```mermaid
161
-flowchart TB
162
- %% Basic Blocks
163
- subgraph bb0
164
- bb0_instrs["
165
- [1] Const mutate $5_@0 = Call mutate f$1:TFunction()
166
- [2] Let mutate $6_@1[2:7] = undefined
167
- "]
168
- bb0_instrs --> bb0_terminal(["If (read $5_@0)"])
169
- end
170
- subgraph bb2
171
- bb2_instrs["
172
- [3] Const mutate $6_@1[2:7] = read $5_@0
173
- "]
174
- bb2_instrs --> bb2_terminal(["Goto"])
175
- end
176
- subgraph bb3
177
- bb3_instrs["
178
- [5] Const mutate $6_@1[2:7] = Call mutate g$4:TFunction()
179
- "]
180
- bb3_instrs --> bb3_terminal(["Goto"])
181
- end
182
- subgraph bb1
183
- bb1_terminal(["Return freeze $6_@1"])
184
- end
185
-
186
- %% Jumps
187
- bb0_terminal -- "then" --> bb2
188
- bb0_terminal -- "else" --> bb3
189
- bb0_terminal -- "fallthrough" --> bb1
190
- bb2_terminal --> bb1
191
- bb3_terminal --> bb1
192
-
193
-```
194
-
121
## Code
122
123
```javascript
@@ -255,45 +181,6 @@ function QuestionQuestion(
181
182
```
183
258
-### CFG
259
-
260
-```mermaid
261
-flowchart TB
262
- %% Basic Blocks
263
- subgraph bb0
264
- bb0_instrs["
265
- [1] Const mutate $9_@0:TPrimitive = Call mutate f$2:TFunction()
266
- [2] Const mutate $10_@1:TPrimitive = null
267
- [3] Const mutate $11_@2:TPrimitive = Binary read $9_@0:TPrimitive != read $10_@1:TPrimitive
268
- [4] Let mutate $12_@3:TPrimitive[4:9] = undefined
269
- "]
270
- bb0_instrs --> bb0_terminal(["If (read $11_@2:TPrimitive)"])
271
- end
272
- subgraph bb2
273
- bb2_instrs["
274
- [5] Const mutate $12_@3:TPrimitive[4:9] = read $9_@0:TPrimitive
275
- "]
276
- bb2_instrs --> bb2_terminal(["Goto"])
277
- end
278
- subgraph bb3
279
- bb3_instrs["
280
- [7] Const mutate $12_@3:TPrimitive[4:9] = Call mutate g$7:TFunction()
281
- "]
282
- bb3_instrs --> bb3_terminal(["Goto"])
283
- end
284
- subgraph bb1
285
- bb1_terminal(["Return freeze $12_@3:TPrimitive"])
286
- end
287
-
288
- %% Jumps
289
- bb0_terminal -- "then" --> bb2
290
- bb0_terminal -- "else" --> bb3
291
- bb0_terminal -- "fallthrough" --> bb1
292
- bb2_terminal --> bb1
293
- bb3_terminal --> bb1
294
-
295
-```
296
-
184
## Code
185
186
```javascript
@@ -323,19 +210,6 @@ function f(
210
211
```
212
326
-### CFG
327
-
328
-```mermaid
329
-flowchart TB
330
- %% Basic Blocks
331
- subgraph bb0
332
- bb0_terminal(["Return"])
333
- end
334
-
335
- %% Jumps
336
- %% empty
337
-```
338
-
213
## Code
214
215
```javascript
@@ -360,19 +234,6 @@ function g(
234
235
```
236
363
-### CFG
364
-
365
-```mermaid
366
-flowchart TB
367
- %% Basic Blocks
368
- subgraph bb0
369
- bb0_terminal(["Return"])
370
- end
371
-
372
- %% Jumps
373
- %% empty
374
-```
375
-
237
## Code
238
239
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
-101
@@ -59,19 +59,6 @@ function mutate(
59
60
```
61
62
-### CFG
63
-
64
-```mermaid
65
-flowchart TB
66
- %% Basic Blocks
67
- subgraph bb0
68
- bb0_terminal(["Return"])
69
- end
70
-
71
- %% Jumps
72
- %% empty
73
-```
74
-
62
## Code
63
64
```javascript
@@ -97,19 +84,6 @@ function cond(
84
85
```
86
100
-### CFG
101
-
102
-```mermaid
103
-flowchart TB
104
- %% Basic Blocks
105
- subgraph bb0
106
- bb0_terminal(["Return"])
107
- end
108
-
109
- %% Jumps
110
- %% empty
111
-```
112
-
87
## Code
88
89
```javascript
@@ -206,81 +180,6 @@ function Component(
180
181
```
182
209
-### CFG
210
-
211
-```mermaid
212
-flowchart TB
213
- %% Basic Blocks
214
- subgraph bb0
215
- bb0_instrs["
216
- [1] Let mutate a$18_@0[1:23] = Object { }
217
- [2] Let mutate b$20_@0[1:23] = Object { }
218
- [3] Let mutate c$22_@0:TPrimitive[1:23] = Object { }
219
- [4] Let mutate d$24_@0[1:23] = Object { }
220
- "]
221
- bb0_instrs --> bb0_terminal(["While"])
222
- end
223
- subgraph bb1
224
- bb1_instrs["
225
- [6] Const mutate $17_@1:TPrimitive[6:8] = true
226
- "]
227
- bb1_instrs --> bb1_terminal(["If (read $17_@1:TPrimitive)"])
228
- end
229
- subgraph bb3
230
- bb3_instrs["
231
- [8] Const mutate z$19_@0[1:23] = read a$18_@0
232
- [9] Reassign mutate a$18_@0[1:23] = read b$20_@0
233
- [10] Reassign mutate b$20_@0[1:23] = read c$22_@0:TPrimitive
234
- [11] Reassign mutate c$22_@0:TPrimitive[1:23] = read d$24_@0
235
- [12] Reassign mutate d$24_@0[1:23] = read z$19_@0
236
- [13] Call mutate mutate$7:TFunction(mutate a$18_@0, mutate b$20_@0)
237
- [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$18_@0)
238
- "]
239
- bb3_instrs --> bb3_terminal(["If (read $29_@0)"])
240
- end
241
- subgraph bb4
242
- bb4_terminal(["Goto"])
243
- end
244
- subgraph bb2
245
- bb2_terminal(["If (read a$18_@0)"])
246
- end
247
- subgraph bb7
248
- bb7_terminal(["If (read b$20_@0)"])
249
- end
250
- subgraph bb9
251
- bb9_terminal(["If (read c$22_@0:TPrimitive)"])
252
- end
253
- subgraph bb11
254
- bb11_terminal(["If (read d$24_@0)"])
255
- end
256
- subgraph bb13
257
- bb13_instrs["
258
- [21] Const mutate $34_@2:TPrimitive = null
259
- [22] Call mutate mutate$7:TFunction(mutate d$24_@0, read $34_@2:TPrimitive)
260
- "]
261
- bb13_instrs --> bb13_terminal(["Return"])
262
- end
263
-
264
- %% Jumps
265
- bb0_terminal -- "test" --> bb1
266
- bb0_terminal -- "loop" --> bb3
267
- bb0_terminal -- "fallthrough" --> bb2
268
- bb1_terminal -- "then" --> bb3
269
- bb1_terminal -- "else" --> bb2
270
- bb3_terminal -- "then" --> bb2
271
- bb3_terminal -- "else" --> bb4
272
- bb4_terminal --> bb1
273
- bb2_terminal -- "then" --> bb7
274
- bb2_terminal -- "else" --> bb7
275
- bb7_terminal -- "then" --> bb9
276
- bb7_terminal -- "else" --> bb9
277
- bb9_terminal -- "then" --> bb11
278
- bb9_terminal -- "else" --> bb11
279
- bb11_terminal -- "then" --> bb13
280
- bb11_terminal -- "else" --> bb13
281
-
282
-```
283
-
183
## Code
184
185
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
-64
@@ -55,19 +55,6 @@ function mutate(
55
56
```
57
58
-### CFG
59
-
60
-```mermaid
61
-flowchart TB
62
- %% Basic Blocks
63
- subgraph bb0
64
- bb0_terminal(["Return"])
65
- end
66
-
67
- %% Jumps
68
- %% empty
69
-```
70
-
58
## Code
59
60
```javascript
@@ -144,57 +131,6 @@ function Component(
131
132
```
133
147
-### CFG
148
-
149
-```mermaid
150
-flowchart TB
151
- %% Basic Blocks
152
- subgraph bb0
153
- bb0_instrs["
154
- [1] Const mutate a$11_@0:TObject = Object { }
155
- [2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject]
156
- [3] Const mutate c$13_@2:TObject = Object { }
157
- [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject }
158
- [5] Const mutate x$15_@1:TObject[2:15] = Object { }
159
- [6] Reassign mutate x$15_@1.b[2:15] = read b$12_@1
160
- [7] Const mutate y$16_@1[2:15] = Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject)
161
- "]
162
- bb0_instrs --> bb0_terminal(["If (read a$11_@0:TObject)"])
163
- end
164
- subgraph bb1
165
- bb1_terminal(["If (read b$12_@1)"])
166
- end
167
- subgraph bb3
168
- bb3_terminal(["If (read c$13_@2:TObject)"])
169
- end
170
- subgraph bb5
171
- bb5_terminal(["If (read d$14_@1:TObject)"])
172
- end
173
- subgraph bb7
174
- bb7_terminal(["If (read y$16_@1)"])
175
- end
176
- subgraph bb9
177
- bb9_instrs["
178
- [13] Const mutate $17_@3:TPrimitive = null
179
- [14] Call mutate mutate$8:TFunction(mutate x$15_@1:TObject, read $17_@3:TPrimitive)
180
- "]
181
- bb9_instrs --> bb9_terminal(["Return"])
182
- end
183
-
184
- %% Jumps
185
- bb0_terminal -- "then" --> bb1
186
- bb0_terminal -- "else" --> bb1
187
- bb1_terminal -- "then" --> bb3
188
- bb1_terminal -- "else" --> bb3
189
- bb3_terminal -- "then" --> bb5
190
- bb3_terminal -- "else" --> bb5
191
- bb5_terminal -- "then" --> bb7
192
- bb5_terminal -- "else" --> bb7
193
- bb7_terminal -- "then" --> bb9
194
- bb7_terminal -- "else" --> bb9
195
-
196
-```
197
-
134
## Code
135
136
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
-96
@@ -52,19 +52,6 @@ function mutate(
52
53
```
54
55
-### CFG
56
-
57
-```mermaid
58
-flowchart TB
59
- %% Basic Blocks
60
- subgraph bb0
61
- bb0_terminal(["Return"])
62
- end
63
-
64
- %% Jumps
65
- %% empty
66
-```
67
-
55
## Code
56
57
```javascript
@@ -89,19 +76,6 @@ function cond(
76
77
```
78
92
-### CFG
93
-
94
-```mermaid
95
-flowchart TB
96
- %% Basic Blocks
97
- subgraph bb0
98
- bb0_terminal(["Return"])
99
- end
100
-
101
- %% Jumps
102
- %% empty
103
-```
104
-
79
## Code
80
81
```javascript
@@ -190,76 +164,6 @@ function Component(
164
165
```
166
193
-### CFG
194
-
195
-```mermaid
196
-flowchart TB
197
- %% Basic Blocks
198
- subgraph bb0
199
- bb0_instrs["
200
- [1] Const mutate a$12_@0:TObject[1:18] = Object { }
201
- [2] Const mutate b$13_@0:TObject[1:18] = Object { }
202
- [3] Const mutate c$14_@1:TObject = Object { }
203
- [4] Const mutate d$15_@0:TObject[1:18] = Object { }
204
- "]
205
- bb0_instrs --> bb0_terminal(["While"])
206
- end
207
- subgraph bb1
208
- bb1_instrs["
209
- [6] Const mutate $16_@3:TPrimitive[6:8] = true
210
- "]
211
- bb1_instrs --> bb1_terminal(["If (read $16_@3:TPrimitive)"])
212
- end
213
- subgraph bb3
214
- bb3_instrs["
215
- [8] Call mutate mutate$6:TFunction(mutate a$12_@0:TObject, mutate b$13_@0:TObject)
216
- [9] Const mutate $21_@0[1:18] = Call mutate cond$7:TFunction(mutate a$12_@0:TObject)
217
- "]
218
- bb3_instrs --> bb3_terminal(["If (read $21_@0)"])
219
- end
220
- subgraph bb4
221
- bb4_terminal(["Goto"])
222
- end
223
- subgraph bb2
224
- bb2_terminal(["If (read a$12_@0:TObject)"])
225
- end
226
- subgraph bb7
227
- bb7_terminal(["If (read b$13_@0:TObject)"])
228
- end
229
- subgraph bb9
230
- bb9_terminal(["If (read c$14_@1:TObject)"])
231
- end
232
- subgraph bb11
233
- bb11_terminal(["If (read d$15_@0:TObject)"])
234
- end
235
- subgraph bb13
236
- bb13_instrs["
237
- [16] Const mutate $28_@4:TPrimitive = null
238
- [17] Call mutate mutate$6:TFunction(mutate d$15_@0:TObject, read $28_@4:TPrimitive)
239
- "]
240
- bb13_instrs --> bb13_terminal(["Return"])
241
- end
242
-
243
- %% Jumps
244
- bb0_terminal -- "test" --> bb1
245
- bb0_terminal -- "loop" --> bb3
246
- bb0_terminal -- "fallthrough" --> bb2
247
- bb1_terminal -- "then" --> bb3
248
- bb1_terminal -- "else" --> bb2
249
- bb3_terminal -- "then" --> bb2
250
- bb3_terminal -- "else" --> bb4
251
- bb4_terminal --> bb1
252
- bb2_terminal -- "then" --> bb7
253
- bb2_terminal -- "else" --> bb7
254
- bb7_terminal -- "then" --> bb9
255
- bb7_terminal -- "else" --> bb9
256
- bb9_terminal -- "then" --> bb11
257
- bb9_terminal -- "else" --> bb11
258
- bb11_terminal -- "then" --> bb13
259
- bb11_terminal -- "else" --> bb13
260
-
261
-```
262
-
167
## Code
168
169
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md
-26
@@ -51,32 +51,6 @@ function foo(
51
52
```
53
54
-### CFG
55
-
56
-```mermaid
57
-flowchart TB
58
- %% Basic Blocks
59
- subgraph bb0
60
- bb0_instrs["
61
- [1] Const mutate x$9_@0:TFunction[1:6] = Array []
62
- [2] Const mutate y$10_@0:TFunction[1:6] = Array []
63
- "]
64
- bb0_instrs --> bb0_terminal(["If (read x$9_@0:TFunction)"])
65
- end
66
- subgraph bb1
67
- bb1_instrs["
68
- [4] Call mutate y$10_@0.push(read a$6)
69
- [5] Call mutate x$9_@0.push(read b$7)
70
- "]
71
- bb1_instrs --> bb1_terminal(["Return"])
72
- end
73
-
74
- %% Jumps
75
- bb0_terminal -- "then" --> bb1
76
- bb0_terminal -- "else" --> bb1
77
-
78
-```
79
-
54
## Code
55
56
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md
-19
@@ -41,25 +41,6 @@ function foo(
41
42
```
43
44
-### CFG
45
-
46
-```mermaid
47
-flowchart TB
48
- %% Basic Blocks
49
- subgraph bb0
50
- bb0_instrs["
51
- [1] Const mutate x$7_@0:TFunction[1:5] = Array []
52
- [2] Const mutate y$8_@0:TFunction[1:5] = Array []
53
- [3] Call mutate x$7_@0.push(read a$5)
54
- [4] Call mutate y$8_@0.push(read b$6)
55
- "]
56
- bb0_instrs --> bb0_terminal(["Return"])
57
- end
58
-
59
- %% Jumps
60
- %% empty
61
-```
62
-
44
## Code
45
46
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md
-19
@@ -45,25 +45,6 @@ function foo(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_instrs["
55
- [1] Const mutate x$7_@0:TFunction[1:5] = Array []
56
- [2] Const mutate y$8_@1:TFunction[2:4] = Array []
57
- [3] Call mutate y$8_@1.push(read b$6)
58
- [4] Call mutate x$7_@0.push(read a$5)
59
- "]
60
- bb0_instrs --> bb0_terminal(["Return"])
61
- end
62
-
63
- %% Jumps
64
- %% empty
65
-```
66
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md
-45
@@ -79,51 +79,6 @@ function foo(
79
80
```
81
82
-### CFG
83
-
84
-```mermaid
85
-flowchart TB
86
- %% Basic Blocks
87
- subgraph bb0
88
- bb0_instrs["
89
- [1] Const mutate x$11_@0:TFunction[1:11] = Array []
90
- "]
91
- bb0_instrs --> bb0_terminal(["If (read a$8)"])
92
- end
93
- subgraph bb2
94
- bb2_instrs["
95
- [3] Const mutate y$12_@1:TFunction[3:7] = Array []
96
- "]
97
- bb2_instrs --> bb2_terminal(["If (read b$9)"])
98
- end
99
- subgraph bb4
100
- bb4_instrs["
101
- [5] Call mutate y$12_@1.push(read c$10)
102
- "]
103
- bb4_instrs --> bb4_terminal(["Goto"])
104
- end
105
- subgraph bb3
106
- bb3_instrs["
107
- [7] Const mutate $13_@2:TPrimitive = 'div'
108
- [8] Const mutate $15_@3 = JSX <read $13_@2:TPrimitive>{freeze y$12_@1:TFunction}</read $13_@2:TPrimitive>
109
- [9] Call mutate x$11_@0.push(read $15_@3)
110
- "]
111
- bb3_instrs --> bb3_terminal(["Goto"])
112
- end
113
- subgraph bb1
114
- bb1_terminal(["Return freeze x$11_@0:TFunction"])
115
- end
116
-
117
- %% Jumps
118
- bb0_terminal -- "then" --> bb2
119
- bb0_terminal -- "else" --> bb1
120
- bb2_terminal -- "then" --> bb4
121
- bb2_terminal -- "else" --> bb3
122
- bb4_terminal --> bb3
123
- bb3_terminal --> bb1
124
-
125
-```
126
-
82
## Code
83
84
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md
-36
@@ -57,42 +57,6 @@ function foo(
57
58
```
59
60
-### CFG
61
-
62
-```mermaid
63
-flowchart TB
64
- %% Basic Blocks
65
- subgraph bb0
66
- bb0_instrs["
67
- [1] Const mutate x$9_@0:TFunction[1:8] = Array []
68
- [2] Const mutate y$10_@0:TFunction[1:8] = Array []
69
- "]
70
- bb0_instrs --> bb0_terminal(["While"])
71
- end
72
- subgraph bb1
73
- bb1_terminal(["If (read c$8)"])
74
- end
75
- subgraph bb3
76
- bb3_instrs["
77
- [5] Call mutate y$10_@0.push(read b$7)
78
- [6] Call mutate x$9_@0.push(read a$6)
79
- "]
80
- bb3_instrs --> bb3_terminal(["Goto"])
81
- end
82
- subgraph bb2
83
- bb2_terminal(["Return"])
84
- end
85
-
86
- %% Jumps
87
- bb0_terminal -- "test" --> bb1
88
- bb0_terminal -- "loop" --> bb3
89
- bb0_terminal -- "fallthrough" --> bb2
90
- bb1_terminal -- "then" --> bb3
91
- bb1_terminal -- "else" --> bb2
92
- bb3_terminal --> bb1
93
-
94
-```
95
-
60
## Code
61
62
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md
-43
@@ -67,49 +67,6 @@ function foo(
67
68
```
69
70
-### CFG
71
-
72
-```mermaid
73
-flowchart TB
74
- %% Basic Blocks
75
- subgraph bb0
76
- bb0_instrs["
77
- [1] Const mutate x$9_@0:TFunction[1:9] = Array []
78
- "]
79
- bb0_instrs --> bb0_terminal(["If (read a$6)"])
80
- end
81
- subgraph bb2
82
- bb2_instrs["
83
- [3] Const mutate y$10_@0:TFunction[1:9] = Array []
84
- "]
85
- bb2_instrs --> bb2_terminal(["If (read b$7)"])
86
- end
87
- subgraph bb4
88
- bb4_instrs["
89
- [5] Call mutate y$10_@0.push(read c$8)
90
- "]
91
- bb4_instrs --> bb4_terminal(["Goto"])
92
- end
93
- subgraph bb3
94
- bb3_instrs["
95
- [7] Call mutate x$9_@0.push(mutate y$10_@0:TFunction)
96
- "]
97
- bb3_instrs --> bb3_terminal(["Goto"])
98
- end
99
- subgraph bb1
100
- bb1_terminal(["Return freeze x$9_@0:TFunction"])
101
- end
102
-
103
- %% Jumps
104
- bb0_terminal -- "then" --> bb2
105
- bb0_terminal -- "else" --> bb1
106
- bb2_terminal -- "then" --> bb4
107
- bb2_terminal -- "else" --> bb3
108
- bb4_terminal --> bb3
109
- bb3_terminal --> bb1
110
-
111
-```
112
-
70
## Code
71
72
```javascript
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
-21
@@ -54,27 +54,6 @@ function Component(
54
55
```
56
57
-### CFG
58
-
59
-```mermaid
60
-flowchart TB
61
- %% Basic Blocks
62
- subgraph bb0
63
- bb0_instrs["
64
- [1] Const mutate x$7_@0:TObject[1:6] = Object { }
65
- [2] Const mutate y$8_@0[1:6] = Array []
66
- [3] Reassign mutate x$7_@0.y[1:6] = read y$8_@0
67
- [4] Const mutate child$9_@0[1:6] = JSX <read Component$0 data={freeze y$8_@0} ></read Component$0>
68
- [5] Call mutate x$7_@0.y.push(read props$6.p0)
69
- [6] Const mutate $10_@1 = JSX <read Component$0 data={freeze x$7_@0:TObject} >{read child$9_@0}</read Component$0>
70
- "]
71
- bb0_instrs --> bb0_terminal(["Return read $10_@1"])
72
- end
73
-
74
- %% Jumps
75
- %% empty
76
-```
77
-
57
## Code
58
59
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
-20
@@ -47,26 +47,6 @@ function foo(
47
48
```
49
50
-### CFG
51
-
52
-```mermaid
53
-flowchart TB
54
- %% Basic Blocks
55
- subgraph bb0
56
- bb0_instrs["
57
- [1] Const mutate x$4_@0:TObject[1:6] = Object { }
58
- [2] Const mutate y$5_@1:TFunction[2:5] = Array []
59
- [3] Const mutate z$6_@1:TObject[2:5] = Object { }
60
- [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject)
61
- [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1:TFunction
62
- "]
63
- bb0_instrs --> bb0_terminal(["Return freeze x$4_@0:TObject"])
64
- end
65
-
66
- %% Jumps
67
- %% empty
68
-```
69
-
50
## Code
51
52
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md
-40
@@ -76,46 +76,6 @@ function foo(
76
77
```
78
79
-### CFG
80
-
81
-```mermaid
82
-flowchart TB
83
- %% Basic Blocks
84
- subgraph bb0
85
- bb0_instrs["
86
- [1] Const mutate x$11_@0:TFunction[1:11] = Array []
87
- "]
88
- bb0_instrs --> bb0_terminal(["If (read a$8)"])
89
- end
90
- subgraph bb2
91
- bb2_instrs["
92
- [3] Const mutate y$12_@1:TFunction[3:5] = Array []
93
- [4] Call mutate y$12_@1.push(read b$9)
94
- [5] Const mutate $13_@2:TPrimitive = 'div'
95
- [6] Const mutate $14_@3 = JSX <read $13_@2:TPrimitive>{freeze y$12_@1:TFunction}</read $13_@2:TPrimitive>
96
- [7] Call mutate x$11_@0.push(read $14_@3)
97
- "]
98
- bb2_instrs --> bb2_terminal(["Goto"])
99
- end
100
- subgraph bb3
101
- bb3_instrs["
102
- [9] Call mutate x$11_@0.push(read c$10)
103
- "]
104
- bb3_instrs --> bb3_terminal(["Goto"])
105
- end
106
- subgraph bb1
107
- bb1_terminal(["Return freeze x$11_@0:TFunction"])
108
- end
109
-
110
- %% Jumps
111
- bb0_terminal -- "then" --> bb2
112
- bb0_terminal -- "else" --> bb3
113
- bb0_terminal -- "fallthrough" --> bb1
114
- bb2_terminal --> bb1
115
- bb3_terminal --> bb1
116
-
117
-```
118
-
79
## Code
80
81
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
-39
@@ -72,45 +72,6 @@ function f(
72
73
```
74
75
-### CFG
76
-
77
-```mermaid
78
-flowchart TB
79
- %% Basic Blocks
80
- subgraph bb0
81
- bb0_instrs["
82
- [1] Const mutate x$10_@0:TFunction[1:8] = Array []
83
- [2] Const mutate $11_@1:TPrimitive = 1
84
- [3] Const mutate $12_@2:TPrimitive = Binary read a$8.length === read $11_@1:TPrimitive
85
- "]
86
- bb0_instrs --> bb0_terminal(["If (read $12_@2:TPrimitive)"])
87
- end
88
- subgraph bb2
89
- bb2_terminal(["If (read b$9)"])
90
- end
91
- subgraph bb4
92
- bb4_instrs["
93
- [6] Call mutate x$10_@0.push(read b$9)
94
- "]
95
- bb4_instrs --> bb4_terminal(["Goto"])
96
- end
97
- subgraph bb1
98
- bb1_instrs["
99
- [8] Const mutate $13_@3:TPrimitive = 'div'
100
- [9] Const mutate $15_@4 = JSX <read $13_@3:TPrimitive>{freeze x$10_@0:TFunction}</read $13_@3:TPrimitive>
101
- "]
102
- bb1_instrs --> bb1_terminal(["Return read $15_@4"])
103
- end
104
-
105
- %% Jumps
106
- bb0_terminal -- "then" --> bb2
107
- bb0_terminal -- "else" --> bb1
108
- bb2_terminal -- "then" --> bb4
109
- bb2_terminal -- "else" --> bb1
110
- bb4_terminal --> bb1
111
-
112
-```
113
-
75
## Code
76
77
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
-35
@@ -77,41 +77,6 @@ function Component(
77
78
```
79
80
-### CFG
81
-
82
-```mermaid
83
-flowchart TB
84
- %% Basic Blocks
85
- subgraph bb0
86
- bb0_instrs["
87
- [1] Let mutate x$7_@0:TFunction[1:7] = Array []
88
- [2] Call mutate x$7_@0.push(read props$6.p0)
89
- [3] Const mutate y$8_@0:TFunction[1:7] = read x$7_@0:TFunction
90
- "]
91
- bb0_instrs --> bb0_terminal(["If (read props$6.p1)"])
92
- end
93
- subgraph bb2
94
- bb2_instrs["
95
- [5] Reassign mutate x$7_@0:TFunction[1:7] = Array []
96
- "]
97
- bb2_instrs --> bb2_terminal(["Goto"])
98
- end
99
- subgraph bb1
100
- bb1_instrs["
101
- [7] Const mutate _$12_@1 = JSX <read Component$0 x={freeze x$7_@0:TFunction} ></read Component$0>
102
- [8] Call read y$8_@0.push(read props$6.p2)
103
- [9] Const mutate $15_@2 = JSX <read Component$0 x={read x$7_@0:TFunction} y={read y$8_@0:TFunction} ></read Component$0>
104
- "]
105
- bb1_instrs --> bb1_terminal(["Return read $15_@2"])
106
- end
107
-
108
- %% Jumps
109
- bb0_terminal -- "then" --> bb2
110
- bb0_terminal -- "else" --> bb1
111
- bb2_terminal --> bb1
112
-
113
-```
114
-
80
## Code
81
82
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md
-63
@@ -132,69 +132,6 @@ function foo(
132
133
```
134
135
-### CFG
136
-
137
-```mermaid
138
-flowchart TB
139
- %% Basic Blocks
140
- subgraph bb0
141
- bb0_instrs["
142
- [1] Const mutate x$16_@0:TFunction[1:5] = Array []
143
- "]
144
- bb0_instrs --> bb0_terminal(["If (read a$13)"])
145
- end
146
- subgraph bb2
147
- bb2_instrs["
148
- [3] Call mutate x$16_@0.push(read a$13)
149
- "]
150
- bb2_instrs --> bb2_terminal(["Goto"])
151
- end
152
- subgraph bb1
153
- bb1_instrs["
154
- [5] Const mutate $17_@1:TPrimitive = 'div'
155
- [6] Const mutate y$19_@2 = JSX <read $17_@1:TPrimitive>{freeze x$16_@0:TFunction}</read $17_@1:TPrimitive>
156
- [7] Const mutate $20_@3:TPrimitive = 0
157
- [8] Let mutate x$22_@4:TFunction[8:15] = undefined
158
- "]
159
- bb1_instrs --> bb1_terminal(["Switch (read b$14)"])
160
- end
161
- subgraph bb5
162
- bb5_instrs["
163
- [9] Reassign mutate x$22_@4:TFunction[8:15] = Array []
164
- [10] Call mutate x$22_@4.push(read b$14)
165
- "]
166
- bb5_instrs --> bb5_terminal(["Goto"])
167
- end
168
- subgraph bb4
169
- bb4_instrs["
170
- [12] Reassign mutate x$22_@4:TFunction[8:15] = Array []
171
- [13] Call mutate x$22_@4.push(read c$15)
172
- "]
173
- bb4_instrs --> bb4_terminal(["Goto"])
174
- end
175
- subgraph bb3
176
- bb3_instrs["
177
- [15] Const mutate $25_@5:TPrimitive = 'div'
178
- [16] Const mutate $26_@6 = '\n '
179
- [17] Const mutate $27_@7 = '\n '
180
- [18] Const mutate $28_@8 = '\n '
181
- [19] Const mutate $31_@9 = JSX <read $25_@5:TPrimitive>{read $26_@6}{read y$19_@2}{read $27_@7}{freeze x$22_@4:TFunction}{read $28_@8}</read $25_@5:TPrimitive>
182
- "]
183
- bb3_instrs --> bb3_terminal(["Return read $31_@9"])
184
- end
185
-
186
- %% Jumps
187
- bb0_terminal -- "then" --> bb2
188
- bb0_terminal -- "else" --> bb1
189
- bb2_terminal --> bb1
190
- bb1_terminal -- "read $20_@3:TPrimitive" --> bb5
191
- bb1_terminal -- "default" --> bb4
192
- bb1_terminal -- "fallthrough" --> bb3
193
- bb5_terminal --> bb3
194
- bb4_terminal --> bb3
195
-
196
-```
197
-
135
## Code
136
137
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
-22
@@ -67,28 +67,6 @@ function Component(
67
68
```
69
70
-### CFG
71
-
72
-```mermaid
73
-flowchart TB
74
- %% Basic Blocks
75
- subgraph bb0
76
- bb0_instrs["
77
- [1] Const mutate x$7_@0:TFunction[1:7] = Array []
78
- [2] Call mutate x$7_@0.push(read props$6.p0)
79
- [3] Const mutate y$8_@0:TFunction[1:7] = read x$7_@0:TFunction
80
- [4] Const mutate x$9_@1 = Array []
81
- [5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$0>
82
- [6] Call mutate y$8_@0.push(read props$6.p1)
83
- [7] Const mutate $11_@3 = JSX <read Component$0 x={read x$9_@1} y={freeze y$8_@0:TFunction} ></read Component$0>
84
- "]
85
- bb0_instrs --> bb0_terminal(["Return read $11_@3"])
86
- end
87
-
88
- %% Jumps
89
- %% empty
90
-```
91
-
70
## Code
71
72
```javascript
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
-80
@@ -130,86 +130,6 @@ function Component(
130
131
```
132
133
-### CFG
134
-
135
-```mermaid
136
-flowchart TB
137
- %% Basic Blocks
138
- subgraph bb0
139
- bb0_instrs["
140
- [1] Const mutate x$7_@0:TPrimitive = undefined
141
- [2] Let mutate x$11_@1:TProp[2:18] = undefined
142
- "]
143
- bb0_instrs --> bb0_terminal(["If (read props$6.cond)"])
144
- end
145
- subgraph bb2
146
- bb2_instrs["
147
- [3] Const mutate $8_@2:TPrimitive = 2
148
- [4] Const mutate $9_@3:TPrimitive = 1
149
- [5] Const mutate $10_@4:TPrimitive = 0
150
- "]
151
- bb2_instrs --> bb2_terminal(["Switch (read props$6.test)"])
152
- end
153
- subgraph bb8
154
- bb8_instrs["
155
- [7] Reassign mutate x$11_@1:TProp[2:18] = read props$6.v0
156
- "]
157
- bb8_instrs --> bb8_terminal(["Goto"])
158
- end
159
- subgraph bb6
160
- bb6_instrs["
161
- [9] Reassign mutate x$11_@1:TProp[2:18] = read props$6.v1
162
- "]
163
- bb6_instrs --> bb6_terminal(["Goto"])
164
- end
165
- subgraph bb4
166
- bb4_instrs["
167
- [11] Reassign mutate x$11_@1:TProp[2:18] = read props$6.v2
168
- "]
169
- bb4_instrs --> bb4_terminal(["Goto"])
170
- end
171
- subgraph bb10
172
- bb10_terminal(["If (read props$6.cond2)"])
173
- end
174
- subgraph bb12
175
- bb12_instrs["
176
- [14] Reassign mutate x$11_@1:TProp[2:18] = read props$6.b
177
- "]
178
- bb12_instrs --> bb12_terminal(["Goto"])
179
- end
180
- subgraph bb13
181
- bb13_instrs["
182
- [16] Reassign mutate x$11_@1:TProp[2:18] = read props$6.c
183
- "]
184
- bb13_instrs --> bb13_terminal(["Goto"])
185
- end
186
- subgraph bb1
187
- bb1_instrs["
188
- [18] read x$11_@1:TProp
189
- "]
190
- bb1_instrs --> bb1_terminal(["Return"])
191
- end
192
-
193
- %% Jumps
194
- bb0_terminal -- "then" --> bb2
195
- bb0_terminal -- "else" --> bb10
196
- bb0_terminal -- "fallthrough" --> bb1
197
- bb2_terminal -- "read $10_@4:TPrimitive" --> bb8
198
- bb2_terminal -- "read $9_@3:TPrimitive" --> bb6
199
- bb2_terminal -- "read $8_@2:TPrimitive" --> bb4
200
- bb2_terminal -- "default" --> bb4
201
- bb2_terminal -- "fallthrough" --> bb1
202
- bb8_terminal --> bb1
203
- bb6_terminal --> bb1
204
- bb4_terminal --> bb1
205
- bb10_terminal -- "then" --> bb12
206
- bb10_terminal -- "else" --> bb13
207
- bb10_terminal -- "fallthrough" --> bb1
208
- bb12_terminal --> bb1
209
- bb13_terminal --> bb1
210
-
211
-```
212
-
133
## Code
134
135
```javascript
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
-35
@@ -34,19 +34,6 @@ function mutate(
34
35
```
36
37
-### CFG
38
-
39
-```mermaid
40
-flowchart TB
41
- %% Basic Blocks
42
- subgraph bb0
43
- bb0_terminal(["Return"])
44
- end
45
-
46
- %% Jumps
47
- %% empty
48
-```
49
-
37
## Code
38
39
```javascript
@@ -89,28 +76,6 @@ function foo(
76
77
```
78
92
-### CFG
93
-
94
-```mermaid
95
-flowchart TB
96
- %% Basic Blocks
97
- subgraph bb0
98
- bb0_instrs["
99
- [1] Const mutate a$5_@0:TObject = Object { }
100
- [2] Const mutate b$6_@1:TObject[2:8] = Object { }
101
- [3] Const mutate c$7_@1:TObject[2:8] = Object { }
102
- [4] Const mutate a$8_@1:TObject[2:8] = read b$6_@1:TObject
103
- [5] Const mutate b$9_@1:TObject[2:8] = read c$7_@1:TObject
104
- [6] Const mutate c$10_@1:TObject[2:8] = read a$8_@1:TObject
105
- [7] Call mutate mutate$4:TFunction(mutate a$8_@1:TObject, mutate b$9_@1:TObject)
106
- "]
107
- bb0_instrs --> bb0_terminal(["Return freeze c$10_@1:TObject"])
108
- end
109
-
110
- %% Jumps
111
- %% empty
112
-```
113
-
79
## Code
80
81
```javascript
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
-30
@@ -62,36 +62,6 @@ function foo(
62
63
```
64
65
-### CFG
66
-
67
-```mermaid
68
-flowchart TB
69
- %% Basic Blocks
70
- subgraph bb0
71
- bb0_terminal(["If (read x$8)"])
72
- end
73
- subgraph bb2
74
- bb2_instrs["
75
- [2] Const mutate $10_@0:TPrimitive = false
76
- [3] Const mutate $11_@1 = Call read foo$0:TFunction(read $10_@0:TPrimitive, read y$9:TPrimitive)
77
- "]
78
- bb2_instrs --> bb2_terminal(["Return freeze $11_@1"])
79
- end
80
- subgraph bb1
81
- bb1_instrs["
82
- [5] Const mutate $12_@2:TPrimitive = 10
83
- [6] Const mutate $13_@3:TPrimitive = Binary read y$9:TPrimitive * read $12_@2:TPrimitive
84
- [7] Const mutate $14_@4 = Array [read $13_@3:TPrimitive]
85
- "]
86
- bb1_instrs --> bb1_terminal(["Return freeze $14_@4"])
87
- end
88
-
89
- %% Jumps
90
- bb0_terminal -- "then" --> bb2
91
- bb0_terminal -- "else" --> bb1
92
-
93
-```
94
-
65
## Code
66
67
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
-18
@@ -40,24 +40,6 @@ function Component(
40
41
```
42
43
-### CFG
44
-
45
-```mermaid
46
-flowchart TB
47
- %% Basic Blocks
48
- subgraph bb0
49
- bb0_instrs["
50
- [1] Const mutate a$6_@0:TPrimitive = 1
51
- [2] Const mutate b$7_@1:TPrimitive = 2
52
- [3] Const mutate x$8_@2 = Array [read a$6_@0:TPrimitive, read b$7_@1:TPrimitive]
53
- "]
54
- bb0_instrs --> bb0_terminal(["Return freeze x$8_@2"])
55
- end
56
-
57
- %% Jumps
58
- %% empty
59
-```
60
-
43
## Code
44
45
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
-50
@@ -36,19 +36,6 @@ function foo(
36
37
```
38
39
-### CFG
40
-
41
-```mermaid
42
-flowchart TB
43
- %% Basic Blocks
44
- subgraph bb0
45
- bb0_terminal(["Return"])
46
- end
47
-
48
- %% Jumps
49
- %% empty
50
-```
51
-
39
## Code
40
41
```javascript
@@ -113,43 +100,6 @@ function Component(
100
101
```
102
116
-### CFG
117
-
118
-```mermaid
119
-flowchart TB
120
- %% Basic Blocks
121
- subgraph bb0
122
- bb0_instrs["
123
- [1] Const mutate a$11_@0[1:10] = Array []
124
- [2] Const mutate b$12_@0:TObject[1:10] = Object { }
125
- [3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject)
126
- [4] Const mutate $13_@1 = Call mutate foo$4:TFunction()
127
- "]
128
- bb0_instrs --> bb0_terminal(["If (read $13_@1)"])
129
- end
130
- subgraph bb2
131
- bb2_instrs["
132
- [6] Const mutate $14_@2:TPrimitive = 'div'
133
- [7] Const mutate _$15_@3 = JSX <read $14_@2:TPrimitive a={freeze a$11_@0} ></read $14_@2:TPrimitive>
134
- "]
135
- bb2_instrs --> bb2_terminal(["Goto"])
136
- end
137
- subgraph bb1
138
- bb1_instrs["
139
- [9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject)
140
- [10] Const mutate $19_@4:TPrimitive = 'div'
141
- [11] Const mutate $20_@5 = JSX <read $19_@4:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19_@4:TPrimitive>
142
- "]
143
- bb1_instrs --> bb1_terminal(["Return read $20_@5"])
144
- end
145
-
146
- %% Jumps
147
- bb0_terminal -- "then" --> bb2
148
- bb0_terminal -- "else" --> bb1
149
- bb2_terminal --> bb1
150
-
151
-```
152
-
103
## Code
104
105
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
-36
@@ -33,19 +33,6 @@ function foo(
33
34
```
35
36
-### CFG
37
-
38
-```mermaid
39
-flowchart TB
40
- %% Basic Blocks
41
- subgraph bb0
42
- bb0_terminal(["Return"])
43
- end
44
-
45
- %% Jumps
46
- %% empty
47
-```
48
-
36
## Code
37
38
```javascript
@@ -98,29 +85,6 @@ function Component(
85
86
```
87
101
-### CFG
102
-
103
-```mermaid
104
-flowchart TB
105
- %% Basic Blocks
106
- subgraph bb0
107
- bb0_instrs["
108
- [1] Const mutate a$10_@0[1:7] = Array []
109
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
110
- [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
111
- [4] Const mutate $12_@1:TPrimitive = 'div'
112
- [5] Const mutate _$13_@2 = JSX <read $12_@1:TPrimitive a={freeze a$10_@0} ></read $12_@1:TPrimitive>
113
- [6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
114
- [7] Const mutate $14_@3:TPrimitive = 'div'
115
- [8] Const mutate $15_@4 = JSX <read $14_@3:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14_@3:TPrimitive>
116
- "]
117
- bb0_instrs --> bb0_terminal(["Return read $15_@4"])
118
- end
119
-
120
- %% Jumps
121
- %% empty
122
-```
123
-
88
## Code
89
90
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
-50
@@ -78,56 +78,6 @@ function foo(
78
79
```
80
81
-### CFG
82
-
83
-```mermaid
84
-flowchart TB
85
- %% Basic Blocks
86
- subgraph bb0
87
- bb0_instrs["
88
- [1] Let mutate x$7_@0:TPrimitive[1:13] = 1
89
- [2] Const mutate y$8_@1:TPrimitive = 2
90
- [3] Const mutate $9_@2:TPrimitive = 2
91
- [4] Const mutate $10_@3:TPrimitive = Binary read y$8_@1:TPrimitive === read $9_@2:TPrimitive
92
- "]
93
- bb0_instrs --> bb0_terminal(["If (read $10_@3:TPrimitive)"])
94
- end
95
- subgraph bb2
96
- bb2_instrs["
97
- [6] Reassign mutate x$7_@0:TPrimitive[1:13] = 3
98
- "]
99
- bb2_instrs --> bb2_terminal(["Goto"])
100
- end
101
- subgraph bb1
102
- bb1_instrs["
103
- [8] Const mutate $12_@4:TPrimitive = 3
104
- [9] Const mutate $14_@5:TPrimitive = Binary read y$8_@1:TPrimitive === read $12_@4:TPrimitive
105
- "]
106
- bb1_instrs --> bb1_terminal(["If (read $14_@5:TPrimitive)"])
107
- end
108
- subgraph bb4
109
- bb4_instrs["
110
- [11] Reassign mutate x$7_@0:TPrimitive[1:13] = 5
111
- "]
112
- bb4_instrs --> bb4_terminal(["Goto"])
113
- end
114
- subgraph bb3
115
- bb3_instrs["
116
- [13] Const mutate y$18_@6 = read x$7_@0:TPrimitive
117
- "]
118
- bb3_instrs --> bb3_terminal(["Return"])
119
- end
120
-
121
- %% Jumps
122
- bb0_terminal -- "then" --> bb2
123
- bb0_terminal -- "else" --> bb1
124
- bb2_terminal --> bb1
125
- bb1_terminal -- "then" --> bb4
126
- bb1_terminal -- "else" --> bb3
127
- bb4_terminal --> bb3
128
-
129
-```
130
-
81
## Code
82
83
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
-34
@@ -58,40 +58,6 @@ function foo(
58
59
```
60
61
-### CFG
62
-
63
-```mermaid
64
-flowchart TB
65
- %% Basic Blocks
66
- subgraph bb0
67
- bb0_instrs["
68
- [1] Let mutate x$5_@0:TPrimitive[1:8] = 1
69
- [2] Const mutate y$6_@1:TPrimitive = 2
70
- [3] Const mutate $7_@2:TPrimitive = 2
71
- [4] Const mutate $8_@3:TPrimitive = Binary read y$6_@1:TPrimitive === read $7_@2:TPrimitive
72
- "]
73
- bb0_instrs --> bb0_terminal(["If (read $8_@3:TPrimitive)"])
74
- end
75
- subgraph bb2
76
- bb2_instrs["
77
- [6] Reassign mutate x$5_@0:TPrimitive[1:8] = 3
78
- "]
79
- bb2_instrs --> bb2_terminal(["Goto"])
80
- end
81
- subgraph bb1
82
- bb1_instrs["
83
- [8] Const mutate y$11_@4 = read x$5_@0:TPrimitive
84
- "]
85
- bb1_instrs --> bb1_terminal(["Return"])
86
- end
87
-
88
- %% Jumps
89
- bb0_terminal -- "then" --> bb2
90
- bb0_terminal -- "else" --> bb1
91
- bb2_terminal --> bb1
92
-
93
-```
94
-
61
## Code
62
63
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
-44
@@ -54,50 +54,6 @@ function foo(
54
55
```
56
57
-### CFG
58
-
59
-```mermaid
60
-flowchart TB
61
- %% Basic Blocks
62
- subgraph bb0
63
- bb0_instrs["
64
- [1] Const mutate items$5_@0 = Array []
65
- "]
66
- bb0_instrs --> bb0_terminal(["Goto"])
67
- end
68
- subgraph bb1
69
- bb1_terminal(["If (read items$5_@0)"])
70
- end
71
- subgraph bb3
72
- bb3_instrs["
73
- [4] Const mutate y$7_@1:TPrimitive = 0
74
- "]
75
- bb3_instrs --> bb3_terminal(["If (read cond$4)"])
76
- end
77
- subgraph bb5
78
- bb5_instrs["
79
- [6] Const mutate y$9_@2:TPrimitive = 1
80
- "]
81
- bb5_instrs --> bb5_terminal(["Goto"])
82
- end
83
- subgraph bb4
84
- bb4_terminal(["Goto"])
85
- end
86
- subgraph bb2
87
- bb2_terminal(["Return freeze items$5_@0"])
88
- end
89
-
90
- %% Jumps
91
- bb0_terminal --> bb1
92
- bb1_terminal -- "then" --> bb3
93
- bb1_terminal -- "else" --> bb2
94
- bb3_terminal -- "then" --> bb5
95
- bb3_terminal -- "else" --> bb4
96
- bb5_terminal --> bb4
97
- bb4_terminal --> bb1
98
-
99
-```
100
-
57
## Code
58
59
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md
-55
@@ -69,61 +69,6 @@ function foo(
69
70
```
71
72
-### CFG
73
-
74
-```mermaid
75
-flowchart TB
76
- %% Basic Blocks
77
- subgraph bb0
78
- bb0_instrs["
79
- [1] Let mutate x$6_@1:TPrimitive[1:13] = 1
80
- "]
81
- bb0_instrs --> bb0_terminal(["For"])
82
- end
83
- subgraph bb3
84
- bb3_instrs["
85
- [3] Const mutate i$7_@1:TPrimitive[1:13] = 0
86
- "]
87
- bb3_instrs --> bb3_terminal(["Goto"])
88
- end
89
- subgraph bb1
90
- bb1_instrs["
91
- [5] Const mutate $8_@1:TPrimitive[1:13] = 10
92
- [6] Const mutate $10_@3:TPrimitive[6:8] = Binary read i$7_@1:TPrimitive < read $8_@1:TPrimitive
93
- "]
94
- bb1_instrs --> bb1_terminal(["If (read $10_@3:TPrimitive)"])
95
- end
96
- subgraph bb5
97
- bb5_instrs["
98
- [8] Const mutate $11_@4:TPrimitive = 1
99
- [9] Reassign mutate x$6_@1:TPrimitive[1:13] = Binary read x$6_@1:TPrimitive + read $11_@4:TPrimitive
100
- "]
101
- bb5_instrs --> bb5_terminal(["Goto"])
102
- end
103
- subgraph bb4
104
- bb4_instrs["
105
- [11] read i$7_@1:TPrimitive
106
- "]
107
- bb4_instrs --> bb4_terminal(["Goto"])
108
- end
109
- subgraph bb2
110
- bb2_terminal(["Return read x$6_@1:TPrimitive"])
111
- end
112
-
113
- %% Jumps
114
- bb0_terminal -- "init" --> bb3
115
- bb0_terminal -- "test" --> bb1
116
- bb0_terminal -- "update" --> bb4
117
- bb0_terminal -- "loop" --> bb5
118
- bb0_terminal -- "fallthrough" --> bb2
119
- bb3_terminal --> bb1
120
- bb1_terminal -- "then" --> bb5
121
- bb1_terminal -- "else" --> bb2
122
- bb5_terminal --> bb4
123
- bb4_terminal --> bb1
124
-
125
-```
126
-
72
## Code
73
74
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
-57
@@ -71,63 +71,6 @@ function foo(
71
72
```
73
74
-### CFG
75
-
76
-```mermaid
77
-flowchart TB
78
- %% Basic Blocks
79
- subgraph bb0
80
- bb0_instrs["
81
- [1] Let mutate x$7_@1:TPrimitive[1:15] = 1
82
- "]
83
- bb0_instrs --> bb0_terminal(["For"])
84
- end
85
- subgraph bb3
86
- bb3_instrs["
87
- [3] Let mutate i$8_@1:TPrimitive[1:15] = 0
88
- "]
89
- bb3_instrs --> bb3_terminal(["Goto"])
90
- end
91
- subgraph bb1
92
- bb1_instrs["
93
- [5] Const mutate $9_@1:TPrimitive[1:15] = 10
94
- [6] Const mutate $11_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive < read $9_@1:TPrimitive
95
- "]
96
- bb1_instrs --> bb1_terminal(["If (read $11_@1:TPrimitive)"])
97
- end
98
- subgraph bb5
99
- bb5_instrs["
100
- [8] Const mutate $12_@3:TPrimitive = 1
101
- [9] Reassign mutate x$7_@1:TPrimitive[1:15] = Binary read x$7_@1:TPrimitive + read $12_@3:TPrimitive
102
- "]
103
- bb5_instrs --> bb5_terminal(["Goto"])
104
- end
105
- subgraph bb4
106
- bb4_instrs["
107
- [11] Const mutate $15_@1:TPrimitive[1:15] = 1
108
- [12] Reassign mutate i$8_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive + read $15_@1:TPrimitive
109
- [13] read i$8_@1:TPrimitive
110
- "]
111
- bb4_instrs --> bb4_terminal(["Goto"])
112
- end
113
- subgraph bb2
114
- bb2_terminal(["Return read x$7_@1:TPrimitive"])
115
- end
116
-
117
- %% Jumps
118
- bb0_terminal -- "init" --> bb3
119
- bb0_terminal -- "test" --> bb1
120
- bb0_terminal -- "update" --> bb4
121
- bb0_terminal -- "loop" --> bb5
122
- bb0_terminal -- "fallthrough" --> bb2
123
- bb3_terminal --> bb1
124
- bb1_terminal -- "then" --> bb5
125
- bb1_terminal -- "else" --> bb2
126
- bb5_terminal --> bb4
127
- bb4_terminal --> bb1
128
-
129
-```
130
-
74
## Code
75
76
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
-37
@@ -57,43 +57,6 @@ function foo(
57
58
```
59
60
-### CFG
61
-
62
-```mermaid
63
-flowchart TB
64
- %% Basic Blocks
65
- subgraph bb0
66
- bb0_instrs["
67
- [1] Const mutate x$5_@0:TPrimitive = 1
68
- [2] Const mutate y$6_@1:TPrimitive = 2
69
- "]
70
- bb0_instrs --> bb0_terminal(["If (read y$6_@1:TPrimitive)"])
71
- end
72
- subgraph bb2
73
- bb2_instrs["
74
- [4] Const mutate z$7_@2:TPrimitive = Binary read x$5_@0:TPrimitive + read y$6_@1:TPrimitive
75
- "]
76
- bb2_instrs --> bb2_terminal(["Goto"])
77
- end
78
- subgraph bb3
79
- bb3_instrs["
80
- [6] Const mutate z$8_@3:TPrimitive = read x$5_@0:TPrimitive
81
- "]
82
- bb3_instrs --> bb3_terminal(["Goto"])
83
- end
84
- subgraph bb1
85
- bb1_terminal(["Return"])
86
- end
87
-
88
- %% Jumps
89
- bb0_terminal -- "then" --> bb2
90
- bb0_terminal -- "else" --> bb3
91
- bb0_terminal -- "fallthrough" --> bb1
92
- bb2_terminal --> bb1
93
- bb3_terminal --> bb1
94
-
95
-```
96
-
60
## Code
61
62
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md
-87
@@ -113,93 +113,6 @@ function foo(
113
114
```
115
116
-### CFG
117
-
118
-```mermaid
119
-flowchart TB
120
- %% Basic Blocks
121
- subgraph bb0
122
- bb0_instrs["
123
- [1] Const mutate x$13_@0:TPrimitive = 0
124
- [2] Const mutate $14_@1:TPrimitive = true
125
- [3] Let mutate x$18_@2[3:20] = undefined
126
- "]
127
- bb0_instrs --> bb0_terminal(["If (read $14_@1:TPrimitive)"])
128
- end
129
- subgraph bb2
130
- bb2_instrs["
131
- [4] Const mutate $15_@3:TPrimitive = true
132
- "]
133
- bb2_instrs --> bb2_terminal(["If (read $15_@3:TPrimitive)"])
134
- end
135
- subgraph bb4
136
- bb4_instrs["
137
- [6] Reassign mutate x$18_@2[3:20] = read a$9
138
- "]
139
- bb4_instrs --> bb4_terminal(["Goto"])
140
- end
141
- subgraph bb5
142
- bb5_instrs["
143
- [8] Reassign mutate x$18_@2[3:20] = read b$10
144
- "]
145
- bb5_instrs --> bb5_terminal(["Goto"])
146
- end
147
- subgraph bb3
148
- bb3_instrs["
149
- [10] read x$18_@2
150
- "]
151
- bb3_instrs --> bb3_terminal(["Goto"])
152
- end
153
- subgraph bb6
154
- bb6_instrs["
155
- [12] Const mutate $19_@4:TPrimitive = true
156
- "]
157
- bb6_instrs --> bb6_terminal(["If (read $19_@4:TPrimitive)"])
158
- end
159
- subgraph bb8
160
- bb8_instrs["
161
- [14] Reassign mutate x$18_@2[3:20] = read c$11
162
- "]
163
- bb8_instrs --> bb8_terminal(["Goto"])
164
- end
165
- subgraph bb9
166
- bb9_instrs["
167
- [16] Reassign mutate x$18_@2[3:20] = read d$12
168
- "]
169
- bb9_instrs --> bb9_terminal(["Goto"])
170
- end
171
- subgraph bb7
172
- bb7_instrs["
173
- [18] read x$18_@2
174
- "]
175
- bb7_instrs --> bb7_terminal(["Goto"])
176
- end
177
- subgraph bb1
178
- bb1_instrs["
179
- [20] read x$18_@2
180
- "]
181
- bb1_instrs --> bb1_terminal(["Return"])
182
- end
183
-
184
- %% Jumps
185
- bb0_terminal -- "then" --> bb2
186
- bb0_terminal -- "else" --> bb6
187
- bb0_terminal -- "fallthrough" --> bb1
188
- bb2_terminal -- "then" --> bb4
189
- bb2_terminal -- "else" --> bb5
190
- bb2_terminal -- "fallthrough" --> bb3
191
- bb4_terminal --> bb3
192
- bb5_terminal --> bb3
193
- bb3_terminal --> bb1
194
- bb6_terminal -- "then" --> bb8
195
- bb6_terminal -- "else" --> bb9
196
- bb6_terminal -- "fallthrough" --> bb7
197
- bb8_terminal --> bb7
198
- bb9_terminal --> bb7
199
- bb7_terminal --> bb1
200
-
201
-```
202
-
116
## Code
117
118
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md
-65
@@ -84,71 +84,6 @@ function foo(
84
85
```
86
87
-### CFG
88
-
89
-```mermaid
90
-flowchart TB
91
- %% Basic Blocks
92
- subgraph bb0
93
- bb0_instrs["
94
- [1] Const mutate x$9_@0:TPrimitive = 0
95
- "]
96
- bb0_instrs --> bb0_terminal(["While"])
97
- end
98
- subgraph bb1
99
- bb1_terminal(["If (read a$6)"])
100
- end
101
- subgraph bb3
102
- bb3_terminal(["While"])
103
- end
104
- subgraph bb4
105
- bb4_terminal(["If (read b$7)"])
106
- end
107
- subgraph bb6
108
- bb6_terminal(["While"])
109
- end
110
- subgraph bb7
111
- bb7_terminal(["If (read c$8)"])
112
- end
113
- subgraph bb9
114
- bb9_instrs["
115
- [8] Const mutate $13_@1:TPrimitive = 1
116
- [9] Binary read x$9_@0:TPrimitive + read $13_@1:TPrimitive
117
- "]
118
- bb9_instrs --> bb9_terminal(["Goto"])
119
- end
120
- subgraph bb8
121
- bb8_terminal(["Goto"])
122
- end
123
- subgraph bb5
124
- bb5_terminal(["Goto"])
125
- end
126
- subgraph bb2
127
- bb2_terminal(["Return read x$9_@0:TPrimitive"])
128
- end
129
-
130
- %% Jumps
131
- bb0_terminal -- "test" --> bb1
132
- bb0_terminal -- "loop" --> bb3
133
- bb0_terminal -- "fallthrough" --> bb2
134
- bb1_terminal -- "then" --> bb3
135
- bb1_terminal -- "else" --> bb2
136
- bb3_terminal -- "test" --> bb4
137
- bb3_terminal -- "loop" --> bb6
138
- bb3_terminal -- "fallthrough" --> bb5
139
- bb4_terminal -- "then" --> bb6
140
- bb4_terminal -- "else" --> bb5
141
- bb6_terminal -- "test" --> bb7
142
- bb6_terminal -- "loop" --> bb9
143
- bb6_terminal -- "fallthrough" --> bb8
144
- bb7_terminal -- "then" --> bb9
145
- bb7_terminal -- "else" --> bb8
146
- bb9_terminal --> bb7
147
- bb8_terminal --> bb4
148
- bb5_terminal --> bb1
149
-
150
-```
151
-
87
## Code
88
89
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md
-40
@@ -63,46 +63,6 @@ function foo(
63
64
```
65
66
-### CFG
67
-
68
-```mermaid
69
-flowchart TB
70
- %% Basic Blocks
71
- subgraph bb0
72
- bb0_instrs["
73
- [1] Const mutate x$8_@0[1:8] = read a$5
74
- "]
75
- bb0_instrs --> bb0_terminal(["If (read b$6)"])
76
- end
77
- subgraph bb2
78
- bb2_terminal(["If (read c$7)"])
79
- end
80
- subgraph bb4
81
- bb4_instrs["
82
- [4] Reassign mutate x$8_@0[1:8] = read c$7
83
- "]
84
- bb4_instrs --> bb4_terminal(["Goto"])
85
- end
86
- subgraph bb3
87
- bb3_instrs["
88
- [6] read x$8_@0
89
- "]
90
- bb3_instrs --> bb3_terminal(["Goto"])
91
- end
92
- subgraph bb1
93
- bb1_terminal(["Return"])
94
- end
95
-
96
- %% Jumps
97
- bb0_terminal -- "then" --> bb2
98
- bb0_terminal -- "else" --> bb1
99
- bb2_terminal -- "then" --> bb4
100
- bb2_terminal -- "else" --> bb3
101
- bb4_terminal --> bb3
102
- bb3_terminal --> bb1
103
-
104
-```
105
-
66
## Code
67
68
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md
-41
@@ -68,47 +68,6 @@ function foo(
68
69
```
70
71
-### CFG
72
-
73
-```mermaid
74
-flowchart TB
75
- %% Basic Blocks
76
- subgraph bb0
77
- bb0_instrs["
78
- [1] Let mutate x$12_@0:TPrimitive[1:8] = null
79
- "]
80
- bb0_instrs --> bb0_terminal(["If (read a$7)"])
81
- end
82
- subgraph bb2
83
- bb2_instrs["
84
- [3] Reassign mutate x$12_@0:TPrimitive[1:8] = read b$8
85
- "]
86
- bb2_instrs --> bb2_terminal(["Goto"])
87
- end
88
- subgraph bb3
89
- bb3_terminal(["If (read c$9)"])
90
- end
91
- subgraph bb5
92
- bb5_instrs["
93
- [6] Reassign mutate x$12_@0:TPrimitive[1:8] = read d$10
94
- "]
95
- bb5_instrs --> bb5_terminal(["Goto"])
96
- end
97
- subgraph bb1
98
- bb1_terminal(["Return read x$12_@0:TPrimitive"])
99
- end
100
-
101
- %% Jumps
102
- bb0_terminal -- "then" --> bb2
103
- bb0_terminal -- "else" --> bb3
104
- bb0_terminal -- "fallthrough" --> bb1
105
- bb2_terminal --> bb1
106
- bb3_terminal -- "then" --> bb5
107
- bb3_terminal -- "else" --> bb1
108
- bb5_terminal --> bb1
109
-
110
-```
111
-
71
## Code
72
73
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
-31
@@ -31,19 +31,6 @@ function Foo(
31
32
```
33
34
-### CFG
35
-
36
-```mermaid
37
-flowchart TB
38
- %% Basic Blocks
39
- subgraph bb0
40
- bb0_terminal(["Return"])
41
- end
42
-
43
- %% Jumps
44
- %% empty
45
-```
46
-
34
## Code
35
36
```javascript
@@ -77,24 +64,6 @@ function Component(
64
65
```
66
80
-### CFG
81
-
82
-```mermaid
83
-flowchart TB
84
- %% Basic Blocks
85
- subgraph bb0
86
- bb0_instrs["
87
- [1] Const mutate a$7_@0[1:4] = Array []
88
- [2] Const mutate b$8_@0:TObject[1:4] = Object { }
89
- [3] Const mutate c$9_@0[1:4] = New mutate Foo$5(mutate a$7_@0, mutate b$8_@0:TObject)
90
- "]
91
- bb0_instrs --> bb0_terminal(["Return freeze c$9_@0"])
92
- end
93
-
94
- %% Jumps
95
- %% empty
96
-```
97
-
67
## Code
68
69
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
-42
@@ -68,48 +68,6 @@ function foo(
68
69
```
70
71
-### CFG
72
-
73
-```mermaid
74
-flowchart TB
75
- %% Basic Blocks
76
- subgraph bb0
77
- bb0_instrs["
78
- [1] Let mutate x$6_@0:TPrimitive[1:10] = 1
79
- [2] Let mutate y$7_@0:TPrimitive[1:10] = 2
80
- [3] Const mutate $8_@2:TPrimitive = 1
81
- [4] Const mutate $9_@0:TPrimitive[1:10] = Binary read x$6_@0:TPrimitive > read $8_@2:TPrimitive
82
- "]
83
- bb0_instrs --> bb0_terminal(["If (read $9_@0:TPrimitive)"])
84
- end
85
- subgraph bb2
86
- bb2_instrs["
87
- [6] Reassign mutate x$6_@0:TPrimitive[1:10] = 2
88
- "]
89
- bb2_instrs --> bb2_terminal(["Goto"])
90
- end
91
- subgraph bb3
92
- bb3_instrs["
93
- [8] Reassign mutate y$7_@0:TPrimitive[1:10] = 3
94
- "]
95
- bb3_instrs --> bb3_terminal(["Goto"])
96
- end
97
- subgraph bb1
98
- bb1_instrs["
99
- [10] Const mutate t$14_@3:TObject = Object { x: read x$6_@0:TPrimitive, y: read y$7_@0:TPrimitive }
100
- "]
101
- bb1_instrs --> bb1_terminal(["Return freeze t$14_@3:TObject"])
102
- end
103
-
104
- %% Jumps
105
- bb0_terminal -- "then" --> bb2
106
- bb0_terminal -- "else" --> bb3
107
- bb0_terminal -- "fallthrough" --> bb1
108
- bb2_terminal --> bb1
109
- bb3_terminal --> bb1
110
-
111
-```
112
-
71
## Code
72
73
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
-18
@@ -40,24 +40,6 @@ function Component(
40
41
```
42
43
-### CFG
44
-
45
-```mermaid
46
-flowchart TB
47
- %% Basic Blocks
48
- subgraph bb0
49
- bb0_instrs["
50
- [1] Const mutate a$6_@0:TPrimitive = 1
51
- [2] Const mutate b$7_@1:TPrimitive = 2
52
- [3] Const mutate x$8_@2:TObject = Object { a: read a$6_@0:TPrimitive, b: read b$7_@1:TPrimitive }
53
- "]
54
- bb0_instrs --> bb0_terminal(["Return freeze x$8_@2:TObject"])
55
- end
56
-
57
- %% Jumps
58
- %% empty
59
-```
60
-
43
## Code
44
45
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md
-42
@@ -66,48 +66,6 @@ function foo(
66
67
```
68
69
-### CFG
70
-
71
-```mermaid
72
-flowchart TB
73
- %% Basic Blocks
74
- subgraph bb0
75
- bb0_instrs["
76
- [1] Const mutate b$8_@0:TObject[1:11] = Object { }
77
- [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject
78
- "]
79
- bb0_instrs --> bb0_terminal(["If (read a$7)"])
80
- end
81
- subgraph bb2
82
- bb2_instrs["
83
- [4] Const mutate y$10_@0:TObject[1:11] = Object { }
84
- [5] Reassign mutate x$9_@0.y[1:11] = read y$10_@0:TObject
85
- "]
86
- bb2_instrs --> bb2_terminal(["Goto"])
87
- end
88
- subgraph bb3
89
- bb3_instrs["
90
- [7] Const mutate z$11_@0:TObject[1:11] = Object { }
91
- [8] Reassign mutate x$9_@0.z[1:11] = read z$11_@0:TObject
92
- "]
93
- bb3_instrs --> bb3_terminal(["Goto"])
94
- end
95
- subgraph bb1
96
- bb1_instrs["
97
- [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject)
98
- "]
99
- bb1_instrs --> bb1_terminal(["Return freeze x$9_@0:TObject"])
100
- end
101
-
102
- %% Jumps
103
- bb0_terminal -- "then" --> bb2
104
- bb0_terminal -- "else" --> bb3
105
- bb0_terminal -- "fallthrough" --> bb1
106
- bb2_terminal --> bb1
107
- bb3_terminal --> bb1
108
-
109
-```
110
-
69
## Code
70
71
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md
-38
@@ -68,44 +68,6 @@ function foo(
68
69
```
70
71
-### CFG
72
-
73
-```mermaid
74
-flowchart TB
75
- %% Basic Blocks
76
- subgraph bb0
77
- bb0_instrs["
78
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
79
- "]
80
- bb0_instrs --> bb0_terminal(["If (read a$5)"])
81
- end
82
- subgraph bb2
83
- bb2_instrs["
84
- [3] Const mutate y$7_@1:TObject = Object { }
85
- [4] Reassign mutate x$6_@0.y[1:9] = read y$7_@1:TObject
86
- "]
87
- bb2_instrs --> bb2_terminal(["Goto"])
88
- end
89
- subgraph bb3
90
- bb3_instrs["
91
- [6] Const mutate z$8_@2:TObject = Object { }
92
- [7] Reassign mutate x$6_@0.z[1:9] = read z$8_@2:TObject
93
- "]
94
- bb3_instrs --> bb3_terminal(["Goto"])
95
- end
96
- subgraph bb1
97
- bb1_terminal(["Return freeze x$6_@0:TObject"])
98
- end
99
-
100
- %% Jumps
101
- bb0_terminal -- "then" --> bb2
102
- bb0_terminal -- "else" --> bb3
103
- bb0_terminal -- "fallthrough" --> bb1
104
- bb2_terminal --> bb1
105
- bb3_terminal --> bb1
106
-
107
-```
108
-
71
## Code
72
73
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md
-41
@@ -63,47 +63,6 @@ function foo(
63
64
```
65
66
-### CFG
67
-
68
-```mermaid
69
-flowchart TB
70
- %% Basic Blocks
71
- subgraph bb0
72
- bb0_instrs["
73
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
74
- "]
75
- bb0_instrs --> bb0_terminal(["If (read a$6)"])
76
- end
77
- subgraph bb2
78
- bb2_instrs["
79
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
80
- [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject
81
- "]
82
- bb2_instrs --> bb2_terminal(["Goto"])
83
- end
84
- subgraph bb3
85
- bb3_instrs["
86
- [6] Const mutate z$9_@0:TObject[1:10] = Object { }
87
- [7] Reassign mutate x$7_@0.z[1:10] = read z$9_@0:TObject
88
- "]
89
- bb3_instrs --> bb3_terminal(["Goto"])
90
- end
91
- subgraph bb1
92
- bb1_instrs["
93
- [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject)
94
- "]
95
- bb1_instrs --> bb1_terminal(["Return freeze x$7_@0:TObject"])
96
- end
97
-
98
- %% Jumps
99
- bb0_terminal -- "then" --> bb2
100
- bb0_terminal -- "else" --> bb3
101
- bb0_terminal -- "fallthrough" --> bb1
102
- bb2_terminal --> bb1
103
- bb3_terminal --> bb1
104
-
105
-```
106
-
66
## Code
67
68
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md
-39
@@ -67,45 +67,6 @@ function foo(
67
68
```
69
70
-### CFG
71
-
72
-```mermaid
73
-flowchart TB
74
- %% Basic Blocks
75
- subgraph bb0
76
- bb0_instrs["
77
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
78
- "]
79
- bb0_instrs --> bb0_terminal(["If (read a$6)"])
80
- end
81
- subgraph bb2
82
- bb2_instrs["
83
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
84
- [4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject
85
- [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject)
86
- "]
87
- bb2_instrs --> bb2_terminal(["Goto"])
88
- end
89
- subgraph bb3
90
- bb3_instrs["
91
- [7] Const mutate z$9_@1:TObject = Object { }
92
- [8] Reassign mutate x$7_@0.z[1:10] = read z$9_@1:TObject
93
- "]
94
- bb3_instrs --> bb3_terminal(["Goto"])
95
- end
96
- subgraph bb1
97
- bb1_terminal(["Return freeze x$7_@0:TObject"])
98
- end
99
-
100
- %% Jumps
101
- bb0_terminal -- "then" --> bb2
102
- bb0_terminal -- "else" --> bb3
103
- bb0_terminal -- "fallthrough" --> bb1
104
- bb2_terminal --> bb1
105
- bb3_terminal --> bb1
106
-
107
-```
108
-
70
## Code
71
72
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md
-20
@@ -45,26 +45,6 @@ function foo(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_instrs["
55
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
56
- [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject
57
- [3] Const mutate y$7_@0:TObject[1:6] = Object { }
58
- [4] Reassign mutate y$7_@0.x[1:6] = read x$6_@0:TObject
59
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
60
- "]
61
- bb0_instrs --> bb0_terminal(["Return freeze y$7_@0:TObject"])
62
- end
63
-
64
- %% Jumps
65
- %% empty
66
-```
67
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
-19
@@ -42,25 +42,6 @@ function foo(
42
43
```
44
45
-### CFG
46
-
47
-```mermaid
48
-flowchart TB
49
- %% Basic Blocks
50
- subgraph bb0
51
- bb0_instrs["
52
- [1] Const mutate x$4_@0 = Array []
53
- [2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 }
54
- [3] Const mutate $6_@1[2:5] = Array []
55
- [4] Call mutate y$5_@1.x.push(mutate $6_@1)
56
- "]
57
- bb0_instrs --> bb0_terminal(["Return freeze y$5_@1:TObject"])
58
- end
59
-
60
- %% Jumps
61
- %% empty
62
-```
63
-
45
## Code
46
47
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md
-19
@@ -40,25 +40,6 @@ function foo(
40
41
```
42
43
-### CFG
44
-
45
-```mermaid
46
-flowchart TB
47
- %% Basic Blocks
48
- subgraph bb0
49
- bb0_instrs["
50
- [1] Const mutate x$4_@0[1:5] = Array []
51
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
52
- [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0
53
- [4] Call mutate mutate$3:TFunction(mutate x$4_@0)
54
- "]
55
- bb0_instrs --> bb0_terminal(["Return freeze y$5_@0:TObject"])
56
- end
57
-
58
- %% Jumps
59
- %% empty
60
-```
61
-
43
## Code
44
45
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md
-20
@@ -45,26 +45,6 @@ function foo(
45
46
```
47
48
-### CFG
49
-
50
-```mermaid
51
-flowchart TB
52
- %% Basic Blocks
53
- subgraph bb0
54
- bb0_instrs["
55
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
56
- [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject
57
- [3] Const mutate x$7_@0[1:6] = Array []
58
- [4] Reassign mutate y$6_@0.x[1:6] = read x$7_@0
59
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
60
- "]
61
- bb0_instrs --> bb0_terminal(["Return freeze y$6_@0:TObject"])
62
- end
63
-
64
- %% Jumps
65
- %% empty
66
-```
67
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md
-19
@@ -40,25 +40,6 @@ function foo(
40
41
```
42
43
-### CFG
44
-
45
-```mermaid
46
-flowchart TB
47
- %% Basic Blocks
48
- subgraph bb0
49
- bb0_instrs["
50
- [1] Const mutate x$4_@0[1:5] = Array []
51
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
52
- [3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0
53
- [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject)
54
- "]
55
- bb0_instrs --> bb0_terminal(["Return freeze y$5_@0:TObject"])
56
- end
57
-
58
- %% Jumps
59
- %% empty
60
-```
61
-
43
## Code
44
45
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
-18
@@ -40,24 +40,6 @@ function foo(
40
41
```
42
43
-### CFG
44
-
45
-```mermaid
46
-flowchart TB
47
- %% Basic Blocks
48
- subgraph bb0
49
- bb0_instrs["
50
- [1] Const mutate x$3_@0 = Array []
51
- [2] Const mutate y$4_@1:TObject[2:4] = Object { }
52
- [3] Reassign mutate y$4_@1.x[2:4] = read x$3_@0
53
- "]
54
- bb0_instrs --> bb0_terminal(["Return freeze y$4_@1:TObject"])
55
- end
56
-
57
- %% Jumps
58
- %% empty
59
-```
60
-
43
## Code
44
45
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md
-19
@@ -46,25 +46,6 @@ function foo(
46
47
```
48
49
-### CFG
50
-
51
-```mermaid
52
-flowchart TB
53
- %% Basic Blocks
54
- subgraph bb0
55
- bb0_instrs["
56
- [1] Const mutate x$8_@0:TPrimitive = 0
57
- [2] Const mutate x$9_@1 = read a$5
58
- [3] Const mutate x$10_@2 = read b$6
59
- [4] Const mutate x$11_@3 = read c$7
60
- "]
61
- bb0_instrs --> bb0_terminal(["Return read x$11_@3"])
62
- end
63
-
64
- %% Jumps
65
- %% empty
66
-```
67
-
49
## Code
50
51
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
-30
@@ -49,36 +49,6 @@ function foo(
49
50
```
51
52
-### CFG
53
-
54
-```mermaid
55
-flowchart TB
56
- %% Basic Blocks
57
- subgraph bb0
58
- bb0_instrs["
59
- [1] Let mutate x$4_@0:TPrimitive[1:7] = 1
60
- [2] Const mutate $5_@1:TPrimitive = 1
61
- [3] Const mutate $6_@0:TPrimitive[1:7] = Binary read x$4_@0:TPrimitive === read $5_@1:TPrimitive
62
- "]
63
- bb0_instrs --> bb0_terminal(["If (read $6_@0:TPrimitive)"])
64
- end
65
- subgraph bb2
66
- bb2_instrs["
67
- [5] Reassign mutate x$4_@0:TPrimitive[1:7] = 2
68
- "]
69
- bb2_instrs --> bb2_terminal(["Goto"])
70
- end
71
- subgraph bb1
72
- bb1_terminal(["Return read x$4_@0:TPrimitive"])
73
- end
74
-
75
- %% Jumps
76
- bb0_terminal -- "then" --> bb2
77
- bb0_terminal -- "else" --> bb1
78
- bb2_terminal --> bb1
79
-
80
-```
81
-
52
## Code
53
54
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
-53
@@ -35,19 +35,6 @@ function log(
35
36
```
37
38
-### CFG
39
-
40
-```mermaid
41
-flowchart TB
42
- %% Basic Blocks
43
- subgraph bb0
44
- bb0_terminal(["Return"])
45
- end
46
-
47
- %% Jumps
48
- %% empty
49
-```
50
-
38
## Code
39
40
```javascript
@@ -98,46 +85,6 @@ function Foo(
85
86
```
87
101
-### CFG
102
-
103
-```mermaid
104
-flowchart TB
105
- %% Basic Blocks
106
- subgraph bb0
107
- bb0_instrs["
108
- [1] Let mutate str$6_@0:TPrimitive[1:8] = ''
109
- "]
110
- bb0_instrs --> bb0_terminal(["If (read cond$5)"])
111
- end
112
- subgraph bb2
113
- bb2_instrs["
114
- [3] Const mutate str$7_@1:TPrimitive = 'other test'
115
- [4] Call mutate log$4:TFunction(read str$7_@1:TPrimitive)
116
- "]
117
- bb2_instrs --> bb2_terminal(["Goto"])
118
- end
119
- subgraph bb3
120
- bb3_instrs["
121
- [6] Reassign mutate str$6_@0:TPrimitive[1:8] = 'fallthrough test'
122
- "]
123
- bb3_instrs --> bb3_terminal(["Goto"])
124
- end
125
- subgraph bb1
126
- bb1_instrs["
127
- [8] Call mutate log$4:TFunction(read str$6_@0:TPrimitive)
128
- "]
129
- bb1_instrs --> bb1_terminal(["Return"])
130
- end
131
-
132
- %% Jumps
133
- bb0_terminal -- "then" --> bb2
134
- bb0_terminal -- "else" --> bb3
135
- bb0_terminal -- "fallthrough" --> bb1
136
- bb2_terminal --> bb1
137
- bb3_terminal --> bb1
138
-
139
-```
140
-
88
## Code
89
90
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md
-85
@@ -117,91 +117,6 @@ function foo(
117
118
```
119
120
-### CFG
121
-
122
-```mermaid
123
-flowchart TB
124
- %% Basic Blocks
125
- subgraph bb0
126
- bb0_instrs["
127
- [1] Const mutate x$13_@0:TPrimitive = 0
128
- [2] Const mutate $14_@1:TPrimitive = true
129
- "]
130
- bb0_instrs --> bb0_terminal(["If (read $14_@1:TPrimitive)"])
131
- end
132
- subgraph bb2
133
- bb2_instrs["
134
- [4] Const mutate $15_@2:TPrimitive = true
135
- [5] Let mutate x$16_@3[5:10] = undefined
136
- "]
137
- bb2_instrs --> bb2_terminal(["If (read $15_@2:TPrimitive)"])
138
- end
139
- subgraph bb4
140
- bb4_instrs["
141
- [6] Reassign mutate x$16_@3[5:10] = read a$9
142
- "]
143
- bb4_instrs --> bb4_terminal(["Goto"])
144
- end
145
- subgraph bb5
146
- bb5_instrs["
147
- [8] Reassign mutate x$16_@3[5:10] = read b$10
148
- "]
149
- bb5_instrs --> bb5_terminal(["Goto"])
150
- end
151
- subgraph bb3
152
- bb3_instrs["
153
- [10] read x$16_@3
154
- "]
155
- bb3_instrs --> bb3_terminal(["Goto"])
156
- end
157
- subgraph bb6
158
- bb6_instrs["
159
- [12] Const mutate $19_@4:TPrimitive = true
160
- [13] Let mutate x$20_@5[13:18] = undefined
161
- "]
162
- bb6_instrs --> bb6_terminal(["If (read $19_@4:TPrimitive)"])
163
- end
164
- subgraph bb8
165
- bb8_instrs["
166
- [14] Reassign mutate x$20_@5[13:18] = read c$11
167
- "]
168
- bb8_instrs --> bb8_terminal(["Goto"])
169
- end
170
- subgraph bb9
171
- bb9_instrs["
172
- [16] Reassign mutate x$20_@5[13:18] = read d$12
173
- "]
174
- bb9_instrs --> bb9_terminal(["Goto"])
175
- end
176
- subgraph bb7
177
- bb7_instrs["
178
- [18] read x$20_@5
179
- "]
180
- bb7_instrs --> bb7_terminal(["Goto"])
181
- end
182
- subgraph bb1
183
- bb1_terminal(["Return"])
184
- end
185
-
186
- %% Jumps
187
- bb0_terminal -- "then" --> bb2
188
- bb0_terminal -- "else" --> bb6
189
- bb0_terminal -- "fallthrough" --> bb1
190
- bb2_terminal -- "then" --> bb4
191
- bb2_terminal -- "else" --> bb5
192
- bb2_terminal -- "fallthrough" --> bb3
193
- bb4_terminal --> bb3
194
- bb5_terminal --> bb3
195
- bb3_terminal --> bb1
196
- bb6_terminal -- "then" --> bb8
197
- bb6_terminal -- "else" --> bb9
198
- bb6_terminal -- "fallthrough" --> bb7
199
- bb8_terminal --> bb7
200
- bb9_terminal --> bb7
201
- bb7_terminal --> bb1
202
-
203
-```
204
-
120
## Code
121
122
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
-42
@@ -68,48 +68,6 @@ function foo(
68
69
```
70
71
-### CFG
72
-
73
-```mermaid
74
-flowchart TB
75
- %% Basic Blocks
76
- subgraph bb0
77
- bb0_instrs["
78
- [1] Const mutate y$5_@0:TPrimitive = 2
79
- [2] Const mutate $6_@1:TPrimitive = 1
80
- [3] Const mutate $7_@2:TPrimitive = Binary read y$5_@0:TPrimitive > read $6_@1:TPrimitive
81
- [4] Let mutate y$8_@3:TPrimitive[4:9] = undefined
82
- "]
83
- bb0_instrs --> bb0_terminal(["If (read $7_@2:TPrimitive)"])
84
- end
85
- subgraph bb2
86
- bb2_instrs["
87
- [5] Reassign mutate y$8_@3:TPrimitive[4:9] = 1
88
- "]
89
- bb2_instrs --> bb2_terminal(["Goto"])
90
- end
91
- subgraph bb3
92
- bb3_instrs["
93
- [7] Reassign mutate y$8_@3:TPrimitive[4:9] = 2
94
- "]
95
- bb3_instrs --> bb3_terminal(["Goto"])
96
- end
97
- subgraph bb1
98
- bb1_instrs["
99
- [9] Const mutate x$11_@4 = read y$8_@3:TPrimitive
100
- "]
101
- bb1_instrs --> bb1_terminal(["Return"])
102
- end
103
-
104
- %% Jumps
105
- bb0_terminal -- "then" --> bb2
106
- bb0_terminal -- "else" --> bb3
107
- bb0_terminal -- "fallthrough" --> bb1
108
- bb2_terminal --> bb1
109
- bb3_terminal --> bb1
110
-
111
-```
112
-
71
## Code
72
73
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md
-17
@@ -31,23 +31,6 @@ function foo(
31
32
```
33
34
-### CFG
35
-
36
-```mermaid
37
-flowchart TB
38
- %% Basic Blocks
39
- subgraph bb0
40
- bb0_instrs["
41
- [1] Const mutate x$3_@0:TPrimitive = 1
42
- [2] Const mutate y$4_@1:TPrimitive = 2
43
- "]
44
- bb0_instrs --> bb0_terminal(["Return"])
45
- end
46
-
47
- %% Jumps
48
- %% empty
49
-```
50
-
34
## Code
35
36
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md
-29
@@ -47,35 +47,6 @@ function foo(
47
48
```
49
50
-### CFG
51
-
52
-```mermaid
53
-flowchart TB
54
- %% Basic Blocks
55
- subgraph bb0
56
- bb0_instrs["
57
- [1] Const mutate x$4_@0:TPrimitive = 1
58
- [2] Const mutate y$5_@1:TPrimitive = 2
59
- "]
60
- bb0_instrs --> bb0_terminal(["If (read y$5_@1:TPrimitive)"])
61
- end
62
- subgraph bb2
63
- bb2_instrs["
64
- [4] Const mutate z$6_@2:TPrimitive = Binary read x$4_@0:TPrimitive + read y$5_@1:TPrimitive
65
- "]
66
- bb2_instrs --> bb2_terminal(["Goto"])
67
- end
68
- subgraph bb1
69
- bb1_terminal(["Return"])
70
- end
71
-
72
- %% Jumps
73
- bb0_terminal -- "then" --> bb2
74
- bb0_terminal -- "else" --> bb1
75
- bb2_terminal --> bb1
76
-
77
-```
78
-
50
## Code
51
52
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
-55
@@ -111,61 +111,6 @@ function foo(
111
112
```
113
114
-### CFG
115
-
116
-```mermaid
117
-flowchart TB
118
- %% Basic Blocks
119
- subgraph bb0
120
- bb0_instrs["
121
- [1] Const mutate x$10_@0:TPrimitive = 1
122
- [2] Const mutate $11_@1:TPrimitive = 2
123
- [3] Const mutate $12_@2:TPrimitive = Binary read x$10_@0:TPrimitive === read $11_@1:TPrimitive
124
- [4] Const mutate $13_@3:TPrimitive = 1
125
- [5] Const mutate $14_@4:TPrimitive = Binary read x$10_@0:TPrimitive === read $13_@3:TPrimitive
126
- [6] Let mutate x$16_@5:TPrimitive[6:16] = undefined
127
- "]
128
- bb0_instrs --> bb0_terminal(["Switch (read x$10_@0:TPrimitive)"])
129
- end
130
- subgraph bb5
131
- bb5_instrs["
132
- [7] Const mutate $15_@6:TPrimitive = 1
133
- [8] Reassign mutate x$16_@5:TPrimitive[6:16] = Binary read x$10_@0:TPrimitive + read $15_@6:TPrimitive
134
- "]
135
- bb5_instrs --> bb5_terminal(["Goto"])
136
- end
137
- subgraph bb3
138
- bb3_instrs["
139
- [10] Const mutate $17_@7:TPrimitive = 2
140
- [11] Reassign mutate x$16_@5:TPrimitive[6:16] = Binary read x$10_@0:TPrimitive + read $17_@7:TPrimitive
141
- "]
142
- bb3_instrs --> bb3_terminal(["Goto"])
143
- end
144
- subgraph bb2
145
- bb2_instrs["
146
- [13] Const mutate $19_@8:TPrimitive = 3
147
- [14] Reassign mutate x$16_@5:TPrimitive[6:16] = Binary read x$10_@0:TPrimitive + read $19_@8:TPrimitive
148
- "]
149
- bb2_instrs --> bb2_terminal(["Goto"])
150
- end
151
- subgraph bb1
152
- bb1_instrs["
153
- [16] Const mutate y$22_@9 = read x$16_@5:TPrimitive
154
- "]
155
- bb1_instrs --> bb1_terminal(["Return"])
156
- end
157
-
158
- %% Jumps
159
- bb0_terminal -- "read $14_@4:TPrimitive" --> bb5
160
- bb0_terminal -- "read $12_@2:TPrimitive" --> bb3
161
- bb0_terminal -- "default" --> bb2
162
- bb0_terminal -- "fallthrough" --> bb1
163
- bb5_terminal --> bb1
164
- bb3_terminal --> bb1
165
- bb2_terminal --> bb1
166
-
167
-```
168
-
114
## Code
115
116
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
-30
@@ -48,36 +48,6 @@ function foo(
48
49
```
50
51
-### CFG
52
-
53
-```mermaid
54
-flowchart TB
55
- %% Basic Blocks
56
- subgraph bb0
57
- bb0_instrs["
58
- [1] Let mutate x$4_@0:TPrimitive[1:7] = 1
59
- [2] Const mutate $5_@1:TPrimitive = 1
60
- [3] Const mutate $6_@0:TPrimitive[1:7] = Binary read x$4_@0:TPrimitive === read $5_@1:TPrimitive
61
- "]
62
- bb0_instrs --> bb0_terminal(["If (read $6_@0:TPrimitive)"])
63
- end
64
- subgraph bb2
65
- bb2_instrs["
66
- [5] Reassign mutate x$4_@0:TPrimitive[1:7] = 2
67
- "]
68
- bb2_instrs --> bb2_terminal(["Goto"])
69
- end
70
- subgraph bb1
71
- bb1_terminal(["Throw read x$4_@0:TPrimitive"])
72
- end
73
-
74
- %% Jumps
75
- bb0_terminal -- "then" --> bb2
76
- bb0_terminal -- "else" --> bb1
77
- bb2_terminal --> bb1
78
-
79
-```
80
-
51
## Code
52
53
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md
-39
@@ -61,45 +61,6 @@ function foo(
61
62
```
63
64
-### CFG
65
-
66
-```mermaid
67
-flowchart TB
68
- %% Basic Blocks
69
- subgraph bb0
70
- bb0_instrs["
71
- [1] Const mutate x$5_@0:TPrimitive = 1
72
- "]
73
- bb0_instrs --> bb0_terminal(["While"])
74
- end
75
- subgraph bb1
76
- bb1_instrs["
77
- [3] Const mutate $6_@1:TPrimitive[3:6] = 10
78
- [4] Const mutate $8_@2:TPrimitive[4:6] = Binary read x$5_@0:TPrimitive < read $6_@1:TPrimitive
79
- "]
80
- bb1_instrs --> bb1_terminal(["If (read $8_@2:TPrimitive)"])
81
- end
82
- subgraph bb3
83
- bb3_instrs["
84
- [6] Const mutate $9_@3:TPrimitive = 1
85
- [7] Binary read x$5_@0:TPrimitive + read $9_@3:TPrimitive
86
- "]
87
- bb3_instrs --> bb3_terminal(["Goto"])
88
- end
89
- subgraph bb2
90
- bb2_terminal(["Return read x$5_@0:TPrimitive"])
91
- end
92
-
93
- %% Jumps
94
- bb0_terminal -- "test" --> bb1
95
- bb0_terminal -- "loop" --> bb3
96
- bb0_terminal -- "fallthrough" --> bb2
97
- bb1_terminal -- "then" --> bb3
98
- bb1_terminal -- "else" --> bb2
99
- bb3_terminal --> bb1
100
-
101
-```
102
-
64
## Code
65
66
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
-39
@@ -56,45 +56,6 @@ function foo(
56
57
```
58
59
-### CFG
60
-
61
-```mermaid
62
-flowchart TB
63
- %% Basic Blocks
64
- subgraph bb0
65
- bb0_instrs["
66
- [1] Let mutate x$5_@0:TPrimitive[1:9] = 1
67
- "]
68
- bb0_instrs --> bb0_terminal(["While"])
69
- end
70
- subgraph bb1
71
- bb1_instrs["
72
- [3] Const mutate $6_@0:TPrimitive[1:9] = 10
73
- [4] Const mutate $8_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive < read $6_@0:TPrimitive
74
- "]
75
- bb1_instrs --> bb1_terminal(["If (read $8_@0:TPrimitive)"])
76
- end
77
- subgraph bb3
78
- bb3_instrs["
79
- [6] Const mutate $9_@2:TPrimitive = 1
80
- [7] Reassign mutate x$5_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive + read $9_@2:TPrimitive
81
- "]
82
- bb3_instrs --> bb3_terminal(["Goto"])
83
- end
84
- subgraph bb2
85
- bb2_terminal(["Return read x$5_@0:TPrimitive"])
86
- end
87
-
88
- %% Jumps
89
- bb0_terminal -- "test" --> bb1
90
- bb0_terminal -- "loop" --> bb3
91
- bb0_terminal -- "fallthrough" --> bb2
92
- bb1_terminal -- "then" --> bb3
93
- bb1_terminal -- "else" --> bb2
94
- bb3_terminal --> bb1
95
-
96
-```
97
-
59
## Code
60
61
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
-48
@@ -110,54 +110,6 @@ function Component(
110
111
```
112
113
-### CFG
114
-
115
-```mermaid
116
-flowchart TB
117
- %% Basic Blocks
118
- subgraph bb0
119
- bb0_instrs["
120
- [1] Const mutate x$10_@1:TFunction[1:12] = Array []
121
- [2] Let mutate y$11_@1:TPrimitive[1:12] = undefined
122
- [3] Const mutate $12_@2:TPrimitive = false
123
- [4] Const mutate $13_@3:TPrimitive = true
124
- [5] Const mutate $14_@4:TPrimitive = 1
125
- "]
126
- bb0_instrs --> bb0_terminal(["Switch (read props$9.p0)"])
127
- end
128
- subgraph bb6
129
- bb6_instrs["
130
- [7] Call mutate x$10_@1.push(read props$9.p2)
131
- [8] Reassign mutate y$11_@1:TPrimitive[1:12] = Array []
132
- "]
133
- bb6_instrs --> bb6_terminal(["Goto"])
134
- end
135
- subgraph bb2
136
- bb2_instrs["
137
- [10] Reassign mutate y$11_@1:TPrimitive[1:12] = read x$10_@1:TFunction
138
- "]
139
- bb2_instrs --> bb2_terminal(["Goto"])
140
- end
141
- subgraph bb1
142
- bb1_instrs["
143
- [12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$10_@1:TFunction} ></read Component$0>
144
- [13] Call read y$11_@1.push(read props$9.p4)
145
- [14] Const mutate $22_@6 = JSX <read Component$0 data={freeze y$11_@1:TPrimitive} >{read child$19_@5}</read Component$0>
146
- "]
147
- bb1_instrs --> bb1_terminal(["Return read $22_@6"])
148
- end
149
-
150
- %% Jumps
151
- bb0_terminal -- "read $14_@4:TPrimitive" --> bb1
152
- bb0_terminal -- "read $13_@3:TPrimitive" --> bb6
153
- bb0_terminal -- "default" --> bb1
154
- bb0_terminal -- "read $12_@2:TPrimitive" --> bb2
155
- bb0_terminal -- "fallthrough" --> bb1
156
- bb6_terminal --> bb1
157
- bb2_terminal --> bb1
158
-
159
-```
160
-
113
## Code
114
115
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md
-75
@@ -125,81 +125,6 @@ function foo(
125
126
```
127
128
-### CFG
129
-
130
-```mermaid
131
-flowchart TB
132
- %% Basic Blocks
133
- subgraph bb0
134
- bb0_instrs["
135
- [1] Const mutate y$10_@0:TPrimitive = undefined
136
- [2] Const mutate $11_@1:TPrimitive = 5
137
- [3] Const mutate $12_@2:TPrimitive = 4
138
- [4] Const mutate $13_@3:TPrimitive = 3
139
- [5] Const mutate $14_@4:TPrimitive = 2
140
- [6] Const mutate $15_@5:TPrimitive = 1
141
- [7] Const mutate $16_@6:TPrimitive = 0
142
- "]
143
- bb0_instrs --> bb0_terminal(["Switch (read x$9)"])
144
- end
145
- subgraph bb10
146
- bb10_instrs["
147
- [9] Const mutate y$17_@7:TPrimitive = 0
148
- "]
149
- bb10_instrs --> bb10_terminal(["Goto"])
150
- end
151
- subgraph bb9
152
- bb9_instrs["
153
- [11] Const mutate y$18_@8:TPrimitive = 1
154
- "]
155
- bb9_instrs --> bb9_terminal(["Goto"])
156
- end
157
- subgraph bb5
158
- bb5_instrs["
159
- [13] Const mutate y$19_@9:TPrimitive = 3
160
- "]
161
- bb5_instrs --> bb5_terminal(["Goto"])
162
- end
163
- subgraph bb4
164
- bb4_instrs["
165
- [15] Const mutate y$20_@10:TPrimitive = 4
166
- "]
167
- bb4_instrs --> bb4_terminal(["Goto"])
168
- end
169
- subgraph bb3
170
- bb3_instrs["
171
- [17] Const mutate y$21_@11:TPrimitive = 5
172
- "]
173
- bb3_instrs --> bb3_terminal(["Goto"])
174
- end
175
- subgraph bb2
176
- bb2_instrs["
177
- [19] Const mutate y$22_@12:TPrimitive = 0
178
- "]
179
- bb2_instrs --> bb2_terminal(["Goto"])
180
- end
181
- subgraph bb1
182
- bb1_terminal(["Return"])
183
- end
184
-
185
- %% Jumps
186
- bb0_terminal -- "read $16_@6:TPrimitive" --> bb10
187
- bb0_terminal -- "read $15_@5:TPrimitive" --> bb9
188
- bb0_terminal -- "read $14_@4:TPrimitive" --> bb1
189
- bb0_terminal -- "read $13_@3:TPrimitive" --> bb5
190
- bb0_terminal -- "read $12_@2:TPrimitive" --> bb4
191
- bb0_terminal -- "read $11_@1:TPrimitive" --> bb3
192
- bb0_terminal -- "default" --> bb2
193
- bb0_terminal -- "fallthrough" --> bb1
194
- bb10_terminal --> bb9
195
- bb9_terminal --> bb1
196
- bb5_terminal --> bb1
197
- bb4_terminal --> bb3
198
- bb3_terminal --> bb2
199
- bb2_terminal --> bb1
200
-
201
-```
202
-
128
## Code
129
130
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
-47
@@ -100,53 +100,6 @@ function Component(
100
101
```
102
103
-### CFG
104
-
105
-```mermaid
106
-flowchart TB
107
- %% Basic Blocks
108
- subgraph bb0
109
- bb0_instrs["
110
- [1] Const mutate x$9_@1:TFunction[1:12] = Array []
111
- [2] Let mutate y$10_@1:TPrimitive[1:12] = undefined
112
- [3] Const mutate $11_@2:TPrimitive = false
113
- [4] Const mutate $12_@3:TPrimitive = true
114
- "]
115
- bb0_instrs --> bb0_terminal(["Switch (read props$8.p0)"])
116
- end
117
- subgraph bb4
118
- bb4_instrs["
119
- [6] Call mutate x$9_@1.push(read props$8.p2)
120
- [7] Call mutate x$9_@1.push(read props$8.p3)
121
- [8] Const mutate y$13_@4 = Array []
122
- "]
123
- bb4_instrs --> bb4_terminal(["Goto"])
124
- end
125
- subgraph bb2
126
- bb2_instrs["
127
- [10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1:TFunction
128
- "]
129
- bb2_instrs --> bb2_terminal(["Goto"])
130
- end
131
- subgraph bb1
132
- bb1_instrs["
133
- [12] Const mutate child$19_@5 = JSX <read Component$0 data={freeze x$9_@1:TFunction} ></read Component$0>
134
- [13] Call read y$10_@1.push(read props$8.p4)
135
- [14] Const mutate $23_@6 = JSX <read Component$0 data={read y$10_@1:TPrimitive} >{read child$19_@5}</read Component$0>
136
- "]
137
- bb1_instrs --> bb1_terminal(["Return read $23_@6"])
138
- end
139
-
140
- %% Jumps
141
- bb0_terminal -- "read $12_@3:TPrimitive" --> bb4
142
- bb0_terminal -- "read $11_@2:TPrimitive" --> bb2
143
- bb0_terminal -- "default" --> bb1
144
- bb0_terminal -- "fallthrough" --> bb1
145
- bb4_terminal --> bb2
146
- bb2_terminal --> bb1
147
-
148
-```
149
-
103
## Code
104
105
```javascript
compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md
-23
@@ -53,29 +53,6 @@ function component(
53
54
```
55
56
-### CFG
57
-
58
-```mermaid
59
-flowchart TB
60
- %% Basic Blocks
61
- subgraph bb0
62
- bb0_instrs["
63
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
64
- [2] Const mutate p$7_@0:TObject[1:9] = Object { }
65
- [3] Const mutate q$8_@0:TObject[1:9] = Object { }
66
- [4] Const mutate y$9_@0:TObject[1:9] = Object { }
67
- [5] Reassign mutate x$6_@0.y[1:9] = read y$9_@0:TObject
68
- [6] Reassign mutate p$7_@0.y[1:9] = read x$6_@0.y
69
- [7] Reassign mutate q$8_@0.y[1:9] = read p$7_@0.y
70
- [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject)
71
- "]
72
- bb0_instrs --> bb0_terminal(["Return"])
73
- end
74
-
75
- %% Jumps
76
- %% empty
77
-```
78
-
56
## Code
57
58
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md
-28
@@ -46,34 +46,6 @@ function component(
46
47
```
48
49
-### CFG
50
-
51
-```mermaid
52
-flowchart TB
53
- %% Basic Blocks
54
- subgraph bb0
55
- bb0_instrs["
56
- [1] Const mutate $7_@0:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive
57
- "]
58
- bb0_instrs --> bb0_terminal(["If (read $7_@0:TPrimitive)"])
59
- end
60
- subgraph bb2
61
- bb2_instrs["
62
- [3] Const mutate m$8_@1:TObject = Object { }
63
- "]
64
- bb2_instrs --> bb2_terminal(["Goto"])
65
- end
66
- subgraph bb1
67
- bb1_terminal(["Return"])
68
- end
69
-
70
- %% Jumps
71
- bb0_terminal -- "then" --> bb2
72
- bb0_terminal -- "else" --> bb1
73
- bb2_terminal --> bb1
74
-
75
-```
76
-
49
## Code
50
51
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md
-30
@@ -54,36 +54,6 @@ function component(
54
55
```
56
57
-### CFG
58
-
59
-```mermaid
60
-flowchart TB
61
- %% Basic Blocks
62
- subgraph bb0
63
- bb0_instrs["
64
- [1] Const mutate a$7_@0:TPrimitive = Call mutate some$2:TFunction()
65
- [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$4:TFunction()
66
- [3] Const mutate $9_@2:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive
67
- "]
68
- bb0_instrs --> bb0_terminal(["If (read $9_@2:TPrimitive)"])
69
- end
70
- subgraph bb2
71
- bb2_instrs["
72
- [5] Const mutate m$10_@3:TObject = Object { }
73
- "]
74
- bb2_instrs --> bb2_terminal(["Goto"])
75
- end
76
- subgraph bb1
77
- bb1_terminal(["Return"])
78
- end
79
-
80
- %% Jumps
81
- bb0_terminal -- "then" --> bb2
82
- bb0_terminal -- "else" --> bb1
83
- bb2_terminal --> bb1
84
-
85
-```
86
-
57
## Code
58
59
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md
-18
@@ -38,24 +38,6 @@ function component(
38
39
```
40
41
-### CFG
42
-
43
-```mermaid
44
-flowchart TB
45
- %% Basic Blocks
46
- subgraph bb0
47
- bb0_instrs["
48
- [1] Const mutate $4_@0:TPrimitive = 1
49
- [2] Const mutate x$5_@1:TObject = Object { t: read $4_@0:TPrimitive }
50
- [3] Const mutate p$6_@2:TPrimitive = read x$5_@1.t
51
- "]
52
- bb0_instrs --> bb0_terminal(["Return"])
53
- end
54
-
55
- %% Jumps
56
- %% empty
57
-```
58
-
41
## Code
42
43
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md
-30
@@ -73,36 +73,6 @@ function component(
73
74
```
75
76
-### CFG
77
-
78
-```mermaid
79
-flowchart TB
80
- %% Basic Blocks
81
- subgraph bb0
82
- bb0_instrs["
83
- [1] Const mutate $10_@0:TPrimitive = Call mutate makeSomePrimitive$2:TFunction()
84
- [2] Const mutate $11_@1:TPrimitive = Call mutate makeSomePrimitive$2:TFunction()
85
- [3] Const mutate x$12_@2:TObject = Object { u: read $10_@0:TPrimitive, v: read $11_@1:TPrimitive }
86
- [4] Const mutate u$13_@3:TPrimitive = read x$12_@2.u
87
- [5] Const mutate v$14_@4:TPrimitive = read x$12_@2.v
88
- [6] Const mutate $15_@5:TPrimitive = Binary read u$13_@3:TPrimitive > read v$14_@4:TPrimitive
89
- "]
90
- bb0_instrs --> bb0_terminal(["If (read $15_@5:TPrimitive)"])
91
- end
92
- subgraph bb1
93
- bb1_instrs["
94
- [8] Const mutate y$16_@6:TPrimitive = read x$12_@2.u
95
- [9] Const mutate z$17_@7:TPrimitive = read x$12_@2.v
96
- "]
97
- bb1_instrs --> bb1_terminal(["Return"])
98
- end
99
-
100
- %% Jumps
101
- bb0_terminal -- "then" --> bb1
102
- bb0_terminal -- "else" --> bb1
103
-
104
-```
105
-
76
## Code
77
78
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md
-19
@@ -44,25 +44,6 @@ function component(
44
45
```
46
47
-### CFG
48
-
49
-```mermaid
50
-flowchart TB
51
- %% Basic Blocks
52
- subgraph bb0
53
- bb0_instrs["
54
- [1] Const mutate x$4_@0:TObject[1:4] = Object { }
55
- [2] Const mutate q$5_@1:TObject = Object { }
56
- [3] Reassign mutate x$4_@0.t[1:4] = read q$5_@1:TObject
57
- [4] Const mutate z$6_@2:TObject = read x$4_@0.t
58
- "]
59
- bb0_instrs --> bb0_terminal(["Return"])
60
- end
61
-
62
- %% Jumps
63
- %% empty
64
-```
65
-
47
## Code
48
49
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md
-23
@@ -62,29 +62,6 @@ function component(
62
63
```
64
65
-### CFG
66
-
67
-```mermaid
68
-flowchart TB
69
- %% Basic Blocks
70
- subgraph bb0
71
- bb0_instrs["
72
- [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$2:TFunction()
73
- [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive
74
- [3] Const mutate o$8_@1:TObject = Object { }
75
- [4] Const mutate x$9_@2:TObject[4:8] = Object { }
76
- [5] Reassign mutate x$9_@2.t[4:8] = read p$7_@0:TPrimitive
77
- [6] Const mutate z$10_@2:TPrimitive[4:8] = read x$9_@2.t
78
- [7] Reassign mutate x$9_@2.t[4:8] = read o$8_@1:TObject
79
- [8] Const mutate y$11_@3:TPoly = read x$9_@2.t
80
- "]
81
- bb0_instrs --> bb0_terminal(["Return"])
82
- end
83
-
84
- %% Jumps
85
- %% empty
86
-```
87
-
65
## Code
66
67
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md
-17
@@ -31,23 +31,6 @@ function component(
31
32
```
33
34
-### CFG
35
-
36
-```mermaid
37
-flowchart TB
38
- %% Basic Blocks
39
- subgraph bb0
40
- bb0_instrs["
41
- [1] Const mutate x$3_@0:TPrimitive = 1
42
- [2] Const mutate y$4_@1:TPrimitive = 2
43
- "]
44
- bb0_instrs --> bb0_terminal(["Return"])
45
- end
46
-
47
- %% Jumps
48
- %% empty
49
-```
50
-
34
## Code
35
36
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md
-33
@@ -60,39 +60,6 @@ function component(
60
61
```
62
63
-### CFG
64
-
65
-```mermaid
66
-flowchart TB
67
- %% Basic Blocks
68
- subgraph bb0
69
- bb0_instrs["
70
- [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$2:TFunction()
71
- [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$2:TFunction()
72
- [3] Const mutate $9_@2:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive
73
- "]
74
- bb0_instrs --> bb0_terminal(["If (read $9_@2:TPrimitive)"])
75
- end
76
- subgraph bb2
77
- bb2_instrs["
78
- [5] Const mutate z$10_@3:TObject = Object { }
79
- "]
80
- bb2_instrs --> bb2_terminal(["Goto"])
81
- end
82
- subgraph bb1
83
- bb1_instrs["
84
- [7] Const mutate z$12_@4:TPrimitive = Call mutate foo$2:TFunction()
85
- "]
86
- bb1_instrs --> bb1_terminal(["Return"])
87
- end
88
-
89
- %% Jumps
90
- bb0_terminal -- "then" --> bb2
91
- bb0_terminal -- "else" --> bb1
92
- bb2_terminal --> bb1
93
-
94
-```
95
-
63
## Code
64
65
```javascript
compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md
-24
@@ -42,30 +42,6 @@ function foo(
42
43
```
44
45
-### CFG
46
-
47
-```mermaid
48
-flowchart TB
49
- %% Basic Blocks
50
- subgraph bb0
51
- bb0_terminal(["While"])
52
- end
53
- subgraph bb1
54
- bb1_terminal(["If (read a$3)"])
55
- end
56
- subgraph bb2
57
- bb2_terminal(["Return read b$4"])
58
- end
59
-
60
- %% Jumps
61
- bb0_terminal -- "test" --> bb1
62
- bb0_terminal -- "loop" --> bb2
63
- bb0_terminal -- "fallthrough" --> bb2
64
- bb1_terminal -- "then" --> bb2
65
- bb1_terminal -- "else" --> bb2
66
-
67
-```
68
-
45
## Code
46
47
```javascript
compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md
-43
@@ -63,49 +63,6 @@ function foo(
63
64
```
65
66
-### CFG
67
-
68
-```mermaid
69
-flowchart TB
70
- %% Basic Blocks
71
- subgraph bb0
72
- bb0_terminal(["While"])
73
- end
74
- subgraph bb1
75
- bb1_terminal(["If (read a$5)"])
76
- end
77
- subgraph bb3
78
- bb3_terminal(["If (read b$6)"])
79
- end
80
- subgraph bb5
81
- bb5_terminal(["Goto"])
82
- end
83
- subgraph bb4
84
- bb4_instrs["
85
- [5] Call read c$7:TFunction()
86
- "]
87
- bb4_instrs --> bb4_terminal(["Goto"])
88
- end
89
- subgraph bb2
90
- bb2_instrs["
91
- [7] Call read d$8:TFunction()
92
- "]
93
- bb2_instrs --> bb2_terminal(["Return"])
94
- end
95
-
96
- %% Jumps
97
- bb0_terminal -- "test" --> bb1
98
- bb0_terminal -- "loop" --> bb3
99
- bb0_terminal -- "fallthrough" --> bb2
100
- bb1_terminal -- "then" --> bb3
101
- bb1_terminal -- "else" --> bb2
102
- bb3_terminal -- "then" --> bb5
103
- bb3_terminal -- "else" --> bb4
104
- bb5_terminal --> bb1
105
- bb4_terminal --> bb1
106
-
107
-```
108
-
66
## Code
67
68
```javascript
compiler/forget/src/__tests__/hir-test.ts
+2
-9
@@ -19,7 +19,6 @@ import { toggleLogging } from "../HIR/logger";
19
import run from "../HIR/Pipeline";
20
import { printFunction } from "../HIR/PrintHIR";
21
import { printReactiveFunction } from "../HIR/PrintReactiveFunction";
22
-import visualizeHIRMermaid from "../HIR/VisualizeHIRMermaid";
22
import generateTestsFromFixtures from "./test-utils/generateTestsFromFixtures";
23
24
function wrapWithTripleBackticks(s: string, ext?: string) {
@@ -104,7 +103,7 @@ ${wrapWithTripleBackticks(error.message)}
103
}
104
105
function formatOutput(items: Array<TestOutput>): Array<string> {
107
- return items.map(({ ir, js, mermaid, scopes }) => {
106
+ return items.map(({ ir, js, scopes }) => {
107
return `
108
## HIR
109
@@ -114,10 +113,6 @@ ${wrapWithTripleBackticks(ir)}
113
114
${wrapWithTripleBackticks(scopes)}
115
117
-### CFG
118
-
119
-${wrapWithTripleBackticks(mermaid, "mermaid")}
120
-
116
## Code
117
118
${wrapWithTripleBackticks(js, "javascript")}
@@ -128,7 +123,6 @@ ${wrapWithTripleBackticks(js, "javascript")}
123
type TestOutput = {
124
ir: string;
125
js: string;
131
- mermaid: string;
126
scopes: string;
127
};
128
@@ -157,14 +151,13 @@ function transform(text: string, file: string): Array<TestOutput> {
151
const scopes = printReactiveFunction(reactiveFunction);
152
153
const textHIR = printFunction(ir);
160
- const mermaid = visualizeHIRMermaid(ir);
154
155
invariant(ast !== null, "ast is null when codegen option is enabled");
156
const text = prettier.format(generate(ast).code.replace("\n\n", "\n"), {
157
semi: true,
158
parser: "babel-ts",
159
});
167
- items.push({ ir: textHIR, js: text, scopes, mermaid });
160
+ items.push({ ir: textHIR, js: text, scopes });
161
},
162
},
163
});