@samitouri / QOS-React / commits / 391aeab5aa

MutableRange is start(inclusive) to end(exclusive)

closes #796

Joseph Savona committed Nov 21, 2022 at 11:44 UTC 391aeab5aa683342457aa75d1c7c389601463930
46 files changed +309 -309
compiler/forget/src/HIR/HIR.ts
+2 -1
@@ -266,7 +266,8 @@ export type Primitive = {
266 * Range in which an identifier is mutable. Start and End refer to Instruction.id.
267 * TODO(gsn): Type Instruction.id better and use it here.
268 *
269 - * Start is exclusive, End is inclusive (ie, the value is mutable at that instruction).
269 + * Start is inclusive, End is exclusive (ie, end is the "first" instruction for which
270 + * the value is not mutable).
271 */
272 export type MutableRange = {
273 start: number;
compiler/forget/src/HIR/InferMutableLifetimes.ts
+2 -2
@@ -68,7 +68,7 @@ function inferPlace(place: Place, instr: Instruction) {
68 case Effect.Freeze:
69 return;
70 case Effect.Mutate: {
71 - place.identifier.mutableRange.end = instr.id;
71 + place.identifier.mutableRange.end = instr.id + 1;
72 return;
73 }
74 default:
@@ -126,7 +126,7 @@ export function inferMutableRanges(func: HIRFunction) {
126
127 // Let's be optimistic and assume this lvalue is not mutable by
128 // default.
129 - lvalueId.mutableRange.end = instr.id;
129 + lvalueId.mutableRange.end = instr.id + 1;
130 } else {
131 inferPlace(instr.lvalue.place, instr);
132 }
compiler/forget/src/HIR/InferReactiveScopeVariables.ts
+2 -3
@@ -146,8 +146,7 @@ export function inferReactiveScopeVariables(fn: HIRFunction) {
146 // Is the operand mutable at this given instruction
147 function isMutable(instr: Instruction, place: Place): boolean {
148 return (
149 - // TODO: should start really be exclusive?
150 - instr.id > place.identifier.mutableRange.start &&
151 - instr.id <= place.identifier.mutableRange.end
149 + instr.id >= place.identifier.mutableRange.start &&
150 + instr.id < place.identifier.mutableRange.end
151 );
152 }
compiler/forget/src/HIR/PrintHIR.ts
+1 -1
@@ -258,7 +258,7 @@ function printInstructionValue(instrValue: InstructionValue): string {
258 }
259
260 function isMutable(range: MutableRange): boolean {
261 - return range.end > range.start;
261 + return range.end > range.start + 1;
262 }
263
264 function printMutableRange(range: MutableRange): string {
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
+14 -14
@@ -27,19 +27,19 @@ function mutate(x, y) {}
27
28 ```
29 bb0:
30 - [1] Let mutate a$2_@0[0:8] = Object { }
31 - [2] Let mutate b$3_@0[0:8] = Object { }
32 - [3] Let mutate c$4_@0[0:8] = Object { }
30 + [1] Let mutate a$2_@0[0:9] = Object { }
31 + [2] Let mutate b$3_@0[0:9] = Object { }
32 + [3] Let mutate c$4_@0[0:9] = Object { }
33 While test=bb1 loop=bb3 fallthrough=bb2
34 bb1:
35 predecessor blocks: bb0 bb3
36 If (read cond$1) then:bb3 else:bb2
37 bb3:
38 predecessor blocks: bb1
39 - [4] Let mutate z$5_@0[0:8] = read a$2_@0
40 - [5] Reassign mutate a$2_@0[0:8] = read b$3_@0
41 - [6] Reassign mutate b$3_@0[0:8] = read c$4_@0
42 - [7] Reassign mutate c$4_@0[0:8] = read z$5_@0
39 + [4] Let mutate z$5_@0[0:9] = read a$2_@0
40 + [5] Reassign mutate a$2_@0[0:9] = read b$3_@0
41 + [6] Reassign mutate b$3_@0[0:9] = read c$4_@0
42 + [7] Reassign mutate c$4_@0[0:9] = read z$5_@0
43 [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
44 Goto(Continue) bb1
45 bb2:
@@ -57,9 +57,9 @@ flowchart TB
57 %% Basic Blocks
58 subgraph bb0
59 bb0_instrs["
60 - [1] Let mutate a$2_@0[0:8] = Object { }
61 - [2] Let mutate b$3_@0[0:8] = Object { }
62 - [3] Let mutate c$4_@0[0:8] = Object { }
60 + [1] Let mutate a$2_@0[0:9] = Object { }
61 + [2] Let mutate b$3_@0[0:9] = Object { }
62 + [3] Let mutate c$4_@0[0:9] = Object { }
63 "]
64 bb0_instrs --> bb0_terminal(["While"])
65 end
@@ -68,10 +68,10 @@ flowchart TB
68 end
69 subgraph bb3
70 bb3_instrs["
71 - [4] Let mutate z$5_@0[0:8] = read a$2_@0
72 - [5] Reassign mutate a$2_@0[0:8] = read b$3_@0
73 - [6] Reassign mutate b$3_@0[0:8] = read c$4_@0
74 - [7] Reassign mutate c$4_@0[0:8] = read z$5_@0
71 + [4] Let mutate z$5_@0[0:9] = read a$2_@0
72 + [5] Reassign mutate a$2_@0[0:9] = read b$3_@0
73 + [6] Reassign mutate b$3_@0[0:9] = read c$4_@0
74 + [7] Reassign mutate c$4_@0[0:9] = read z$5_@0
75 [8] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
76 "]
77 bb3_instrs --> bb3_terminal(["Goto"])
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
+4 -4
@@ -69,9 +69,9 @@ function f$0() {
69 ```
70 bb0:
71 [1] Const mutate $2_@0 = 1
72 - [2] Reassign mutate a$1_@1.b.c[0:4] = Binary read a$1_@1.b.c + read $2_@0
72 + [2] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c + read $2_@0
73 [3] Const mutate $3_@2 = 2
74 - [4] Reassign mutate a$1_@1.b.c[0:4] = Binary read a$1_@1.b.c * read $3_@2
74 + [4] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c * read $3_@2
75 Return
76 ```
77
@@ -83,9 +83,9 @@ flowchart TB
83 subgraph bb0
84 bb0_instrs["
85 [1] Const mutate $2_@0 = 1
86 - [2] Reassign mutate a$1_@1.b.c[0:4] = Binary read a$1_@1.b.c + read $2_@0
86 + [2] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c + read $2_@0
87 [3] Const mutate $3_@2 = 2
88 - [4] Reassign mutate a$1_@1.b.c[0:4] = Binary read a$1_@1.b.c * read $3_@2
88 + [4] Reassign mutate a$1_@1.b.c[0:5] = Binary read a$1_@1.b.c * read $3_@2
89 "]
90 bb0_instrs --> bb0_terminal(["Return"])
91 end
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+4 -4
@@ -47,8 +47,8 @@ function foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$2_@0[0:6] = Array []
51 - [2] Const mutate b$3_@0[0:6] = Object { }
50 + [1] Const mutate a$2_@0[0:7] = Array []
51 + [2] Const mutate b$3_@0[0:7] = Object { }
52 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
53 [4] Const mutate $6_@1 = "div"
54 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
@@ -65,8 +65,8 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$2_@0[0:6] = Array []
69 - [2] Const mutate b$3_@0[0:6] = Object { }
68 + [1] Const mutate a$2_@0[0:7] = Array []
69 + [2] Const mutate b$3_@0[0:7] = Object { }
70 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
71 [4] Const mutate $6_@1 = 'div'
72 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+12 -12
@@ -37,10 +37,10 @@ function Component(props) {
37 bb0:
38 [1] Const mutate items$2_@0 = read props$1.items
39 [2] Const mutate maxItems$3_@1 = read props$1.maxItems
40 - [3] Const mutate renderedItems$4_@2[3:14] = Array []
41 - [4] Const mutate seen$5_@3[0:11] = New mutate Set$6_@3()
40 + [3] Const mutate renderedItems$4_@2[3:15] = Array []
41 + [4] Const mutate seen$5_@3[0:12] = New mutate Set$6_@3()
42 [5] Const mutate $9_@4 = 0
43 - [6] Const mutate max$7_@5[0:6] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
43 + [6] Const mutate max$7_@5[0:7] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
44 Goto bb1
45 bb1:
46 predecessor blocks: bb0 bb5 bb10
@@ -48,15 +48,15 @@ bb1:
48 bb3:
49 predecessor blocks: bb1
50 [7] Const mutate $11_@6 = null
51 - [8] Const mutate $12_@3[0:11] = Binary read item$10_@3 == read $11_@6
51 + [8] Const mutate $12_@3[0:12] = Binary read item$10_@3 == read $11_@6
52 If (read $12_@3) then:bb8 else:bb9
53 bb8:
54 predecessor blocks: bb3
55 - [9] Const mutate $13_@3[0:11] = read $12_@3
55 + [9] Const mutate $13_@3[0:12] = read $12_@3
56 Goto bb7
57 bb9:
58 predecessor blocks: bb3
59 - [10] Const mutate $13_@3[0:11] = Call mutate seen$5_@3.has(mutate item$10_@3)
59 + [10] Const mutate $13_@3[0:12] = Call mutate seen$5_@3.has(mutate item$10_@3)
60 Goto bb7
61 bb7:
62 predecessor blocks: bb8 bb9
@@ -98,10 +98,10 @@ flowchart TB
98 bb0_instrs["
99 [1] Const mutate items$2_@0 = read props$1.items
100 [2] Const mutate maxItems$3_@1 = read props$1.maxItems
101 - [3] Const mutate renderedItems$4_@2[3:14] = Array []
102 - [4] Const mutate seen$5_@3[0:11] = New mutate Set$6_@3()
101 + [3] Const mutate renderedItems$4_@2[3:15] = Array []
102 + [4] Const mutate seen$5_@3[0:12] = New mutate Set$6_@3()
103 [5] Const mutate $9_@4 = 0
104 - [6] Const mutate max$7_@5[0:6] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
104 + [6] Const mutate max$7_@5[0:7] = Call mutate Math$8_@5.max(read $9_@4, read maxItems$3_@1)
105 "]
106 bb0_instrs --> bb0_terminal(["Goto"])
107 end
@@ -111,19 +111,19 @@ flowchart TB
111 subgraph bb3
112 bb3_instrs["
113 [7] Const mutate $11_@6 = null
114 - [8] Const mutate $12_@3[0:11] = Binary read item$10_@3 == read $11_@6
114 + [8] Const mutate $12_@3[0:12] = Binary read item$10_@3 == read $11_@6
115 "]
116 bb3_instrs --> bb3_terminal(["If (read $12_@3)"])
117 end
118 subgraph bb8
119 bb8_instrs["
120 - [9] Const mutate $13_@3[0:11] = read $12_@3
120 + [9] Const mutate $13_@3[0:12] = read $12_@3
121 "]
122 bb8_instrs --> bb8_terminal(["Goto"])
123 end
124 subgraph bb9
125 bb9_instrs["
126 - [10] Const mutate $13_@3[0:11] = Call mutate seen$5_@3.has(mutate item$10_@3)
126 + [10] Const mutate $13_@3[0:12] = Call mutate seen$5_@3.has(mutate item$10_@3)
127 "]
128 bb9_instrs --> bb9_terminal(["Goto"])
129 end
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+10 -10
@@ -78,7 +78,7 @@ function Component(props) {
78
79 ```
80 bb0:
81 - [1] Const mutate a_DEBUG$2_@0[1:4] = Array []
81 + [1] Const mutate a_DEBUG$2_@0[1:5] = Array []
82 [2] Call mutate a_DEBUG$2_@0.push(read props$1.a)
83 If (read props$1.b) then:bb2 else:bb1
84 bb2:
@@ -98,7 +98,7 @@ flowchart TB
98 %% Basic Blocks
99 subgraph bb0
100 bb0_instrs["
101 - [1] Const mutate a_DEBUG$2_@0[1:4] = Array []
101 + [1] Const mutate a_DEBUG$2_@0[1:5] = Array []
102 [2] Call mutate a_DEBUG$2_@0.push(read props$1.a)
103 "]
104 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
@@ -141,7 +141,7 @@ function Component$0(props$1) {
141
142 ```
143 bb0:
144 - [1] Const mutate a$2_@0[1:4] = Array []
144 + [1] Const mutate a$2_@0[1:5] = Array []
145 [2] Call mutate a$2_@0.push(read props$1.a)
146 If (read props$1.b) then:bb2 else:bb1
147 bb2:
@@ -161,7 +161,7 @@ flowchart TB
161 %% Basic Blocks
162 subgraph bb0
163 bb0_instrs["
164 - [1] Const mutate a$2_@0[1:4] = Array []
164 + [1] Const mutate a$2_@0[1:5] = Array []
165 [2] Call mutate a$2_@0.push(read props$1.a)
166 "]
167 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
@@ -205,7 +205,7 @@ function Component$0(props$1) {
205
206 ```
207 bb0:
208 - [1] Const mutate a$2_@0[1:5] = Array []
208 + [1] Const mutate a$2_@0[1:6] = Array []
209 [2] Call mutate a$2_@0.push(read props$1.a)
210 If (read props$1.b) then:bb2 else:bb1
211 bb2:
@@ -226,7 +226,7 @@ flowchart TB
226 %% Basic Blocks
227 subgraph bb0
228 bb0_instrs["
229 - [1] Const mutate a$2_@0[1:5] = Array []
229 + [1] Const mutate a$2_@0[1:6] = Array []
230 [2] Call mutate a$2_@0.push(read props$1.a)
231 "]
232 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
@@ -271,7 +271,7 @@ function Component$0(props$1) {
271
272 ```
273 bb0:
274 - [1] Const mutate a$2_@0[1:4] = Array []
274 + [1] Const mutate a$2_@0[1:5] = Array []
275 [2] Call mutate a$2_@0.push(read props$1.a)
276 If (read props$1.b) then:bb2 else:bb1
277 bb2:
@@ -291,7 +291,7 @@ flowchart TB
291 %% Basic Blocks
292 subgraph bb0
293 bb0_instrs["
294 - [1] Const mutate a$2_@0[1:4] = Array []
294 + [1] Const mutate a$2_@0[1:5] = Array []
295 [2] Call mutate a$2_@0.push(read props$1.a)
296 "]
297 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
@@ -335,7 +335,7 @@ function Component$0(props$1) {
335
336 ```
337 bb0:
338 - [1] Const mutate a$2_@0[1:4] = Array []
338 + [1] Const mutate a$2_@0[1:5] = Array []
339 [2] Call mutate a$2_@0.push(read props$1.a)
340 If (read props$1.b) then:bb1 else:bb2
341 bb2:
@@ -355,7 +355,7 @@ flowchart TB
355 %% Basic Blocks
356 subgraph bb0
357 bb0_instrs["
358 - [1] Const mutate a$2_@0[1:4] = Array []
358 + [1] Const mutate a$2_@0[1:5] = Array []
359 [2] Call mutate a$2_@0.push(read props$1.a)
360 "]
361 bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+10 -10
@@ -67,8 +67,8 @@ function mayMutate() {}
67
68 ```
69 bb0:
70 - [1] Const mutate a$2_@0[1:3] = Array []
71 - [2] Const mutate b$3_@1[2:4] = Array []
70 + [1] Const mutate a$2_@0[1:4] = Array []
71 + [2] Const mutate b$3_@1[2:5] = Array []
72 If (read b$3_@1) then:bb2 else:bb1
73 bb2:
74 predecessor blocks: bb0
@@ -94,8 +94,8 @@ flowchart TB
94 %% Basic Blocks
95 subgraph bb0
96 bb0_instrs["
97 - [1] Const mutate a$2_@0[1:3] = Array []
98 - [2] Const mutate b$3_@1[2:4] = Array []
97 + [1] Const mutate a$2_@0[1:4] = Array []
98 + [2] Const mutate b$3_@1[2:5] = Array []
99 "]
100 bb0_instrs --> bb0_terminal(["If (read b$3_@1)"])
101 end
@@ -153,9 +153,9 @@ function Component$0(props$1) {
153
154 ```
155 bb0:
156 - [1] Const mutate a$2_@0[1:4] = Array []
157 - [2] Const mutate b$3_@1[0:5] = Array []
158 - [3] Const mutate $5_@1[0:5] = Call mutate mayMutate$4_@1(mutate b$3_@1)
156 + [1] Const mutate a$2_@0[1:5] = Array []
157 + [2] Const mutate b$3_@1[0:6] = Array []
158 + [3] Const mutate $5_@1[0:6] = Call mutate mayMutate$4_@1(mutate b$3_@1)
159 If (read $5_@1) then:bb2 else:bb1
160 bb2:
161 predecessor blocks: bb0
@@ -181,9 +181,9 @@ flowchart TB
181 %% Basic Blocks
182 subgraph bb0
183 bb0_instrs["
184 - [1] Const mutate a$2_@0[1:4] = Array []
185 - [2] Const mutate b$3_@1[0:5] = Array []
186 - [3] Const mutate $5_@1[0:5] = Call mutate mayMutate$4_@1(mutate b$3_@1)
184 + [1] Const mutate a$2_@0[1:5] = Array []
185 + [2] Const mutate b$3_@1[0:6] = Array []
186 + [3] Const mutate $5_@1[0:6] = Call mutate mayMutate$4_@1(mutate b$3_@1)
187 "]
188 bb0_instrs --> bb0_terminal(["If (read $5_@1)"])
189 end
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+4 -4
@@ -47,8 +47,8 @@ function Foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$2_@0[0:6] = Array []
51 - [2] Const mutate b$3_@0[0:6] = Object { }
50 + [1] Const mutate a$2_@0[0:7] = Array []
51 + [2] Const mutate b$3_@0[0:7] = Object { }
52 [3] New mutate Foo$4_@0(mutate a$2_@0, mutate b$3_@0)
53 [4] Const mutate $6_@1 = "div"
54 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
@@ -65,8 +65,8 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$2_@0[0:6] = Array []
69 - [2] Const mutate b$3_@0[0:6] = Object { }
68 + [1] Const mutate a$2_@0[0:7] = Array []
69 + [2] Const mutate b$3_@0[0:7] = Object { }
70 [3] New mutate Foo$4_@0(mutate a$2_@0, mutate b$3_@0)
71 [4] Const mutate $6_@1 = 'div'
72 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+6 -6
@@ -18,10 +18,10 @@ function foo(x) {}
18
19 ```
20 bb0:
21 - [1] Const mutate a$1_@0 = Array []
22 - [2] Const mutate b$2_@1 = read a$1_@0
21 + [1] Const mutate a$1_@0[1:3] = Array []
22 + [2] Const mutate b$2_@0[1:3] = read a$1_@0
23 [3] Call read useFreeze$3(freeze a$1_@0)
24 - [4] Call mutate foo$4_@2(read b$2_@1)
24 + [4] Call mutate foo$4_@1(read b$2_@0)
25 Return
26 ```
27
@@ -32,10 +32,10 @@ flowchart TB
32 %% Basic Blocks
33 subgraph bb0
34 bb0_instrs["
35 - [1] Const mutate a$1_@0 = Array []
36 - [2] Const mutate b$2_@1 = read a$1_@0
35 + [1] Const mutate a$1_@0[1:3] = Array []
36 + [2] Const mutate b$2_@0[1:3] = read a$1_@0
37 [3] Call read useFreeze$3(freeze a$1_@0)
38 - [4] Call mutate foo$4_@2(read b$2_@1)
38 + [4] Call mutate foo$4_@1(read b$2_@0)
39 "]
40 bb0_instrs --> bb0_terminal(["Return"])
41 end
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+14 -14
@@ -27,23 +27,23 @@ function call(x) {}
27 ```
28 bb0:
29 [1] Const mutate cond$2_@0 = read props$1.cond
30 - [2] Const mutate x$3_@1 = read props$1.x
30 + [2] Const mutate x$3_@1[2:6] = read props$1.x
31 [3] Let mutate a$4_@2 = undefined
32 If (read cond$2_@0) then:bb2 else:bb3
33 bb2:
34 predecessor blocks: bb0
35 - [4] Reassign mutate a$4_@3[4:5] = read x$3_@1
35 + [4] Reassign mutate a$4_@1[2:6] = read x$3_@1
36 Goto bb1
37 bb3:
38 predecessor blocks: bb0
39 - [5] Reassign mutate a$4_@3[4:5] = Array []
39 + [5] Reassign mutate a$4_@1[2:6] = Array []
40 Goto bb1
41 bb1:
42 predecessor blocks: bb2 bb3
43 - [6] Call read useFreeze$5(freeze a$4_@3)
44 - [7] Call read useFreeze$5(read a$4_@3)
45 - [8] Call mutate call$6_@4(read a$4_@3)
46 - Return read a$4_@3
43 + [6] Call read useFreeze$5(freeze a$4_@1)
44 + [7] Call read useFreeze$5(read a$4_@1)
45 + [8] Call mutate call$6_@3(read a$4_@1)
46 + Return read a$4_@1
47 ```
48
49 ### CFG
@@ -54,30 +54,30 @@ flowchart TB
54 subgraph bb0
55 bb0_instrs["
56 [1] Const mutate cond$2_@0 = read props$1.cond
57 - [2] Const mutate x$3_@1 = read props$1.x
57 + [2] Const mutate x$3_@1[2:6] = read props$1.x
58 [3] Let mutate a$4_@2 = undefined
59 "]
60 bb0_instrs --> bb0_terminal(["If (read cond$2_@0)"])
61 end
62 subgraph bb2
63 bb2_instrs["
64 - [4] Reassign mutate a$4_@3[4:5] = read x$3_@1
64 + [4] Reassign mutate a$4_@1[2:6] = read x$3_@1
65 "]
66 bb2_instrs --> bb2_terminal(["Goto"])
67 end
68 subgraph bb3
69 bb3_instrs["
70 - [5] Reassign mutate a$4_@3[4:5] = Array []
70 + [5] Reassign mutate a$4_@1[2:6] = Array []
71 "]
72 bb3_instrs --> bb3_terminal(["Goto"])
73 end
74 subgraph bb1
75 bb1_instrs["
76 - [6] Call read useFreeze$5(freeze a$4_@3)
77 - [7] Call read useFreeze$5(read a$4_@3)
78 - [8] Call mutate call$6_@4(read a$4_@3)
76 + [6] Call read useFreeze$5(freeze a$4_@1)
77 + [7] Call read useFreeze$5(read a$4_@1)
78 + [8] Call mutate call$6_@3(read a$4_@1)
79 "]
80 - bb1_instrs --> bb1_terminal(["Return read a$4_@3"])
80 + bb1_instrs --> bb1_terminal(["Return read a$4_@1"])
81 end
82
83 %% Jumps
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+4 -4
@@ -149,8 +149,8 @@ function Foo$0() {
149
150 ```
151 bb0:
152 - [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
153 - [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
152 + [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
153 + [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
154 If (read props$1.c) then:bb2 else:bb1
155 bb2:
156 predecessor blocks: bb0
@@ -170,8 +170,8 @@ flowchart TB
170 %% Basic Blocks
171 subgraph bb0
172 bb0_instrs["
173 - [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
174 - [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
173 + [1] Const mutate a$2_@0[0:5] = Call mutate compute$3_@0(read props$1.a)
174 + [2] Const mutate b$4_@0[0:5] = Call mutate compute$3_@0(read props$1.b)
175 "]
176 bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
177 end
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+4 -4
@@ -28,8 +28,8 @@ function Foo() {}
28
29 ```
30 bb0:
31 - [1] Const mutate a$2_@0[0:2] = Call mutate compute$3_@0(read props$1.a)
32 - [2] Const mutate b$4_@0[0:2] = Call mutate compute$3_@0(read props$1.b)
31 + [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
32 + [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
33 [3] Const mutate $6_@1 = JSX <read Foo$5 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$5>
34 Return read $6_@1
35 ```
@@ -41,8 +41,8 @@ flowchart TB
41 %% Basic Blocks
42 subgraph bb0
43 bb0_instrs["
44 - [1] Const mutate a$2_@0[0:2] = Call mutate compute$3_@0(read props$1.a)
45 - [2] Const mutate b$4_@0[0:2] = Call mutate compute$3_@0(read props$1.b)
44 + [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
45 + [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
46 [3] Const mutate $6_@1 = JSX <read Foo$5 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$5>
47 "]
48 bb0_instrs --> bb0_terminal(["Return read $6_@1"])
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+4 -4
@@ -115,8 +115,8 @@ function Foo$0() {
115
116 ```
117 bb0:
118 - [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
119 - [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
118 + [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
119 + [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
120 If (read props$1.c) then:bb2 else:bb1
121 bb2:
122 predecessor blocks: bb0
@@ -135,8 +135,8 @@ flowchart TB
135 %% Basic Blocks
136 subgraph bb0
137 bb0_instrs["
138 - [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
139 - [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
138 + [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
139 + [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
140 "]
141 bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
142 end
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+4 -4
@@ -28,8 +28,8 @@ function Foo() {}
28
29 ```
30 bb0:
31 - [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
32 - [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
31 + [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
32 + [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
33 [3] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
34 [4] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
35 Return read $7_@1
@@ -42,8 +42,8 @@ flowchart TB
42 %% Basic Blocks
43 subgraph bb0
44 bb0_instrs["
45 - [1] Const mutate a$2_@0[0:3] = Call mutate compute$3_@0(read props$1.a)
46 - [2] Const mutate b$4_@0[0:3] = Call mutate compute$3_@0(read props$1.b)
45 + [1] Const mutate a$2_@0[0:4] = Call mutate compute$3_@0(read props$1.a)
46 + [2] Const mutate b$4_@0[0:4] = Call mutate compute$3_@0(read props$1.b)
47 [3] Call mutate foo$5_@0(mutate a$2_@0, mutate b$4_@0)
48 [4] Const mutate $7_@1 = JSX <read Foo$6 a={freeze a$2_@0} b={freeze b$4_@0} ></read Foo$6>
49 "]
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
+28 -28
@@ -23,19 +23,19 @@ function g() {}
23
24 ```
25 bb0:
26 - [1] Const mutate $2_@0[0:1] = Call mutate f$1_@0()
26 + [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
27 If (read $2_@0) then:bb2 else:bb3
28 bb2:
29 predecessor blocks: bb0
30 - [2] Const mutate $3_@1[0:3] = Call mutate g$4_@1()
30 + [2] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
31 Goto bb1
32 bb3:
33 predecessor blocks: bb0
34 - [3] Const mutate $3_@1[0:3] = read $2_@0
34 + [3] Const mutate $3_@0[0:4] = read $2_@0
35 Goto bb1
36 bb1:
37 predecessor blocks: bb2 bb3
38 - Return freeze $3_@1
38 + Return freeze $3_@0
39 ```
40
41 ### CFG
@@ -45,24 +45,24 @@ flowchart TB
45 %% Basic Blocks
46 subgraph bb0
47 bb0_instrs["
48 - [1] Const mutate $2_@0[0:1] = Call mutate f$1_@0()
48 + [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
49 "]
50 bb0_instrs --> bb0_terminal(["If (read $2_@0)"])
51 end
52 subgraph bb2
53 bb2_instrs["
54 - [2] Const mutate $3_@1[0:3] = Call mutate g$4_@1()
54 + [2] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
55 "]
56 bb2_instrs --> bb2_terminal(["Goto"])
57 end
58 subgraph bb3
59 bb3_instrs["
60 - [3] Const mutate $3_@1[0:3] = read $2_@0
60 + [3] Const mutate $3_@0[0:4] = read $2_@0
61 "]
62 bb3_instrs --> bb3_terminal(["Goto"])
63 end
64 subgraph bb1
65 - bb1_terminal(["Return freeze $3_@1"])
65 + bb1_terminal(["Return freeze $3_@0"])
66 end
67
68 %% Jumps
@@ -89,19 +89,19 @@ function And$0() {
89
90 ```
91 bb0:
92 - [1] Const mutate $2_@0[0:1] = Call mutate f$1_@0()
92 + [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
93 If (read $2_@0) then:bb2 else:bb3
94 bb2:
95 predecessor blocks: bb0
96 - [2] Const mutate $3_@1[0:3] = read $2_@0
96 + [2] Const mutate $3_@0[0:4] = read $2_@0
97 Goto bb1
98 bb3:
99 predecessor blocks: bb0
100 - [3] Const mutate $3_@1[0:3] = Call mutate g$4_@1()
100 + [3] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
101 Goto bb1
102 bb1:
103 predecessor blocks: bb2 bb3
104 - Return freeze $3_@1
104 + Return freeze $3_@0
105 ```
106
107 ### CFG
@@ -111,24 +111,24 @@ flowchart TB
111 %% Basic Blocks
112 subgraph bb0
113 bb0_instrs["
114 - [1] Const mutate $2_@0[0:1] = Call mutate f$1_@0()
114 + [1] Const mutate $2_@0[0:4] = Call mutate f$1_@0()
115 "]
116 bb0_instrs --> bb0_terminal(["If (read $2_@0)"])
117 end
118 subgraph bb2
119 bb2_instrs["
120 - [2] Const mutate $3_@1[0:3] = read $2_@0
120 + [2] Const mutate $3_@0[0:4] = read $2_@0
121 "]
122 bb2_instrs --> bb2_terminal(["Goto"])
123 end
124 subgraph bb3
125 bb3_instrs["
126 - [3] Const mutate $3_@1[0:3] = Call mutate g$4_@1()
126 + [3] Const mutate $3_@0[0:4] = Call mutate g$4_@0()
127 "]
128 bb3_instrs --> bb3_terminal(["Goto"])
129 end
130 subgraph bb1
131 - bb1_terminal(["Return freeze $3_@1"])
131 + bb1_terminal(["Return freeze $3_@0"])
132 end
133
134 %% Jumps
@@ -155,21 +155,21 @@ function Or$0() {
155
156 ```
157 bb0:
158 - [1] Const mutate $3_@0[0:1] = Call mutate f$2_@0()
158 + [1] Const mutate $3_@0[0:6] = Call mutate f$2_@0()
159 [2] Const mutate $4_@1 = null
160 - [3] Const mutate $5_@2 = Binary read $3_@0 != read $4_@1
161 - If (read $5_@2) then:bb2 else:bb3
160 + [3] Const mutate $5_@0[0:6] = Binary read $3_@0 != read $4_@1
161 + If (read $5_@0) then:bb2 else:bb3
162 bb2:
163 predecessor blocks: bb0
164 - [4] Const mutate $6_@3[0:5] = read $3_@0
164 + [4] Const mutate $6_@0[0:6] = read $3_@0
165 Goto bb1
166 bb3:
167 predecessor blocks: bb0
168 - [5] Const mutate $6_@3[0:5] = Call mutate g$7_@3()
168 + [5] Const mutate $6_@0[0:6] = Call mutate g$7_@0()
169 Goto bb1
170 bb1:
171 predecessor blocks: bb2 bb3
172 - Return freeze $6_@3
172 + Return freeze $6_@0
173 ```
174
175 ### CFG
@@ -179,26 +179,26 @@ flowchart TB
179 %% Basic Blocks
180 subgraph bb0
181 bb0_instrs["
182 - [1] Const mutate $3_@0[0:1] = Call mutate f$2_@0()
182 + [1] Const mutate $3_@0[0:6] = Call mutate f$2_@0()
183 [2] Const mutate $4_@1 = null
184 - [3] Const mutate $5_@2 = Binary read $3_@0 != read $4_@1
184 + [3] Const mutate $5_@0[0:6] = Binary read $3_@0 != read $4_@1
185 "]
186 - bb0_instrs --> bb0_terminal(["If (read $5_@2)"])
186 + bb0_instrs --> bb0_terminal(["If (read $5_@0)"])
187 end
188 subgraph bb2
189 bb2_instrs["
190 - [4] Const mutate $6_@3[0:5] = read $3_@0
190 + [4] Const mutate $6_@0[0:6] = read $3_@0
191 "]
192 bb2_instrs --> bb2_terminal(["Goto"])
193 end
194 subgraph bb3
195 bb3_instrs["
196 - [5] Const mutate $6_@3[0:5] = Call mutate g$7_@3()
196 + [5] Const mutate $6_@0[0:6] = Call mutate g$7_@0()
197 "]
198 bb3_instrs --> bb3_terminal(["Goto"])
199 end
200 subgraph bb1
201 - bb1_terminal(["Return freeze $6_@3"])
201 + bb1_terminal(["Return freeze $6_@0"])
202 end
203
204 %% Jumps
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+20 -20
@@ -99,10 +99,10 @@ function cond$0(x$1) {
99
100 ```
101 bb0:
102 - [1] Let mutate a$2_@0[0:14] = Object { }
103 - [2] Let mutate b$3_@0[0:14] = Object { }
104 - [3] Let mutate c$4_@0[0:14] = Object { }
105 - [4] Let mutate d$5_@0[0:14] = Object { }
102 + [1] Let mutate a$2_@0[0:15] = Object { }
103 + [2] Let mutate b$3_@0[0:15] = Object { }
104 + [3] Let mutate c$4_@0[0:15] = Object { }
105 + [4] Let mutate d$5_@0[0:15] = Object { }
106 While test=bb1 loop=bb3 fallthrough=bb2
107 bb1:
108 predecessor blocks: bb0 bb4
@@ -110,13 +110,13 @@ bb1:
110 If (read $10_@1) then:bb3 else:bb2
111 bb3:
112 predecessor blocks: bb1
113 - [6] Let mutate z$6_@0[0:14] = read a$2_@0
114 - [7] Reassign mutate a$2_@0[0:14] = read b$3_@0
115 - [8] Reassign mutate b$3_@0[0:14] = read c$4_@0
116 - [9] Reassign mutate c$4_@0[0:14] = read d$5_@0
117 - [10] Reassign mutate d$5_@0[0:14] = read z$6_@0
113 + [6] Let mutate z$6_@0[0:15] = read a$2_@0
114 + [7] Reassign mutate a$2_@0[0:15] = read b$3_@0
115 + [8] Reassign mutate b$3_@0[0:15] = read c$4_@0
116 + [9] Reassign mutate c$4_@0[0:15] = read d$5_@0
117 + [10] Reassign mutate d$5_@0[0:15] = read z$6_@0
118 [11] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
119 - [12] Const mutate $9_@0[0:14] = Call mutate cond$8_@0(mutate a$2_@0)
119 + [12] Const mutate $9_@0[0:15] = Call mutate cond$8_@0(mutate a$2_@0)
120 If (read $9_@0) then:bb2 else:bb4
121 bb4:
122 predecessor blocks: bb3
@@ -147,10 +147,10 @@ flowchart TB
147 %% Basic Blocks
148 subgraph bb0
149 bb0_instrs["
150 - [1] Let mutate a$2_@0[0:14] = Object { }
151 - [2] Let mutate b$3_@0[0:14] = Object { }
152 - [3] Let mutate c$4_@0[0:14] = Object { }
153 - [4] Let mutate d$5_@0[0:14] = Object { }
150 + [1] Let mutate a$2_@0[0:15] = Object { }
151 + [2] Let mutate b$3_@0[0:15] = Object { }
152 + [3] Let mutate c$4_@0[0:15] = Object { }
153 + [4] Let mutate d$5_@0[0:15] = Object { }
154 "]
155 bb0_instrs --> bb0_terminal(["While"])
156 end
@@ -162,13 +162,13 @@ flowchart TB
162 end
163 subgraph bb3
164 bb3_instrs["
165 - [6] Let mutate z$6_@0[0:14] = read a$2_@0
166 - [7] Reassign mutate a$2_@0[0:14] = read b$3_@0
167 - [8] Reassign mutate b$3_@0[0:14] = read c$4_@0
168 - [9] Reassign mutate c$4_@0[0:14] = read d$5_@0
169 - [10] Reassign mutate d$5_@0[0:14] = read z$6_@0
165 + [6] Let mutate z$6_@0[0:15] = read a$2_@0
166 + [7] Reassign mutate a$2_@0[0:15] = read b$3_@0
167 + [8] Reassign mutate b$3_@0[0:15] = read c$4_@0
168 + [9] Reassign mutate c$4_@0[0:15] = read d$5_@0
169 + [10] Reassign mutate d$5_@0[0:15] = read z$6_@0
170 [11] Call mutate mutate$7_@0(mutate a$2_@0, mutate b$3_@0)
171 - [12] Const mutate $9_@0[0:14] = Call mutate cond$8_@0(mutate a$2_@0)
171 + [12] Const mutate $9_@0[0:15] = Call mutate cond$8_@0(mutate a$2_@0)
172 "]
173 bb3_instrs --> bb3_terminal(["If (read $9_@0)"])
174 end
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+8 -8
@@ -70,10 +70,10 @@ bb0:
70 [1] Const mutate a$2_@0 = Object { }
71 [2] Const mutate b$3_@1 = Array [read a$2_@0]
72 [3] Const mutate c$4_@2 = Object { }
73 - [4] Const mutate d$5_@3[0:9] = Object { c: read c$4_@2 }
74 - [5] Const mutate x$6_@3[0:9] = Object { }
75 - [6] Reassign mutate x$6_@3.b[0:9] = read b$3_@1
76 - [7] Const mutate y$7_@3[0:9] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
73 + [4] Const mutate d$5_@3[0:10] = Object { c: read c$4_@2 }
74 + [5] Const mutate x$6_@3[0:10] = Object { }
75 + [6] Reassign mutate x$6_@3.b[0:10] = read b$3_@1
76 + [7] Const mutate y$7_@3[0:10] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
77 If (read a$2_@0) then:bb1 else:bb1
78 bb1:
79 predecessor blocks: bb0
@@ -104,10 +104,10 @@ flowchart TB
104 [1] Const mutate a$2_@0 = Object { }
105 [2] Const mutate b$3_@1 = Array [read a$2_@0]
106 [3] Const mutate c$4_@2 = Object { }
107 - [4] Const mutate d$5_@3[0:9] = Object { c: read c$4_@2 }
108 - [5] Const mutate x$6_@3[0:9] = Object { }
109 - [6] Reassign mutate x$6_@3.b[0:9] = read b$3_@1
110 - [7] Const mutate y$7_@3[0:9] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
107 + [4] Const mutate d$5_@3[0:10] = Object { c: read c$4_@2 }
108 + [5] Const mutate x$6_@3[0:10] = Object { }
109 + [6] Reassign mutate x$6_@3.b[0:10] = read b$3_@1
110 + [7] Const mutate y$7_@3[0:10] = Call mutate mutate$8_@3(mutate x$6_@3, mutate d$5_@3)
111 "]
112 bb0_instrs --> bb0_terminal(["If (read a$2_@0)"])
113 end
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
+8 -8
@@ -94,10 +94,10 @@ function cond$0() {
94
95 ```
96 bb0:
97 - [1] Let mutate a$2_@0[0:9] = Object { }
98 - [2] Let mutate b$3_@0[0:9] = Object { }
97 + [1] Let mutate a$2_@0[0:10] = Object { }
98 + [2] Let mutate b$3_@0[0:10] = Object { }
99 [3] Let mutate c$4_@1 = Object { }
100 - [4] Let mutate d$5_@0[0:9] = Object { }
100 + [4] Let mutate d$5_@0[0:10] = Object { }
101 While test=bb1 loop=bb3 fallthrough=bb2
102 bb1:
103 predecessor blocks: bb0 bb4
@@ -106,7 +106,7 @@ bb1:
106 bb3:
107 predecessor blocks: bb1
108 [6] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
109 - [7] Const mutate $8_@0[0:9] = Call mutate cond$7_@0(mutate a$2_@0)
109 + [7] Const mutate $8_@0[0:10] = Call mutate cond$7_@0(mutate a$2_@0)
110 If (read $8_@0) then:bb2 else:bb4
111 bb4:
112 predecessor blocks: bb3
@@ -137,10 +137,10 @@ flowchart TB
137 %% Basic Blocks
138 subgraph bb0
139 bb0_instrs["
140 - [1] Let mutate a$2_@0[0:9] = Object { }
141 - [2] Let mutate b$3_@0[0:9] = Object { }
140 + [1] Let mutate a$2_@0[0:10] = Object { }
141 + [2] Let mutate b$3_@0[0:10] = Object { }
142 [3] Let mutate c$4_@1 = Object { }
143 - [4] Let mutate d$5_@0[0:9] = Object { }
143 + [4] Let mutate d$5_@0[0:10] = Object { }
144 "]
145 bb0_instrs --> bb0_terminal(["While"])
146 end
@@ -153,7 +153,7 @@ flowchart TB
153 subgraph bb3
154 bb3_instrs["
155 [6] Call mutate mutate$6_@0(mutate a$2_@0, mutate b$3_@0)
156 - [7] Const mutate $8_@0[0:9] = Call mutate cond$7_@0(mutate a$2_@0)
156 + [7] Const mutate $8_@0[0:10] = Call mutate cond$7_@0(mutate a$2_@0)
157 "]
158 bb3_instrs --> bb3_terminal(["If (read $8_@0)"])
159 end
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+4 -4
@@ -17,9 +17,9 @@ function Component(props) {
17
18 ```
19 bb0:
20 - [1] Const mutate x$2_@0[1:5] = Object { }
20 + [1] Const mutate x$2_@0[1:6] = Object { }
21 [2] Const mutate y$3_@1 = Array []
22 - [3] Reassign mutate x$2_@0.y[1:5] = read y$3_@1
22 + [3] Reassign mutate x$2_@0.y[1:6] = read y$3_@1
23 [4] Const mutate child$4_@2 = JSX <read Component$0 data={freeze y$3_@1} ></read Component$0>
24 [5] Call mutate x$2_@0.y.push(read props$1.p0)
25 [6] Const mutate $5_@3 = JSX <read Component$0 data={freeze x$2_@0} >{read child$4_@2}</read Component$0>
@@ -33,9 +33,9 @@ flowchart TB
33 %% Basic Blocks
34 subgraph bb0
35 bb0_instrs["
36 - [1] Const mutate x$2_@0[1:5] = Object { }
36 + [1] Const mutate x$2_@0[1:6] = Object { }
37 [2] Const mutate y$3_@1 = Array []
38 - [3] Reassign mutate x$2_@0.y[1:5] = read y$3_@1
38 + [3] Reassign mutate x$2_@0.y[1:6] = read y$3_@1
39 [4] Const mutate child$4_@2 = JSX <read Component$0 data={freeze y$3_@1} ></read Component$0>
40 [5] Call mutate x$2_@0.y.push(read props$1.p0)
41 [6] Const mutate $5_@3 = JSX <read Component$0 data={freeze x$2_@0} >{read child$4_@2}</read Component$0>
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
+8 -8
@@ -18,11 +18,11 @@ function foo() {
18
19 ```
20 bb0:
21 - [1] Let mutate x$1_@0[1:5] = Object { }
22 - [2] Let mutate y$2_@1[2:4] = Array []
23 - [3] Let mutate z$3_@1[2:4] = Object { }
21 + [1] Let mutate x$1_@0[1:6] = Object { }
22 + [2] Let mutate y$2_@1[2:5] = Array []
23 + [3] Let mutate z$3_@1[2:5] = Object { }
24 [4] Call mutate y$2_@1.push(mutate z$3_@1)
25 - [5] Reassign mutate x$1_@0.y[1:5] = read y$2_@1
25 + [5] Reassign mutate x$1_@0.y[1:6] = read y$2_@1
26 Return freeze x$1_@0
27 ```
28
@@ -33,11 +33,11 @@ flowchart TB
33 %% Basic Blocks
34 subgraph bb0
35 bb0_instrs["
36 - [1] Let mutate x$1_@0[1:5] = Object { }
37 - [2] Let mutate y$2_@1[2:4] = Array []
38 - [3] Let mutate z$3_@1[2:4] = Object { }
36 + [1] Let mutate x$1_@0[1:6] = Object { }
37 + [2] Let mutate y$2_@1[2:5] = Array []
38 + [3] Let mutate z$3_@1[2:5] = Object { }
39 [4] Call mutate y$2_@1.push(mutate z$3_@1)
40 - [5] Reassign mutate x$1_@0.y[1:5] = read y$2_@1
40 + [5] Reassign mutate x$1_@0.y[1:6] = read y$2_@1
41 "]
42 bb0_instrs --> bb0_terminal(["Return freeze x$1_@0"])
43 end
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
+2 -2
@@ -19,7 +19,7 @@ function f(a, b) {
19
20 ```
21 bb0:
22 - [1] Let mutate x$3_@0[1:4] = Array []
22 + [1] Let mutate x$3_@0[1:5] = Array []
23 [2] Const mutate $4_@1 = 1
24 [3] Const mutate $5_@2 = Binary read a$1.length === read $4_@1
25 If (read $5_@2) then:bb2 else:bb1
@@ -44,7 +44,7 @@ flowchart TB
44 %% Basic Blocks
45 subgraph bb0
46 bb0_instrs["
47 - [1] Let mutate x$3_@0[1:4] = Array []
47 + [1] Let mutate x$3_@0[1:5] = Array []
48 [2] Const mutate $4_@1 = 1
49 [3] Const mutate $5_@2 = Binary read a$1.length === read $4_@1
50 "]
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+6 -6
@@ -23,13 +23,13 @@ function Component(props) {
23
24 ```
25 bb0:
26 - [1] Let mutate x$2_@0[1:4] = Array []
26 + [1] Let mutate x$2_@0[1:5] = Array []
27 [2] Call mutate x$2_@0.push(read props$1.p0)
28 - [3] Let mutate y$3_@0[1:4] = read x$2_@0
28 + [3] Let mutate y$3_@0[1:5] = read x$2_@0
29 If (read props$1.p1) then:bb2 else:bb1
30 bb2:
31 predecessor blocks: bb0
32 - [4] Reassign mutate x$2_@0[1:4] = Array []
32 + [4] Reassign mutate x$2_@0[1:5] = Array []
33 Goto bb1
34 bb1:
35 predecessor blocks: bb2 bb0
@@ -46,15 +46,15 @@ flowchart TB
46 %% Basic Blocks
47 subgraph bb0
48 bb0_instrs["
49 - [1] Let mutate x$2_@0[1:4] = Array []
49 + [1] Let mutate x$2_@0[1:5] = Array []
50 [2] Call mutate x$2_@0.push(read props$1.p0)
51 - [3] Let mutate y$3_@0[1:4] = read x$2_@0
51 + [3] Let mutate y$3_@0[1:5] = read x$2_@0
52 "]
53 bb0_instrs --> bb0_terminal(["If (read props$1.p1)"])
54 end
55 subgraph bb2
56 bb2_instrs["
57 - [4] Reassign mutate x$2_@0[1:4] = Array []
57 + [4] Reassign mutate x$2_@0[1:5] = Array []
58 "]
59 bb2_instrs --> bb2_terminal(["Goto"])
60 end
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+4 -4
@@ -21,9 +21,9 @@ function Component(props) {
21
22 ```
23 bb0:
24 - [1] Let mutate x$2_@0[1:6] = Array []
24 + [1] Let mutate x$2_@0[1:7] = Array []
25 [2] Call mutate x$2_@0.push(read props$1.p0)
26 - [3] Let mutate y$3_@0[1:6] = read x$2_@0
26 + [3] Let mutate y$3_@0[1:7] = read x$2_@0
27 [4] Reassign mutate x$2_@1 = Array []
28 [5] Let mutate _$4_@2 = JSX <read Component$0 x={freeze x$2_@1} ></read Component$0>
29 [6] Call mutate y$3_@0.push(read props$1.p1)
@@ -38,9 +38,9 @@ flowchart TB
38 %% Basic Blocks
39 subgraph bb0
40 bb0_instrs["
41 - [1] Let mutate x$2_@0[1:6] = Array []
41 + [1] Let mutate x$2_@0[1:7] = Array []
42 [2] Call mutate x$2_@0.push(read props$1.p0)
43 - [3] Let mutate y$3_@0[1:6] = read x$2_@0
43 + [3] Let mutate y$3_@0[1:7] = read x$2_@0
44 [4] Reassign mutate x$2_@1 = Array []
45 [5] Let mutate _$4_@2 = JSX <read Component$0 x={freeze x$2_@1} ></read Component$0>
46 [6] Call mutate y$3_@0.push(read props$1.p1)
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+10 -10
@@ -50,26 +50,26 @@ bb2:
50 Default: bb4
51 bb8:
52 predecessor blocks: bb2
53 - [5] Reassign mutate x$2_@4[5:9] = read props$1.v0
53 + [5] Reassign mutate x$2_@4[5:10] = read props$1.v0
54 Goto bb1
55 bb6:
56 predecessor blocks: bb2
57 - [6] Reassign mutate x$2_@4[5:9] = read props$1.v1
57 + [6] Reassign mutate x$2_@4[5:10] = read props$1.v1
58 Goto bb1
59 bb4:
60 predecessor blocks: bb2
61 - [7] Reassign mutate x$2_@4[5:9] = read props$1.v2
61 + [7] Reassign mutate x$2_@4[5:10] = read props$1.v2
62 Goto bb1
63 bb10:
64 predecessor blocks: bb0
65 If (read props$1.cond2) then:bb12 else:bb13
66 bb12:
67 predecessor blocks: bb10
68 - [8] Reassign mutate x$2_@4[5:9] = read props$1.b
68 + [8] Reassign mutate x$2_@4[5:10] = read props$1.b
69 Goto bb1
70 bb13:
71 predecessor blocks: bb10
72 - [9] Reassign mutate x$2_@4[5:9] = read props$1.c
72 + [9] Reassign mutate x$2_@4[5:10] = read props$1.c
73 Goto bb1
74 bb1:
75 predecessor blocks: bb8 bb6 bb4 bb12 bb13
@@ -98,19 +98,19 @@ flowchart TB
98 end
99 subgraph bb8
100 bb8_instrs["
101 - [5] Reassign mutate x$2_@4[5:9] = read props$1.v0
101 + [5] Reassign mutate x$2_@4[5:10] = read props$1.v0
102 "]
103 bb8_instrs --> bb8_terminal(["Goto"])
104 end
105 subgraph bb6
106 bb6_instrs["
107 - [6] Reassign mutate x$2_@4[5:9] = read props$1.v1
107 + [6] Reassign mutate x$2_@4[5:10] = read props$1.v1
108 "]
109 bb6_instrs --> bb6_terminal(["Goto"])
110 end
111 subgraph bb4
112 bb4_instrs["
113 - [7] Reassign mutate x$2_@4[5:9] = read props$1.v2
113 + [7] Reassign mutate x$2_@4[5:10] = read props$1.v2
114 "]
115 bb4_instrs --> bb4_terminal(["Goto"])
116 end
@@ -119,13 +119,13 @@ flowchart TB
119 end
120 subgraph bb12
121 bb12_instrs["
122 - [8] Reassign mutate x$2_@4[5:9] = read props$1.b
122 + [8] Reassign mutate x$2_@4[5:10] = read props$1.b
123 "]
124 bb12_instrs --> bb12_terminal(["Goto"])
125 end
126 subgraph bb13
127 bb13_instrs["
128 - [9] Reassign mutate x$2_@4[5:9] = read props$1.c
128 + [9] Reassign mutate x$2_@4[5:10] = read props$1.c
129 "]
130 bb13_instrs --> bb13_terminal(["Goto"])
131 end
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
+10 -10
@@ -49,11 +49,11 @@ function mutate$0() {
49 ```
50 bb0:
51 [1] Let mutate a$1_@0 = Object { }
52 - [2] Let mutate b$2_@1[0:7] = Object { }
53 - [3] Let mutate c$3_@1[0:7] = Object { }
54 - [4] Reassign mutate a$1_@1[0:7] = read b$2_@1
55 - [5] Reassign mutate b$2_@1[0:7] = read c$3_@1
56 - [6] Reassign mutate c$3_@1[0:7] = read a$1_@1
52 + [2] Let mutate b$2_@1[0:8] = Object { }
53 + [3] Let mutate c$3_@1[0:8] = Object { }
54 + [4] Reassign mutate a$1_@1[0:8] = read b$2_@1
55 + [5] Reassign mutate b$2_@1[0:8] = read c$3_@1
56 + [6] Reassign mutate c$3_@1[0:8] = read a$1_@1
57 [7] Call mutate mutate$4_@1(mutate a$1_@1, mutate b$2_@1)
58 Return freeze c$3_@1
59 ```
@@ -66,11 +66,11 @@ flowchart TB
66 subgraph bb0
67 bb0_instrs["
68 [1] Let mutate a$1_@0 = Object { }
69 - [2] Let mutate b$2_@1[0:7] = Object { }
70 - [3] Let mutate c$3_@1[0:7] = Object { }
71 - [4] Reassign mutate a$1_@1[0:7] = read b$2_@1
72 - [5] Reassign mutate b$2_@1[0:7] = read c$3_@1
73 - [6] Reassign mutate c$3_@1[0:7] = read a$1_@1
69 + [2] Let mutate b$2_@1[0:8] = Object { }
70 + [3] Let mutate c$3_@1[0:8] = Object { }
71 + [4] Reassign mutate a$1_@1[0:8] = read b$2_@1
72 + [5] Reassign mutate b$2_@1[0:8] = read c$3_@1
73 + [6] Reassign mutate c$3_@1[0:8] = read a$1_@1
74 [7] Call mutate mutate$4_@1(mutate a$1_@1, mutate b$2_@1)
75 "]
76 bb0_instrs --> bb0_terminal(["Return freeze c$3_@1"])
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
+6 -6
@@ -50,10 +50,10 @@ function foo$0() {
50
51 ```
52 bb0:
53 - [1] Const mutate a$2_@0[0:7] = Array []
54 - [2] Const mutate b$3_@0[0:7] = Object { }
53 + [1] Const mutate a$2_@0[0:8] = Array []
54 + [2] Const mutate b$3_@0[0:8] = Object { }
55 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
56 - [4] Const mutate $7_@0[0:7] = Call mutate foo$4_@0()
56 + [4] Const mutate $7_@0[0:8] = Call mutate foo$4_@0()
57 If (read $7_@0) then:bb2 else:bb1
58 bb2:
59 predecessor blocks: bb0
@@ -75,10 +75,10 @@ flowchart TB
75 %% Basic Blocks
76 subgraph bb0
77 bb0_instrs["
78 - [1] Const mutate a$2_@0[0:7] = Array []
79 - [2] Const mutate b$3_@0[0:7] = Object { }
78 + [1] Const mutate a$2_@0[0:8] = Array []
79 + [2] Const mutate b$3_@0[0:8] = Object { }
80 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
81 - [4] Const mutate $7_@0[0:7] = Call mutate foo$4_@0()
81 + [4] Const mutate $7_@0[0:8] = Call mutate foo$4_@0()
82 "]
83 bb0_instrs --> bb0_terminal(["If (read $7_@0)"])
84 end
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
+4 -4
@@ -47,8 +47,8 @@ function foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$2_@0[0:6] = Array []
51 - [2] Const mutate b$3_@0[0:6] = Object { }
50 + [1] Const mutate a$2_@0[0:7] = Array []
51 + [2] Const mutate b$3_@0[0:7] = Object { }
52 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
53 [4] Const mutate $6_@1 = "div"
54 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
@@ -65,8 +65,8 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$2_@0[0:6] = Array []
69 - [2] Const mutate b$3_@0[0:6] = Object { }
68 + [1] Const mutate a$2_@0[0:7] = Array []
69 + [2] Const mutate b$3_@0[0:7] = Object { }
70 [3] Call mutate foo$4_@0(mutate a$2_@0, mutate b$3_@0)
71 [4] Const mutate $6_@1 = 'div'
72 [5] Let mutate _$5_@2 = JSX <read $6_@1 a={freeze a$2_@0} ></read $6_@1>
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
+8 -8
@@ -21,14 +21,14 @@ function foo() {
21
22 ```
23 bb0:
24 - [1] Let mutate x$1_@0[1:9] = 1
24 + [1] Let mutate x$1_@0[1:10] = 1
25 [2] Let mutate y$2_@1 = 2
26 [3] Const mutate $3_@2 = 2
27 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
28 If (read $4_@3) then:bb2 else:bb1
29 bb2:
30 predecessor blocks: bb0
31 - [5] Reassign mutate x$1_@0[1:9] = 3
31 + [5] Reassign mutate x$1_@0[1:10] = 3
32 Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb0
@@ -37,11 +37,11 @@ bb1:
37 If (read $6_@5) then:bb4 else:bb3
38 bb4:
39 predecessor blocks: bb1
40 - [8] Reassign mutate x$1_@0[1:9] = 5
40 + [8] Reassign mutate x$1_@0[1:10] = 5
41 Goto bb3
42 bb3:
43 predecessor blocks: bb4 bb1
44 - [9] Reassign mutate y$2_@0[1:9] = read x$1_@0
44 + [9] Reassign mutate y$2_@0[1:10] = read x$1_@0
45 Return
46 ```
47
@@ -52,7 +52,7 @@ flowchart TB
52 %% Basic Blocks
53 subgraph bb0
54 bb0_instrs["
55 - [1] Let mutate x$1_@0[1:9] = 1
55 + [1] Let mutate x$1_@0[1:10] = 1
56 [2] Let mutate y$2_@1 = 2
57 [3] Const mutate $3_@2 = 2
58 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
@@ -61,7 +61,7 @@ flowchart TB
61 end
62 subgraph bb2
63 bb2_instrs["
64 - [5] Reassign mutate x$1_@0[1:9] = 3
64 + [5] Reassign mutate x$1_@0[1:10] = 3
65 "]
66 bb2_instrs --> bb2_terminal(["Goto"])
67 end
@@ -74,13 +74,13 @@ flowchart TB
74 end
75 subgraph bb4
76 bb4_instrs["
77 - [8] Reassign mutate x$1_@0[1:9] = 5
77 + [8] Reassign mutate x$1_@0[1:10] = 5
78 "]
79 bb4_instrs --> bb4_terminal(["Goto"])
80 end
81 subgraph bb3
82 bb3_instrs["
83 - [9] Reassign mutate y$2_@0[1:9] = read x$1_@0
83 + [9] Reassign mutate y$2_@0[1:10] = read x$1_@0
84 "]
85 bb3_instrs --> bb3_terminal(["Return"])
86 end
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
+6 -6
@@ -18,18 +18,18 @@ function foo() {
18
19 ```
20 bb0:
21 - [1] Let mutate x$1_@0[1:6] = 1
21 + [1] Let mutate x$1_@0[1:7] = 1
22 [2] Let mutate y$2_@1 = 2
23 [3] Const mutate $3_@2 = 2
24 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
25 If (read $4_@3) then:bb2 else:bb1
26 bb2:
27 predecessor blocks: bb0
28 - [5] Reassign mutate x$1_@0[1:6] = 3
28 + [5] Reassign mutate x$1_@0[1:7] = 3
29 Goto bb1
30 bb1:
31 predecessor blocks: bb2 bb0
32 - [6] Reassign mutate y$2_@0[1:6] = read x$1_@0
32 + [6] Reassign mutate y$2_@0[1:7] = read x$1_@0
33 Return
34 ```
35
@@ -40,7 +40,7 @@ flowchart TB
40 %% Basic Blocks
41 subgraph bb0
42 bb0_instrs["
43 - [1] Let mutate x$1_@0[1:6] = 1
43 + [1] Let mutate x$1_@0[1:7] = 1
44 [2] Let mutate y$2_@1 = 2
45 [3] Const mutate $3_@2 = 2
46 [4] Const mutate $4_@3 = Binary read y$2_@1 === read $3_@2
@@ -49,13 +49,13 @@ flowchart TB
49 end
50 subgraph bb2
51 bb2_instrs["
52 - [5] Reassign mutate x$1_@0[1:6] = 3
52 + [5] Reassign mutate x$1_@0[1:7] = 3
53 "]
54 bb2_instrs --> bb2_terminal(["Goto"])
55 end
56 subgraph bb1
57 bb1_instrs["
58 - [6] Reassign mutate y$2_@0[1:6] = read x$1_@0
58 + [6] Reassign mutate y$2_@0[1:7] = read x$1_@0
59 "]
60 bb1_instrs --> bb1_terminal(["Return"])
61 end
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
+4 -4
@@ -16,7 +16,7 @@ function foo() {
16
17 ```
18 bb0:
19 - [1] Let mutate x$1_@0[0:5] = 0
19 + [1] Let mutate x$1_@0[0:6] = 0
20 Goto bb1
21 bb1:
22 predecessor blocks: bb0 bb4
@@ -26,7 +26,7 @@ bb1:
26 bb4:
27 predecessor blocks: bb1
28 [4] Const mutate $2_@3 = 1
29 - [5] Reassign mutate x$1_@0[0:5] = Binary read x$1_@0 + read $2_@3
29 + [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
30 Goto(Continue) bb1
31 bb2:
32 predecessor blocks: bb1
@@ -40,7 +40,7 @@ flowchart TB
40 %% Basic Blocks
41 subgraph bb0
42 bb0_instrs["
43 - [1] Let mutate x$1_@0[0:5] = 0
43 + [1] Let mutate x$1_@0[0:6] = 0
44 "]
45 bb0_instrs --> bb0_terminal(["Goto"])
46 end
@@ -54,7 +54,7 @@ flowchart TB
54 subgraph bb4
55 bb4_instrs["
56 [4] Const mutate $2_@3 = 1
57 - [5] Reassign mutate x$1_@0[0:5] = Binary read x$1_@0 + read $2_@3
57 + [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
58 "]
59 bb4_instrs --> bb4_terminal(["Goto"])
60 end
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
+6 -6
@@ -19,16 +19,16 @@ function foo() {
19
20 ```
21 bb0:
22 - [1] Let mutate x$1_@0 = 1
22 + [1] Let mutate x$1_@0[1:5] = 1
23 [2] Let mutate y$2_@1 = 2
24 If (read y$2_@1) then:bb2 else:bb3
25 bb2:
26 predecessor blocks: bb0
27 - [3] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
27 + [3] Let mutate z$3_@0[1:5] = Binary read x$1_@0 + read y$2_@1
28 Goto bb1
29 bb3:
30 predecessor blocks: bb0
31 - [4] Let mutate z$4_@3 = read x$1_@0
31 + [4] Let mutate z$4_@0[1:5] = read x$1_@0
32 Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb3
@@ -42,20 +42,20 @@ flowchart TB
42 %% Basic Blocks
43 subgraph bb0
44 bb0_instrs["
45 - [1] Let mutate x$1_@0 = 1
45 + [1] Let mutate x$1_@0[1:5] = 1
46 [2] Let mutate y$2_@1 = 2
47 "]
48 bb0_instrs --> bb0_terminal(["If (read y$2_@1)"])
49 end
50 subgraph bb2
51 bb2_instrs["
52 - [3] Let mutate z$3_@2 = Binary read x$1_@0 + read y$2_@1
52 + [3] Let mutate z$3_@0[1:5] = Binary read x$1_@0 + read y$2_@1
53 "]
54 bb2_instrs --> bb2_terminal(["Goto"])
55 end
56 subgraph bb3
57 bb3_instrs["
58 - [4] Let mutate z$4_@3 = read x$1_@0
58 + [4] Let mutate z$4_@0[1:5] = read x$1_@0
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
+6 -6
@@ -45,9 +45,9 @@ function Foo$0() {
45
46 ```
47 bb0:
48 - [1] Const mutate a$2_@0[0:3] = Array []
49 - [2] Const mutate b$3_@0[0:3] = Object { }
50 - [3] Let mutate c$4_@0[0:3] = New mutate Foo$5_@0(mutate a$2_@0, mutate b$3_@0)
48 + [1] Const mutate a$2_@0[0:4] = Array []
49 + [2] Const mutate b$3_@0[0:4] = Object { }
50 + [3] Let mutate c$4_@0[0:4] = New mutate Foo$5_@0(mutate a$2_@0, mutate b$3_@0)
51 Return freeze c$4_@0
52 ```
53
@@ -58,9 +58,9 @@ flowchart TB
58 %% Basic Blocks
59 subgraph bb0
60 bb0_instrs["
61 - [1] Const mutate a$2_@0[0:3] = Array []
62 - [2] Const mutate b$3_@0[0:3] = Object { }
63 - [3] Let mutate c$4_@0[0:3] = New mutate Foo$5_@0(mutate a$2_@0, mutate b$3_@0)
61 + [1] Const mutate a$2_@0[0:4] = Array []
62 + [2] Const mutate b$3_@0[0:4] = Object { }
63 + [3] Let mutate c$4_@0[0:4] = New mutate Foo$5_@0(mutate a$2_@0, mutate b$3_@0)
64 "]
65 bb0_instrs --> bb0_terminal(["Return freeze c$4_@0"])
66 end
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
+8 -8
@@ -22,18 +22,18 @@ function foo() {
22
23 ```
24 bb0:
25 - [1] Let mutate x$1_@0[1:5] = 1
26 - [2] Let mutate y$2_@1[2:6] = 2
25 + [1] Let mutate x$1_@0[1:6] = 1
26 + [2] Let mutate y$2_@1[2:7] = 2
27 [3] Const mutate $3_@2 = 1
28 [4] Const mutate $4_@3 = Binary read x$1_@0 > read $3_@2
29 If (read $4_@3) then:bb2 else:bb3
30 bb2:
31 predecessor blocks: bb0
32 - [5] Reassign mutate x$1_@0[1:5] = 2
32 + [5] Reassign mutate x$1_@0[1:6] = 2
33 Goto bb1
34 bb3:
35 predecessor blocks: bb0
36 - [6] Reassign mutate y$2_@1[2:6] = 3
36 + [6] Reassign mutate y$2_@1[2:7] = 3
37 Goto bb1
38 bb1:
39 predecessor blocks: bb2 bb3
@@ -48,8 +48,8 @@ flowchart TB
48 %% Basic Blocks
49 subgraph bb0
50 bb0_instrs["
51 - [1] Let mutate x$1_@0[1:5] = 1
52 - [2] Let mutate y$2_@1[2:6] = 2
51 + [1] Let mutate x$1_@0[1:6] = 1
52 + [2] Let mutate y$2_@1[2:7] = 2
53 [3] Const mutate $3_@2 = 1
54 [4] Const mutate $4_@3 = Binary read x$1_@0 > read $3_@2
55 "]
@@ -57,13 +57,13 @@ flowchart TB
57 end
58 subgraph bb2
59 bb2_instrs["
60 - [5] Reassign mutate x$1_@0[1:5] = 2
60 + [5] Reassign mutate x$1_@0[1:6] = 2
61 "]
62 bb2_instrs --> bb2_terminal(["Goto"])
63 end
64 subgraph bb3
65 bb3_instrs["
66 - [6] Reassign mutate y$2_@1[2:6] = 3
66 + [6] Reassign mutate y$2_@1[2:7] = 3
67 "]
68 bb3_instrs --> bb3_terminal(["Goto"])
69 end
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
+4 -4
@@ -16,8 +16,8 @@ function foo() {
16 ```
17 bb0:
18 [1] Const mutate x$1_@0 = Array []
19 - [2] Const mutate y$2_@1[2:4] = Object { x: read x$1_@0 }
20 - [3] Const mutate $3_@1[2:4] = Array []
19 + [2] Const mutate y$2_@1[2:5] = Object { x: read x$1_@0 }
20 + [3] Const mutate $3_@1[2:5] = Array []
21 [4] Call mutate y$2_@1.x.push(mutate $3_@1)
22 Return freeze y$2_@1
23 ```
@@ -30,8 +30,8 @@ flowchart TB
30 subgraph bb0
31 bb0_instrs["
32 [1] Const mutate x$1_@0 = Array []
33 - [2] Const mutate y$2_@1[2:4] = Object { x: read x$1_@0 }
34 - [3] Const mutate $3_@1[2:4] = Array []
33 + [2] Const mutate y$2_@1[2:5] = Object { x: read x$1_@0 }
34 + [3] Const mutate $3_@1[2:5] = Array []
35 [4] Call mutate y$2_@1.x.push(mutate $3_@1)
36 "]
37 bb0_instrs --> bb0_terminal(["Return freeze y$2_@1"])
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
+4 -4
@@ -16,8 +16,8 @@ function foo() {
16 ```
17 bb0:
18 [1] Const mutate x$1_@0 = Array []
19 - [2] Const mutate y$2_@1[2:3] = Object { }
20 - [3] Reassign mutate y$2_@1.x[2:3] = read x$1_@0
19 + [2] Const mutate y$2_@1[2:4] = Object { }
20 + [3] Reassign mutate y$2_@1.x[2:4] = read x$1_@0
21 Return freeze y$2_@1
22 ```
23
@@ -29,8 +29,8 @@ flowchart TB
29 subgraph bb0
30 bb0_instrs["
31 [1] Const mutate x$1_@0 = Array []
32 - [2] Const mutate y$2_@1[2:3] = Object { }
33 - [3] Reassign mutate y$2_@1.x[2:3] = read x$1_@0
32 + [2] Const mutate y$2_@1[2:4] = Object { }
33 + [3] Reassign mutate y$2_@1.x[2:4] = read x$1_@0
34 "]
35 bb0_instrs --> bb0_terminal(["Return freeze y$2_@1"])
36 end
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
+4 -4
@@ -17,13 +17,13 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$1_@0[1:4] = 1
20 + [1] Let mutate x$1_@0[1:5] = 1
21 [2] Const mutate $2_@1 = 1
22 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
23 If (read $3_@2) then:bb2 else:bb1
24 bb2:
25 predecessor blocks: bb0
26 - [4] Reassign mutate x$1_@0[1:4] = 2
26 + [4] Reassign mutate x$1_@0[1:5] = 2
27 Goto bb1
28 bb1:
29 predecessor blocks: bb2 bb0
@@ -37,7 +37,7 @@ flowchart TB
37 %% Basic Blocks
38 subgraph bb0
39 bb0_instrs["
40 - [1] Let mutate x$1_@0[1:4] = 1
40 + [1] Let mutate x$1_@0[1:5] = 1
41 [2] Const mutate $2_@1 = 1
42 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
43 "]
@@ -45,7 +45,7 @@ flowchart TB
45 end
46 subgraph bb2
47 bb2_instrs["
48 - [4] Reassign mutate x$1_@0[1:4] = 2
48 + [4] Reassign mutate x$1_@0[1:5] = 2
49 "]
50 bb2_instrs --> bb2_terminal(["Goto"])
51 end
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
+4 -4
@@ -49,7 +49,7 @@ function log$0() {
49
50 ```
51 bb0:
52 - [1] Let mutate str$2_@0[1:4] = ""
52 + [1] Let mutate str$2_@0[1:5] = ""
53 If (read cond$1) then:bb2 else:bb3
54 bb2:
55 predecessor blocks: bb0
@@ -58,7 +58,7 @@ bb2:
58 Goto bb1
59 bb3:
60 predecessor blocks: bb0
61 - [4] Reassign mutate str$2_@0[1:4] = "fallthrough test"
61 + [4] Reassign mutate str$2_@0[1:5] = "fallthrough test"
62 Goto bb1
63 bb1:
64 predecessor blocks: bb2 bb3
@@ -73,7 +73,7 @@ flowchart TB
73 %% Basic Blocks
74 subgraph bb0
75 bb0_instrs["
76 - [1] Let mutate str$2_@0[1:4] = ''
76 + [1] Let mutate str$2_@0[1:5] = ''
77 "]
78 bb0_instrs --> bb0_terminal(["If (read cond$1)"])
79 end
@@ -86,7 +86,7 @@ flowchart TB
86 end
87 subgraph bb3
88 bb3_instrs["
89 - [4] Reassign mutate str$2_@0[1:4] = 'fallthrough test'
89 + [4] Reassign mutate str$2_@0[1:5] = 'fallthrough test'
90 "]
91 bb3_instrs --> bb3_terminal(["Goto"])
92 end
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
+6 -6
@@ -26,15 +26,15 @@ bb0:
26 If (read $3_@2) then:bb2 else:bb3
27 bb2:
28 predecessor blocks: bb0
29 - [4] Reassign mutate y$1_@3[4:6] = 1
29 + [4] Reassign mutate y$1_@3[4:7] = 1
30 Goto bb1
31 bb3:
32 predecessor blocks: bb0
33 - [5] Reassign mutate y$1_@3[4:6] = 2
33 + [5] Reassign mutate y$1_@3[4:7] = 2
34 Goto bb1
35 bb1:
36 predecessor blocks: bb2 bb3
37 - [6] Let mutate x$4_@3[4:6] = read y$1_@3
37 + [6] Let mutate x$4_@3[4:7] = read y$1_@3
38 Return
39 ```
40
@@ -53,19 +53,19 @@ flowchart TB
53 end
54 subgraph bb2
55 bb2_instrs["
56 - [4] Reassign mutate y$1_@3[4:6] = 1
56 + [4] Reassign mutate y$1_@3[4:7] = 1
57 "]
58 bb2_instrs --> bb2_terminal(["Goto"])
59 end
60 subgraph bb3
61 bb3_instrs["
62 - [5] Reassign mutate y$1_@3[4:6] = 2
62 + [5] Reassign mutate y$1_@3[4:7] = 2
63 "]
64 bb3_instrs --> bb3_terminal(["Goto"])
65 end
66 subgraph bb1
67 bb1_instrs["
68 - [6] Let mutate x$4_@3[4:6] = read y$1_@3
68 + [6] Let mutate x$4_@3[4:7] = read y$1_@3
69 "]
70 bb1_instrs --> bb1_terminal(["Return"])
71 end
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
+8 -8
@@ -40,21 +40,21 @@ bb0:
40 bb5:
41 predecessor blocks: bb0
42 [6] Const mutate $6_@5 = 1
43 - [7] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $6_@5
43 + [7] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $6_@5
44 Goto bb1
45 bb3:
46 predecessor blocks: bb0
47 [8] Const mutate $3_@7 = 2
48 - [9] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $3_@7
48 + [9] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $3_@7
49 Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 [10] Const mutate $2_@8 = 3
53 - [11] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $2_@8
53 + [11] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $2_@8
54 Goto bb1
55 bb1:
56 predecessor blocks: bb5 bb3 bb2
57 - [12] Let mutate y$9_@6[7:12] = read x$1_@6
57 + [12] Let mutate y$9_@6[7:13] = read x$1_@6
58 Return
59 ```
60
@@ -76,27 +76,27 @@ flowchart TB
76 subgraph bb5
77 bb5_instrs["
78 [6] Const mutate $6_@5 = 1
79 - [7] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $6_@5
79 + [7] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $6_@5
80 "]
81 bb5_instrs --> bb5_terminal(["Goto"])
82 end
83 subgraph bb3
84 bb3_instrs["
85 [8] Const mutate $3_@7 = 2
86 - [9] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $3_@7
86 + [9] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $3_@7
87 "]
88 bb3_instrs --> bb3_terminal(["Goto"])
89 end
90 subgraph bb2
91 bb2_instrs["
92 [10] Const mutate $2_@8 = 3
93 - [11] Reassign mutate x$1_@6[7:12] = Binary read x$1_@0 + read $2_@8
93 + [11] Reassign mutate x$1_@6[7:13] = Binary read x$1_@0 + read $2_@8
94 "]
95 bb2_instrs --> bb2_terminal(["Goto"])
96 end
97 subgraph bb1
98 bb1_instrs["
99 - [12] Let mutate y$9_@6[7:12] = read x$1_@6
99 + [12] Let mutate y$9_@6[7:13] = read x$1_@6
100 "]
101 bb1_instrs --> bb1_terminal(["Return"])
102 end
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
+4 -4
@@ -16,13 +16,13 @@ function foo() {
16
17 ```
18 bb0:
19 - [1] Let mutate x$1_@0[1:4] = 1
19 + [1] Let mutate x$1_@0[1:5] = 1
20 [2] Const mutate $2_@1 = 1
21 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
22 If (read $3_@2) then:bb2 else:bb1
23 bb2:
24 predecessor blocks: bb0
25 - [4] Reassign mutate x$1_@0[1:4] = 2
25 + [4] Reassign mutate x$1_@0[1:5] = 2
26 Goto bb1
27 bb1:
28 predecessor blocks: bb2 bb0
@@ -36,7 +36,7 @@ flowchart TB
36 %% Basic Blocks
37 subgraph bb0
38 bb0_instrs["
39 - [1] Let mutate x$1_@0[1:4] = 1
39 + [1] Let mutate x$1_@0[1:5] = 1
40 [2] Const mutate $2_@1 = 1
41 [3] Const mutate $3_@2 = Binary read x$1_@0 === read $2_@1
42 "]
@@ -44,7 +44,7 @@ flowchart TB
44 end
45 subgraph bb2
46 bb2_instrs["
47 - [4] Reassign mutate x$1_@0[1:4] = 2
47 + [4] Reassign mutate x$1_@0[1:5] = 2
48 "]
49 bb2_instrs --> bb2_terminal(["Goto"])
50 end
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
+4 -4
@@ -17,7 +17,7 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$1_@0[0:5] = 1
20 + [1] Let mutate x$1_@0[0:6] = 1
21 While test=bb1 loop=bb3 fallthrough=bb2
22 bb1:
23 predecessor blocks: bb0 bb3
@@ -27,7 +27,7 @@ bb1:
27 bb3:
28 predecessor blocks: bb1
29 [4] Const mutate $2_@3 = 1
30 - [5] Reassign mutate x$1_@0[0:5] = Binary read x$1_@0 + read $2_@3
30 + [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
31 Goto(Continue) bb1
32 bb2:
33 predecessor blocks: bb1
@@ -41,7 +41,7 @@ flowchart TB
41 %% Basic Blocks
42 subgraph bb0
43 bb0_instrs["
44 - [1] Let mutate x$1_@0[0:5] = 1
44 + [1] Let mutate x$1_@0[0:6] = 1
45 "]
46 bb0_instrs --> bb0_terminal(["While"])
47 end
@@ -55,7 +55,7 @@ flowchart TB
55 subgraph bb3
56 bb3_instrs["
57 [4] Const mutate $2_@3 = 1
58 - [5] Reassign mutate x$1_@0[0:5] = Binary read x$1_@0 + read $2_@3
58 + [5] Reassign mutate x$1_@0[0:6] = Binary read x$1_@0 + read $2_@3
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+8 -8
@@ -32,8 +32,8 @@ function Component(props) {
32
33 ```
34 bb0:
35 - [1] Let mutate x$2_@0[1:8] = Array []
36 - [2] Let mutate y$3_@0[1:8] = undefined
35 + [1] Let mutate x$2_@0[1:9] = Array []
36 + [2] Let mutate y$3_@0[1:9] = undefined
37 [3] Const mutate $4_@1 = false
38 [4] Const mutate $5_@2 = true
39 [5] Const mutate $6_@3 = 1
@@ -45,11 +45,11 @@ bb0:
45 bb6:
46 predecessor blocks: bb0
47 [6] Call mutate x$2_@0.push(read props$1.p2)
48 - [7] Reassign mutate y$3_@0[1:8] = Array []
48 + [7] Reassign mutate y$3_@0[1:9] = Array []
49 Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 - [8] Reassign mutate y$3_@0[1:8] = read x$2_@0
52 + [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
53 Goto bb1
54 bb1:
55 predecessor blocks: bb0 bb6 bb2
@@ -66,8 +66,8 @@ flowchart TB
66 %% Basic Blocks
67 subgraph bb0
68 bb0_instrs["
69 - [1] Let mutate x$2_@0[1:8] = Array []
70 - [2] Let mutate y$3_@0[1:8] = undefined
69 + [1] Let mutate x$2_@0[1:9] = Array []
70 + [2] Let mutate y$3_@0[1:9] = undefined
71 [3] Const mutate $4_@1 = false
72 [4] Const mutate $5_@2 = true
73 [5] Const mutate $6_@3 = 1
@@ -77,13 +77,13 @@ flowchart TB
77 subgraph bb6
78 bb6_instrs["
79 [6] Call mutate x$2_@0.push(read props$1.p2)
80 - [7] Reassign mutate y$3_@0[1:8] = Array []
80 + [7] Reassign mutate y$3_@0[1:9] = Array []
81 "]
82 bb6_instrs --> bb6_terminal(["Goto"])
83 end
84 subgraph bb2
85 bb2_instrs["
86 - [8] Reassign mutate y$3_@0[1:8] = read x$2_@0
86 + [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
87 "]
88 bb2_instrs --> bb2_terminal(["Goto"])
89 end
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+6 -6
@@ -28,8 +28,8 @@ function Component(props) {
28
29 ```
30 bb0:
31 - [1] Let mutate x$2_@0[1:8] = Array []
32 - [2] Let mutate y$3_@0[1:8] = undefined
31 + [1] Let mutate x$2_@0[1:9] = Array []
32 + [2] Let mutate y$3_@0[1:9] = undefined
33 [3] Const mutate $4_@1 = false
34 [4] Const mutate $5_@2 = true
35 Switch (read props$1.p0)
@@ -44,7 +44,7 @@ bb4:
44 Goto bb2
45 bb2:
46 predecessor blocks: bb4 bb0
47 - [8] Reassign mutate y$3_@0[1:8] = read x$2_@0
47 + [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
48 Goto bb1
49 bb1:
50 predecessor blocks: bb2 bb0
@@ -61,8 +61,8 @@ flowchart TB
61 %% Basic Blocks
62 subgraph bb0
63 bb0_instrs["
64 - [1] Let mutate x$2_@0[1:8] = Array []
65 - [2] Let mutate y$3_@0[1:8] = undefined
64 + [1] Let mutate x$2_@0[1:9] = Array []
65 + [2] Let mutate y$3_@0[1:9] = undefined
66 [3] Const mutate $4_@1 = false
67 [4] Const mutate $5_@2 = true
68 "]
@@ -78,7 +78,7 @@ flowchart TB
78 end
79 subgraph bb2
80 bb2_instrs["
81 - [8] Reassign mutate y$3_@0[1:8] = read x$2_@0
81 + [8] Reassign mutate y$3_@0[1:9] = read x$2_@0
82 "]
83 bb2_instrs --> bb2_terminal(["Goto"])
84 end