diff --git a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md
index d880d599d0..e4d0dcf1e0 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md
@@ -34,28 +34,28 @@ function foo$0() {
```
bb0:
- Const mutate a$2 = Array []
- Const mutate b$3 = Object { }
- Call mutate foo$4(mutate a$2, mutate b$3)
- Const mutate $6 = "div"
- Let mutate _$5 = JSX
- Call mutate foo$4(mutate b$3)
- Const mutate $7 = "div"
- Const mutate $8 = JSX
- Return read $8
+ Const mutate a$10 = Array []
+ Const mutate b$11 = Object { }
+ Call mutate foo$4(mutate a$10, mutate b$11)
+ Const mutate $12 = "div"
+ Let mutate _$13 = JSX
+ Call mutate foo$4(mutate b$11)
+ Const mutate $14 = "div"
+ Const mutate $15 = JSX
+ Return read $15
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- const b$3 = {};
- foo$4(a$2, b$3);
- let _$5 =
;
+function Component$0(props$9) {
+ const a$10 = [];
+ const b$11 = {};
+ foo$4(a$10, b$11);
+ let _$13 = ;
- foo$4(b$3);
- return ;
+ foo$4(b$11);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md
index 84c9732330..dacfe47037 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md
@@ -35,63 +35,75 @@ function Component(props) {
```
bb0:
- Const mutate items$2 = read props$1.items
- Const mutate maxItems$3 = read props$1.maxItems
- Const mutate renderedItems$4 = Array []
- Const mutate seen$5 = New mutate Set$6()
- Const mutate $9 = 0
- Const mutate max$7 = Call mutate Math$8.max(read $9, read maxItems$3)
+ Const mutate items$27 = read props$26.items
+ Const mutate maxItems$28 = read props$26.maxItems
+ Const mutate renderedItems$29 = Array []
+ Const mutate seen$30 = New mutate Set$6()
+ Const mutate $31 = 0
+ Const mutate max$32 = Call mutate Math$8.max(read $31, read maxItems$28)
Goto bb1
bb1:
predecessor blocks: bb0 bb4 bb7
- If (read items$2) then:bb3 else:bb2
+ items$33: phi(bb0: items$27, bb4: items$50, bb7: items$50)
+ item$35: phi(bb0: item$10, bb4: item$42, bb7: item$42)
+ seen$38: phi(bb0: seen$30, bb4: seen$41, bb7: seen$41)
+ renderedItems$46: phi(bb0: renderedItems$29, bb4: renderedItems$45, bb7: renderedItems$45)
+ max$48: phi(bb0: max$32, bb4: max$47, bb7: max$47)
+ If (read items$33) then:bb3 else:bb2
bb3:
predecessor blocks: bb1
- Const mutate $11 = null
- Const mutate $12 = Binary read item$10 == read $11
- If (read $12) then:bb8 else:bb9
+ Const mutate $34 = null
+ Const mutate $36 = Binary read item$35 == read $34
+ If (read $36) then:bb8 else:bb9
bb8:
predecessor blocks: bb3
- Const mutate $13 = read $12
+ Const mutate $37 = read $36
Goto bb7
bb9:
predecessor blocks: bb3
- Const mutate $13 = Call mutate seen$5.has(mutate item$10)
+ Const mutate $39 = Call mutate seen$38.has(mutate item$35)
Goto bb7
bb7:
predecessor blocks: bb9 bb8
- If (read $13) then:bb1 else:bb4
+ $40: phi(bb9: $39, bb8: $37)
+ seen$41: phi(bb9: seen$38, bb8: seen$38)
+ item$42: phi(bb9: item$35, bb8: item$35)
+ renderedItems$45: phi(bb9: renderedItems$46, bb8: renderedItems$46)
+ max$47: phi(bb9: max$48, bb8: max$48)
+ items$50: phi(bb9: items$33, bb8: items$33)
+ If (read $40) then:bb1 else:bb4
bb4:
predecessor blocks: bb7
- Call mutate seen$5.add(mutate item$10)
- Const mutate $14 = "div"
- Const mutate $15 = JSX {read item$10}
- Call mutate renderedItems$4.push(read $15)
- Const mutate $16 = Binary read renderedItems$4.length >= read max$7
- If (read $16) then:bb2 else:bb1
+ Call mutate seen$41.add(mutate item$42)
+ Const mutate $43 = "div"
+ Const mutate $44 = JSX {read item$42}
+ Call mutate renderedItems$45.push(read $44)
+ Const mutate $49 = Binary read renderedItems$45.length >= read max$47
+ If (read $49) then:bb2 else:bb1
bb2:
predecessor blocks: bb1 bb4
- Const mutate count$17 = read renderedItems$4.length
- Const mutate $18 = "div"
- Const mutate $19 = "\n "
- Const mutate $20 = "h1"
- Const mutate $21 = " Items"
- Const mutate $22 = JSX {freeze count$17}{read $21}
- Const mutate $23 = "\n "
- Const mutate $24 = "\n "
- Const mutate $25 = JSX {read $19}{read $22}{read $23}{freeze renderedItems$4}{read $24}
- Return read $25
+ renderedItems$51: phi(bb1: renderedItems$46, bb4: renderedItems$45)
+ Const mutate count$52 = read renderedItems$51.length
+ Const mutate $53 = "div"
+ Const mutate $54 = "\n "
+ Const mutate $55 = "h1"
+ Const mutate $56 = " Items"
+ Const mutate $57 = JSX {freeze count$52}{read $56}
+ Const mutate $58 = "\n "
+ Const mutate $59 = "\n "
+ Const mutate $60 = JSX {read $54}{read $57}{read $58}{freeze renderedItems$51}{read $59}
+ Return read $60
```
## Code
```javascript
-function Component$0(props$1) {
- const items$2 = props$1.items;
- const maxItems$3 = props$1.maxItems;
- const renderedItems$4 = [];
- const seen$5 = new Set$6();
- const max$7 = Math$8.max(0, maxItems$3);
+function Component$0(props$26) {
+ const items$27 = props$26.items;
+ const maxItems$28 = props$26.maxItems;
+ const renderedItems$29 = [];
+ const seen$30 = new Set$6();
+ const max$32 = Math$8.max(0, maxItems$28);
("<>");
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
index d79b048ebb..dad55cd5e6 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
@@ -78,31 +78,31 @@ function Component(props) {
```
bb0:
- Const mutate a_DEBUG$2 = Array []
- Call mutate a_DEBUG$2.push(read props$1.a)
- If (read props$1.b) then:bb2 else:bb1
+ Const mutate a_DEBUG$5 = Array []
+ Call mutate a_DEBUG$5.push(read props$4.a)
+ If (read props$4.b) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Const mutate $3 = null
- Return read $3
+ Const mutate $6 = null
+ Return read $6
bb1:
predecessor blocks: bb0
- Call mutate a_DEBUG$2.push(read props$1.d)
- Return freeze a_DEBUG$2
+ Call mutate a_DEBUG$5.push(read props$4.d)
+ Return freeze a_DEBUG$5
```
## Code
```javascript
-function Component$0(props$1) {
- const a_DEBUG$2 = [];
- a_DEBUG$2.push(props$1.a);
- if (props$1.b) {
+function Component$0(props$4) {
+ const a_DEBUG$5 = [];
+ a_DEBUG$5.push(props$4.a);
+ if (props$4.b) {
return null;
}
- a_DEBUG$2.push(props$1.d);
- return a_DEBUG$2;
+ a_DEBUG$5.push(props$4.d);
+ return a_DEBUG$5;
}
```
@@ -110,32 +110,34 @@ function Component$0(props$1) {
```
bb0:
- Const mutate a$2 = Array []
- Call mutate a$2.push(read props$1.a)
- If (read props$1.b) then:bb2 else:bb1
+ Const mutate a$4 = Array []
+ Call mutate a$4.push(read props$3.a)
+ If (read props$3.b) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.c)
+ Call mutate a$4.push(read props$3.c)
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- Call mutate a$2.push(read props$1.d)
- Return freeze a$2
+ a$5: phi(bb0: a$4, bb2: a$4)
+ props$6: phi(bb0: props$3, bb2: props$3)
+ Call mutate a$5.push(read props$6.d)
+ Return freeze a$5
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- a$2.push(props$1.a);
- if (props$1.b) {
- a$2.push(props$1.c);
+function Component$0(props$3) {
+ const a$4 = [];
+ a$4.push(props$3.a);
+ if (props$3.b) {
+ a$4.push(props$3.c);
("<>");
}
- a$2.push(props$1.d);
- return a$2;
+ a$5.push(props$6.d);
+ return a$5;
}
```
@@ -143,33 +145,33 @@ function Component$0(props$1) {
```
bb0:
- Const mutate a$2 = Array []
- Call mutate a$2.push(read props$1.a)
- If (read props$1.b) then:bb2 else:bb1
+ Const mutate a$5 = Array []
+ Call mutate a$5.push(read props$4.a)
+ If (read props$4.b) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.c)
- Const mutate $3 = null
- Return read $3
+ Call mutate a$5.push(read props$4.c)
+ Const mutate $6 = null
+ Return read $6
bb1:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.d)
- Return freeze a$2
+ Call mutate a$5.push(read props$4.d)
+ Return freeze a$5
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- a$2.push(props$1.a);
- if (props$1.b) {
- a$2.push(props$1.c);
+function Component$0(props$4) {
+ const a$5 = [];
+ a$5.push(props$4.a);
+ if (props$4.b) {
+ a$5.push(props$4.c);
return null;
}
- a$2.push(props$1.d);
- return a$2;
+ a$5.push(props$4.d);
+ return a$5;
}
```
@@ -177,32 +179,32 @@ function Component$0(props$1) {
```
bb0:
- Const mutate a$2 = Array []
- Call mutate a$2.push(read props$1.a)
- If (read props$1.b) then:bb2 else:bb1
+ Const mutate a$4 = Array []
+ Call mutate a$4.push(read props$3.a)
+ If (read props$3.b) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.c)
- Return freeze a$2
+ Call mutate a$4.push(read props$3.c)
+ Return freeze a$4
bb1:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.d)
- Return freeze a$2
+ Call mutate a$4.push(read props$3.d)
+ Return freeze a$4
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- a$2.push(props$1.a);
- if (props$1.b) {
- a$2.push(props$1.c);
- return a$2;
+function Component$0(props$3) {
+ const a$4 = [];
+ a$4.push(props$3.a);
+ if (props$3.b) {
+ a$4.push(props$3.c);
+ return a$4;
}
- a$2.push(props$1.d);
- return a$2;
+ a$4.push(props$3.d);
+ return a$4;
}
```
@@ -210,31 +212,33 @@ function Component$0(props$1) {
```
bb0:
- Const mutate a$2 = Array []
- Call mutate a$2.push(read props$1.a)
- If (read props$1.b) then:bb1 else:bb2
+ Const mutate a$4 = Array []
+ Call mutate a$4.push(read props$3.a)
+ If (read props$3.b) then:bb1 else:bb2
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.c)
+ Call mutate a$4.push(read props$3.c)
Goto bb1
bb1:
predecessor blocks: bb2 bb0
- Call mutate a$2.push(read props$1.d)
- Return freeze a$2
+ a$5: phi(bb2: a$4, bb0: a$4)
+ props$6: phi(bb2: props$3, bb0: props$3)
+ Call mutate a$5.push(read props$6.d)
+ Return freeze a$5
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- a$2.push(props$1.a);
- if (props$1.b) {
- a$2.push(props$1.d);
- return a$2;
+function Component$0(props$3) {
+ const a$4 = [];
+ a$4.push(props$3.a);
+ if (props$3.b) {
+ a$5.push(props$6.d);
+ return a$5;
}
- a$2.push(props$1.c);
+ a$4.push(props$3.c);
("<>");
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
index 1ea6a4364e..00809fd0d8 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
@@ -67,43 +67,50 @@ function mayMutate() {}
```
bb0:
- Const mutate a$2 = Array []
- Const mutate b$3 = Array []
- If (read b$3) then:bb2 else:bb1
+ Const mutate a$7 = Array []
+ Const mutate b$8 = Array []
+ If (read b$8) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.p0)
+ Call mutate a$7.push(read props$6.p0)
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- If (read props$1.p1) then:bb4 else:bb3
+ props$9: phi(bb0: props$6, bb2: props$6)
+ b$10: phi(bb0: b$8, bb2: b$8)
+ Foo$12: phi(bb0: Foo$4, bb2: Foo$4)
+ a$14: phi(bb0: a$7, bb2: a$7)
+ If (read props$9.p1) then:bb4 else:bb3
bb4:
predecessor blocks: bb1
- Call mutate b$3.push(read props$1.p2)
+ Call mutate b$10.push(read props$9.p2)
Goto bb3
bb3:
predecessor blocks: bb1 bb4
- Const mutate $5 = JSX
- Return read $5
+ Foo$11: phi(bb1: Foo$12, bb4: Foo$12)
+ a$13: phi(bb1: a$14, bb4: a$14)
+ b$15: phi(bb1: b$10, bb4: b$10)
+ Const mutate $16 = JSX
+ Return read $16
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- const b$3 = [];
- if (b$3) {
- a$2.push(props$1.p0);
+function Component$0(props$6) {
+ const a$7 = [];
+ const b$8 = [];
+ if (b$8) {
+ a$7.push(props$6.p0);
("<>");
}
- if (props$1.p1) {
- b$3.push(props$1.p2);
+ if (props$9.p1) {
+ b$10.push(props$9.p2);
("<>");
}
- return ;
+ return ;
}
```
@@ -111,44 +118,51 @@ function Component$0(props$1) {
```
bb0:
- Const mutate a$2 = Array []
- Const mutate b$3 = Array []
- Const mutate $5 = Call mutate mayMutate$4(mutate b$3)
- If (read $5) then:bb2 else:bb1
+ Const mutate a$9 = Array []
+ Const mutate b$10 = Array []
+ Const mutate $11 = Call mutate mayMutate$4(mutate b$10)
+ If (read $11) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate a$2.push(read props$1.p0)
+ Call mutate a$9.push(read props$8.p0)
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- If (read props$1.p1) then:bb4 else:bb3
+ props$12: phi(bb0: props$8, bb2: props$8)
+ b$13: phi(bb0: b$10, bb2: b$10)
+ Foo$15: phi(bb0: Foo$6, bb2: Foo$6)
+ a$17: phi(bb0: a$9, bb2: a$9)
+ If (read props$12.p1) then:bb4 else:bb3
bb4:
predecessor blocks: bb1
- Call mutate b$3.push(read props$1.p2)
+ Call mutate b$13.push(read props$12.p2)
Goto bb3
bb3:
predecessor blocks: bb1 bb4
- Const mutate $7 = JSX
- Return read $7
+ Foo$14: phi(bb1: Foo$15, bb4: Foo$15)
+ a$16: phi(bb1: a$17, bb4: a$17)
+ b$18: phi(bb1: b$13, bb4: b$13)
+ Const mutate $19 = JSX
+ Return read $19
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- const b$3 = [];
- if (mayMutate$4(b$3)) {
- a$2.push(props$1.p0);
+function Component$0(props$8) {
+ const a$9 = [];
+ const b$10 = [];
+ if (mayMutate$4(b$10)) {
+ a$9.push(props$8.p0);
("<>");
}
- if (props$1.p1) {
- b$3.push(props$1.p2);
+ if (props$12.p1) {
+ b$13.push(props$12.p2);
("<>");
}
- return ;
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
index e331c900b0..6b79bee31d 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
@@ -34,28 +34,28 @@ function Foo$0() {
```
bb0:
- Const mutate a$2 = Array []
- Const mutate b$3 = Object { }
- New mutate Foo$4(mutate a$2, mutate b$3)
- Const mutate $6 = "div"
- Let mutate _$5 = JSX
- New mutate Foo$4(mutate b$3)
- Const mutate $7 = "div"
- Const mutate $8 = JSX
- Return read $8
+ Const mutate a$10 = Array []
+ Const mutate b$11 = Object { }
+ New mutate Foo$4(mutate a$10, mutate b$11)
+ Const mutate $12 = "div"
+ Let mutate _$13 = JSX
+ New mutate Foo$4(mutate b$11)
+ Const mutate $14 = "div"
+ Const mutate $15 = JSX
+ Return read $15
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = [];
- const b$3 = {};
- new Foo$4(a$2, b$3);
- let _$5 = ;
+function Component$0(props$9) {
+ const a$10 = [];
+ const b$11 = {};
+ new Foo$4(a$10, b$11);
+ let _$13 = ;
- new Foo$4(b$3);
- return ;
+ new Foo$4(b$11);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
index a947dd245f..bf745e9e4e 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
@@ -18,10 +18,10 @@ function foo(x) {}
```
bb0:
- Const mutate a$1 = Array []
- Const mutate b$2 = read a$1
- Call read useFreeze$3(freeze a$1)
- Call mutate foo$4(read b$2)
+ Const mutate a$5 = Array []
+ Const mutate b$6 = read a$5
+ Call read useFreeze$3(freeze a$5)
+ Call mutate foo$4(read b$6)
Return
```
@@ -29,10 +29,10 @@ bb0:
```javascript
function Component$0() {
- const a$1 = [];
- const b$2 = a$1;
- useFreeze$3(a$1);
- foo$4(b$2);
+ const a$5 = [];
+ const b$6 = a$5;
+ useFreeze$3(a$5);
+ foo$4(b$6);
return;
}
@@ -62,7 +62,7 @@ bb0:
## Code
```javascript
-function foo$0(x$1) {
+function foo$0(x$2) {
return;
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
index a393dcc700..12d7dc54fd 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
@@ -53,27 +53,27 @@ function foo$0() {
```
bb0:
- Const mutate x$2 = Array []
- Const mutate y$3 = Call read useFreeze$4(freeze x$2)
- Call mutate foo$5(read y$3, read x$2)
- Const mutate $6 = "\n "
- Const mutate $7 = "\n "
- Const mutate $8 = "\n "
- Const mutate $9 = JSX {read $6}{read x$2}{read $7}{read y$3}{read $8}
- Return read $9
+ Const mutate x$11 = Array []
+ Const mutate y$12 = Call read useFreeze$4(freeze x$11)
+ Call mutate foo$5(read y$12, read x$11)
+ Const mutate $13 = "\n "
+ Const mutate $14 = "\n "
+ Const mutate $15 = "\n "
+ Const mutate $16 = JSX {read $13}{read x$11}{read $14}{read y$12}{read $15}
+ Return read $16
```
## Code
```javascript
-function Component$0(props$1) {
- const x$2 = [];
- const y$3 = useFreeze$4(x$2);
- foo$5(y$3, x$2);
+function Component$0(props$10) {
+ const x$11 = [];
+ const y$12 = useFreeze$4(x$11);
+ foo$5(y$12, x$11);
return (
- {x$2}
- {y$3}
+ {x$11}
+ {y$12}
);
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
index c3fb1cd885..f5e9158fc0 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
@@ -19,22 +19,22 @@ function call(x) {}
```
bb0:
- Const mutate a$1 = Array []
- Call read useFreeze$2(freeze a$1)
- Call read useFreeze$2(read a$1)
- Call mutate call$3(read a$1)
- Return read a$1
+ Const mutate a$4 = Array []
+ Call read useFreeze$2(freeze a$4)
+ Call read useFreeze$2(read a$4)
+ Call mutate call$3(read a$4)
+ Return read a$4
```
## Code
```javascript
function Component$0() {
- const a$1 = [];
- useFreeze$2(a$1);
- useFreeze$2(a$1);
- call$3(a$1);
- return a$1;
+ const a$4 = [];
+ useFreeze$2(a$4);
+ useFreeze$2(a$4);
+ call$3(a$4);
+ return a$4;
}
```
@@ -48,7 +48,7 @@ bb0:
## Code
```javascript
-function useFreeze$0(x$1) {
+function useFreeze$0(x$2) {
return;
}
@@ -63,7 +63,7 @@ bb0:
## Code
```javascript
-function call$0(x$1) {
+function call$0(x$2) {
return;
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
index 52de83c92d..0394ddf0ed 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
@@ -26,45 +26,48 @@ function call(x) {}
```
bb0:
- Const mutate cond$2 = read props$1.cond
- Const mutate x$3 = read props$1.x
- Let mutate a$4 = undefined
- If (read cond$2) then:bb2 else:bb3
+ Const mutate cond$8 = read props$7.cond
+ Const mutate x$9 = read props$7.x
+ Let mutate a$10 = undefined
+ If (read cond$8) then:bb2 else:bb3
bb2:
predecessor blocks: bb0
- Reassign mutate a$4 = read x$3
+ Reassign mutate a$11 = read x$9
Goto bb1
bb3:
predecessor blocks: bb0
- Reassign mutate a$4 = Array []
+ Reassign mutate a$12 = Array []
Goto bb1
bb1:
predecessor blocks: bb3 bb2
- Call read useFreeze$5(freeze a$4)
- Call read useFreeze$5(read a$4)
- Call mutate call$6(read a$4)
- Return read a$4
+ useFreeze$13: phi(bb3: useFreeze$5, bb2: useFreeze$5)
+ a$14: phi(bb3: a$12, bb2: a$11)
+ call$15: phi(bb3: call$6, bb2: call$6)
+ Call read useFreeze$13(freeze a$14)
+ Call read useFreeze$13(read a$14)
+ Call mutate call$15(read a$14)
+ Return read a$14
```
## Code
```javascript
-function Component$0(props$1) {
- const cond$2 = props$1.cond;
- const x$3 = props$1.x;
- let a$4 = undefined;
- if (cond$2) {
- a$4 = x$3;
+function Component$0(props$7) {
+ const cond$8 = props$7.cond;
+ const x$9 = props$7.x;
+ let a$10 = undefined;
+ if (cond$8) {
+ a$11 = x$9;
("<>");
} else {
- a$4 = [];
+ a$12 = [];
("<>");
}
- useFreeze$5(a$4);
- useFreeze$5(a$4);
- call$6(a$4);
- return a$4;
+ useFreeze$13(a$14);
+ useFreeze$13(a$14);
+ call$15(a$14);
+ return a$14;
}
```
@@ -78,7 +81,7 @@ bb0:
## Code
```javascript
-function useFreeze$0(x$1) {
+function useFreeze$0(x$2) {
return;
}
@@ -93,7 +96,7 @@ bb0:
## Code
```javascript
-function call$0(x$1) {
+function call$0(x$2) {
return;
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
index 3dce042ea2..2537b2c99a 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
@@ -97,33 +97,36 @@ function Foo$0() {
```
bb0:
- Const mutate a$2 = Call mutate compute$3(read props$1.a)
- Const mutate b$4 = Call mutate compute$3(read props$1.b)
- If (read props$1.c) then:bb2 else:bb1
+ Const mutate a$9 = Call mutate compute$3(read props$8.a)
+ Const mutate b$10 = Call mutate compute$3(read props$8.b)
+ If (read props$8.c) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate mutate$5(mutate a$2)
- Call mutate mutate$5(mutate b$4)
+ Call mutate mutate$5(mutate a$9)
+ Call mutate mutate$5(mutate b$10)
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- Const mutate $7 = JSX
- Return read $7
+ Foo$11: phi(bb0: Foo$6, bb2: Foo$6)
+ a$12: phi(bb0: a$9, bb2: a$9)
+ b$13: phi(bb0: b$10, bb2: b$10)
+ Const mutate $14 = JSX
+ Return read $14
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = compute$3(props$1.a);
- const b$4 = compute$3(props$1.b);
- if (props$1.c) {
- mutate$5(a$2);
- mutate$5(b$4);
+function Component$0(props$8) {
+ const a$9 = compute$3(props$8.a);
+ const b$10 = compute$3(props$8.b);
+ if (props$8.c) {
+ mutate$5(a$9);
+ mutate$5(b$10);
("<>");
}
- return ;
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
index 6f89c6c44a..2292bc702c 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
@@ -28,19 +28,19 @@ function Foo() {}
```
bb0:
- Const mutate a$2 = Call mutate compute$3(read props$1.a)
- Const mutate b$4 = Call mutate compute$3(read props$1.b)
- Const mutate $6 = JSX
- Return read $6
+ Const mutate a$8 = Call mutate compute$3(read props$7.a)
+ Const mutate b$9 = Call mutate compute$3(read props$7.b)
+ Const mutate $10 = JSX
+ Return read $10
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = compute$3(props$1.a);
- const b$4 = compute$3(props$1.b);
- return ;
+function Component$0(props$7) {
+ const a$8 = compute$3(props$7.a);
+ const b$9 = compute$3(props$7.b);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
index 318328ece3..f0b150d952 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
@@ -76,31 +76,34 @@ function Foo$0() {
```
bb0:
- Const mutate a$2 = Call mutate compute$3(read props$1.a)
- Const mutate b$4 = Call mutate compute$3(read props$1.b)
- If (read props$1.c) then:bb2 else:bb1
+ Const mutate a$9 = Call mutate compute$3(read props$8.a)
+ Const mutate b$10 = Call mutate compute$3(read props$8.b)
+ If (read props$8.c) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Call mutate foo$5(mutate a$2, mutate b$4)
+ Call mutate foo$5(mutate a$9, mutate b$10)
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- Const mutate $7 = JSX
- Return read $7
+ Foo$11: phi(bb0: Foo$6, bb2: Foo$6)
+ a$12: phi(bb0: a$9, bb2: a$9)
+ b$13: phi(bb0: b$10, bb2: b$10)
+ Const mutate $14 = JSX
+ Return read $14
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = compute$3(props$1.a);
- const b$4 = compute$3(props$1.b);
- if (props$1.c) {
- foo$5(a$2, b$4);
+function Component$0(props$8) {
+ const a$9 = compute$3(props$8.a);
+ const b$10 = compute$3(props$8.b);
+ if (props$8.c) {
+ foo$5(a$9, b$10);
("<>");
}
- return ;
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
index 65c73a2754..9edcd21830 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
@@ -28,21 +28,21 @@ function Foo() {}
```
bb0:
- Const mutate a$2 = Call mutate compute$3(read props$1.a)
- Const mutate b$4 = Call mutate compute$3(read props$1.b)
- Call mutate foo$5(mutate a$2, mutate b$4)
- Const mutate $7 = JSX
- Return read $7
+ Const mutate a$9 = Call mutate compute$3(read props$8.a)
+ Const mutate b$10 = Call mutate compute$3(read props$8.b)
+ Call mutate foo$5(mutate a$9, mutate b$10)
+ Const mutate $11 = JSX
+ Return read $11
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = compute$3(props$1.a);
- const b$4 = compute$3(props$1.b);
- foo$5(a$2, b$4);
- return ;
+function Component$0(props$8) {
+ const a$9 = compute$3(props$8.a);
+ const b$10 = compute$3(props$8.b);
+ foo$5(a$9, b$10);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
index 0c1d50d9ef..e75fc071f1 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
@@ -49,7 +49,7 @@ bb0:
## Code
```javascript
-function mutate$0(x$1, y$2) {
+function mutate$0(x$3, y$4) {
return;
}
@@ -64,7 +64,7 @@ bb0:
## Code
```javascript
-function cond$0(x$1) {
+function cond$0(x$2) {
return;
}
@@ -73,52 +73,63 @@ function cond$0(x$1) {
```
bb0:
- Let mutate a$2 = Object { }
- Let mutate b$3 = Object { }
- Let mutate c$4 = Object { }
- Let mutate d$5 = Object { }
+ Let mutate a$13 = Object { }
+ Let mutate b$14 = Object { }
+ Let mutate c$15 = Object { }
+ Let mutate d$16 = Object { }
Goto bb1
bb1:
predecessor blocks: bb0 bb3
- Const mutate $10 = true
- If (read $10) then:bb3 else:bb2
+ a$18: phi(bb0: a$13, bb3: a$21)
+ b$20: phi(bb0: b$14, bb3: b$23)
+ c$22: phi(bb0: c$15, bb3: c$25)
+ d$24: phi(bb0: d$16, bb3: d$26)
+ mutate$27: phi(bb0: mutate$7, bb3: mutate$27)
+ cond$28: phi(bb0: cond$8, bb3: cond$28)
+ Const mutate $17 = true
+ If (read $17) then:bb3 else:bb2
bb3:
predecessor blocks: bb1
- Let mutate z$6 = read a$2
- Reassign mutate a$2 = read b$3
- Reassign mutate b$3 = read c$4
- Reassign mutate c$4 = read d$5
- Reassign mutate d$5 = read z$6
- Call mutate mutate$7(mutate a$2, mutate b$3)
- Const mutate $9 = Call mutate cond$8(mutate a$2)
- If (read $9) then:bb2 else:bb1
+ Let mutate z$19 = read a$18
+ Reassign mutate a$21 = read b$20
+ Reassign mutate b$23 = read c$22
+ Reassign mutate c$25 = read d$24
+ Reassign mutate d$26 = read z$19
+ Call mutate mutate$27(mutate a$21, mutate b$23)
+ Const mutate $29 = Call mutate cond$28(mutate a$21)
+ If (read $29) then:bb2 else:bb1
bb2:
predecessor blocks: bb1 bb3
- If (read a$2) then:bb7 else:bb7
+ a$30: phi(bb1: a$18, bb3: a$21)
+ b$31: phi(bb1: b$20, bb3: b$23)
+ c$32: phi(bb1: c$22, bb3: c$25)
+ d$33: phi(bb1: d$24, bb3: d$26)
+ mutate$35: phi(bb1: mutate$27, bb3: mutate$27)
+ If (read a$30) then:bb7 else:bb7
bb7:
predecessor blocks: bb2
- If (read b$3) then:bb9 else:bb9
+ If (read b$31) then:bb9 else:bb9
bb9:
predecessor blocks: bb7
- If (read c$4) then:bb11 else:bb11
+ If (read c$32) then:bb11 else:bb11
bb11:
predecessor blocks: bb9
- If (read d$5) then:bb13 else:bb13
+ If (read d$33) then:bb13 else:bb13
bb13:
predecessor blocks: bb11
- Const mutate $11 = null
- Call mutate mutate$7(mutate d$5, read $11)
+ Const mutate $34 = null
+ Call mutate mutate$35(mutate d$33, read $34)
Return
```
## Code
```javascript
-function Component$0(props$1) {
- let a$2 = {};
- let b$3 = {};
- let c$4 = {};
- let d$5 = {};
+function Component$0(props$12) {
+ let a$13 = {};
+ let b$14 = {};
+ let c$15 = {};
+ let d$16 = {};
("<>");
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
index 01798e5527..b9ffe4ca10 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
@@ -45,7 +45,7 @@ bb0:
## Code
```javascript
-function mutate$0(x$1, y$2) {
+function mutate$0(x$3, y$4) {
return;
}
@@ -54,202 +54,202 @@ function mutate$0(x$1, y$2) {
```
bb0:
- Const mutate a$2 = Object { }
- Const mutate b$3 = Array [read a$2]
- Const mutate c$4 = Object { }
- Const mutate d$5 = Object { c: read c$4 }
- Const mutate x$6 = Object { }
- Reassign mutate x$6.b = read b$3
- Const mutate y$7 = Call mutate mutate$8(mutate x$6, mutate d$5)
- If (read a$2) then:bb1 else:bb1
+ Const mutate a$11 = Object { }
+ Const mutate b$12 = Array [read a$11]
+ Const mutate c$13 = Object { }
+ Const mutate d$14 = Object { c: read c$13 }
+ Const mutate x$15 = Object { }
+ Reassign mutate x$15.b = read b$12
+ Const mutate y$16 = Call mutate mutate$8(mutate x$15, mutate d$14)
+ If (read a$11) then:bb1 else:bb1
bb1:
predecessor blocks: bb0
- If (read b$3) then:bb3 else:bb3
+ If (read b$12) then:bb3 else:bb3
bb3:
predecessor blocks: bb1
- If (read c$4) then:bb5 else:bb5
+ If (read c$13) then:bb5 else:bb5
bb5:
predecessor blocks: bb3
- If (read d$5) then:bb7 else:bb7
+ If (read d$14) then:bb7 else:bb7
bb7:
predecessor blocks: bb5
- If (read y$7) then:bb9 else:bb9
+ If (read y$16) then:bb9 else:bb9
bb9:
predecessor blocks: bb7
- Const mutate $9 = null
- Call mutate mutate$8(mutate x$6, read $9)
+ Const mutate $17 = null
+ Call mutate mutate$8(mutate x$15, read $17)
Return
```
## Code
```javascript
-function Component$0(props$1) {
- const a$2 = {};
- const b$3 = [a$2];
- const c$4 = {};
- const d$5 = {
- c: c$4,
+function Component$0(props$10) {
+ const a$11 = {};
+ const b$12 = [a$11];
+ const c$13 = {};
+ const d$14 = {
+ c: c$13,
};
- const x$6 = {};
- x$6 = b$3;
- const y$7 = mutate$8(x$6, d$5);
- if (a$2) {
- if (b$3) {
- if (c$4) {
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ const x$15 = {};
+ x$15 = b$12;
+ const y$16 = mutate$8(x$15, d$14);
+ if (a$11) {
+ if (b$12) {
+ if (c$13) {
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (c$4) {
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (c$13) {
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (b$3) {
- if (c$4) {
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (b$12) {
+ if (c$13) {
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (c$4) {
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (c$13) {
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (d$5) {
- if (y$7) {
- mutate$8(x$6, null);
+ if (d$14) {
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
- if (y$7) {
- mutate$8(x$6, null);
+ if (y$16) {
+ mutate$8(x$15, null);
return;
}
- mutate$8(x$6, null);
+ mutate$8(x$15, null);
return;
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
index 718fe22e37..da9e4b209a 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
@@ -17,25 +17,25 @@ function Component(props) {
```
bb0:
- Const mutate x$2 = Object { }
- Const mutate y$3 = Array []
- Reassign mutate x$2.y = read y$3
- Const mutate child$4 = JSX
- Call mutate x$2.y.push(read props$1.p0)
- Const mutate $5 = JSX {read child$4}
- Return read $5
+ Const mutate x$7 = Object { }
+ Const mutate y$8 = Array []
+ Reassign mutate x$7.y = read y$8
+ Const mutate child$9 = JSX
+ Call mutate x$7.y.push(read props$6.p0)
+ Const mutate $10 = JSX {read child$9}
+ Return read $10
```
## Code
```javascript
-function Component$0(props$1) {
- const x$2 = {};
- const y$3 = [];
- x$2 = y$3;
- const child$4 = ;
- x$2.y.push(props$1.p0);
- return {child$4};
+function Component$0(props$6) {
+ const x$7 = {};
+ const y$8 = [];
+ x$7 = y$8;
+ const child$9 = ;
+ x$7.y.push(props$6.p0);
+ return {child$9};
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
index 4919c5c3a6..e45c81ef9c 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
@@ -23,38 +23,42 @@ function Component(props) {
```
bb0:
- Let mutate x$2 = Array []
- Call mutate x$2.push(read props$1.p0)
- Let mutate y$3 = read x$2
- If (read props$1.p1) then:bb2 else:bb1
+ Let mutate x$7 = Array []
+ Call mutate x$7.push(read props$6.p0)
+ Let mutate y$8 = read x$7
+ If (read props$6.p1) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Reassign mutate x$2 = Array []
+ Reassign mutate x$9 = Array []
Goto bb1
bb1:
predecessor blocks: bb0 bb2
- Let mutate _$4 = JSX
- Call read y$3.push(read props$1.p2)
- Const mutate $5 = JSX
- Return read $5
+ Component$10: phi(bb0: Component$0, bb2: Component$0)
+ x$11: phi(bb0: x$7, bb2: x$9)
+ y$13: phi(bb0: y$8, bb2: y$8)
+ props$14: phi(bb0: props$6, bb2: props$6)
+ Let mutate _$12 = JSX
+ Call read y$13.push(read props$14.p2)
+ Const mutate $15 = JSX
+ Return read $15
```
## Code
```javascript
-function Component$0(props$1) {
- let x$2 = [];
- x$2.push(props$1.p0);
- let y$3 = x$2;
- if (props$1.p1) {
- x$2 = [];
+function Component$0(props$6) {
+ let x$7 = [];
+ x$7.push(props$6.p0);
+ let y$8 = x$7;
+ if (props$6.p1) {
+ x$9 = [];
("<>");
}
- let _$4 = ;
+ let _$12 = ;
- y$3.push(props$1.p2);
- return ;
+ y$13.push(props$14.p2);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
index 6d59785563..f061ee199f 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
@@ -21,28 +21,28 @@ function Component(props) {
```
bb0:
- Let mutate x$2 = Array []
- Call mutate x$2.push(read props$1.p0)
- Let mutate y$3 = read x$2
- Reassign mutate x$2 = Array []
- Let mutate _$4 = JSX
- Call mutate y$3.push(read props$1.p1)
- Const mutate $5 = JSX
- Return read $5
+ Let mutate x$7 = Array []
+ Call mutate x$7.push(read props$6.p0)
+ Let mutate y$8 = read x$7
+ Reassign mutate x$9 = Array []
+ Let mutate _$10 = JSX
+ Call mutate y$8.push(read props$6.p1)
+ Const mutate $11 = JSX
+ Return read $11
```
## Code
```javascript
-function Component$0(props$1) {
- let x$2 = [];
- x$2.push(props$1.p0);
- let y$3 = x$2;
- x$2 = [];
- let _$4 = ;
+function Component$0(props$6) {
+ let x$7 = [];
+ x$7.push(props$6.p0);
+ let y$8 = x$7;
+ x$9 = [];
+ let _$10 = ;
- y$3.push(props$1.p1);
- return ;
+ y$8.push(props$6.p1);
+ return ;
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
index 19081151a9..93ab89000e 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
@@ -36,91 +36,92 @@ function Component(props) {
```
bb0:
- Let mutate x$2 = undefined
- If (read props$1.cond) then:bb2 else:bb10
+ Let mutate x$7 = undefined
+ If (read props$6.cond) then:bb2 else:bb10
bb2:
predecessor blocks: bb0
- Const mutate $3 = 2
- Const mutate $4 = 1
- Const mutate $5 = 0
- Switch ( props$1.test)
- Case read $5: bb8
- Case read $4: bb6
- Case read $3: bb4
+ Const mutate $8 = 2
+ Const mutate $9 = 1
+ Const mutate $10 = 0
+ Switch ( props$6.test)
+ Case read $10: bb8
+ Case read $9: bb6
+ Case read $8: bb4
Default: bb4
bb8:
predecessor blocks: bb2
- Reassign mutate x$2 = read props$1.v0
+ Reassign mutate x$11 = read props$6.v0
Goto bb1
bb6:
predecessor blocks: bb2
- Reassign mutate x$2 = read props$1.v1
+ Reassign mutate x$12 = read props$6.v1
Goto bb1
bb4:
predecessor blocks: bb2
- Reassign mutate x$2 = read props$1.v2
+ Reassign mutate x$13 = read props$6.v2
Goto bb1
bb10:
predecessor blocks: bb0
- If (read props$1.cond2) then:bb12 else:bb13
+ If (read props$6.cond2) then:bb12 else:bb13
bb12:
predecessor blocks: bb10
- Reassign mutate x$2 = read props$1.b
+ Reassign mutate x$14 = read props$6.b
Goto bb1
bb13:
predecessor blocks: bb10
- Reassign mutate x$2 = read props$1.c
+ Reassign mutate x$15 = read props$6.c
Goto bb1
bb1:
predecessor blocks: bb13 bb12 bb8 bb6 bb4
- read x$2
+ x$16: phi(bb13: x$15, bb12: x$14, bb8: x$11, bb6: x$12, bb4: x$13)
+ read x$16
Return
```
## Code
```javascript
-function Component$0(props$1) {
- let x$2 = undefined;
- if (props$1.cond) {
- switch (props$1.test) {
+function Component$0(props$6) {
+ let x$7 = undefined;
+ if (props$6.cond) {
+ switch (props$6.test) {
case 0: {
- x$2 = props$1.v0;
+ x$11 = props$6.v0;
("<>");
}
case 1: {
- x$2 = props$1.v1;
+ x$12 = props$6.v1;
("<>");
}
case 2: {
- x$2 = props$1.v2;
+ x$13 = props$6.v2;
("<>");
}
default: {
- x$2 = props$1.v2;
+ x$13 = props$6.v2;
("<>");
}
}
- x$2;
+ x$16;
return;
} else {
- if (props$1.cond2) {
- x$2 = props$1.b;
+ if (props$6.cond2) {
+ x$14 = props$6.b;
("<>");
} else {
- x$2 = props$1.c;
+ x$15 = props$6.c;
("<>");
}
- x$2;
+ x$16;
return;
}
- x$2;
+ x$16;
return;
}
diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
index c7f670aafc..950c65842d 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
@@ -15,28 +15,28 @@ function foo(x, y) {
```
bb0:
- If (read x$1) then:bb2 else:bb1
+ If (read x$8) then:bb2 else:bb1
bb2:
predecessor blocks: bb0
- Const mutate $3 = false
- Const mutate $4 = Call read foo$0(read $3, read y$2)
- Return freeze $4
+ Const mutate $10 = false
+ Const mutate $11 = Call read foo$0(read $10, read y$9)
+ Return freeze $11
bb1:
predecessor blocks: bb0
- Const mutate $5 = 10
- Const mutate $6 = Binary read y$2 * read $5
- Const mutate $7 = Array [read $6]
- Return freeze $7
+ Const mutate $12 = 10
+ Const mutate $13 = Binary read y$9 * read $12
+ Const mutate $14 = Array [read $13]
+ Return freeze $14
```
## Code
```javascript
-function foo$0(x$1, y$2) {
- if (x$1) {
- return foo$0(false, y$2);
+function foo$0(x$8, y$9) {
+ if (x$8) {
+ return foo$0(false, y$9);
}
- return [y$2 * 10];
+ return [y$9 * 10];
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
index 299f300081..009297f8a1 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
@@ -32,46 +32,50 @@ function Component(props) {
```
bb0:
- Let mutate x$2 = Array []
- Let mutate y$3 = undefined
- Const mutate $4 = false
- Const mutate $5 = true
- Const mutate $6 = 1
- Switch ( props$1.p0)
- Case read $6: bb1
- Case read $5: bb6
+ Let mutate x$10 = Array []
+ Let mutate y$11 = undefined
+ Const mutate $12 = false
+ Const mutate $13 = true
+ Const mutate $14 = 1
+ Switch ( props$9.p0)
+ Case read $14: bb1
+ Case read $13: bb6
Default: bb1
- Case read $4: bb2
+ Case read $12: bb2
bb6:
predecessor blocks: bb0
- Call mutate x$2.push(read props$1.p2)
- Reassign mutate y$3 = Array []
+ Call mutate x$10.push(read props$9.p2)
+ Reassign mutate y$15 = Array []
Goto bb1
bb2:
predecessor blocks: bb0
- Reassign mutate y$3 = read x$2
+ Reassign mutate y$16 = read x$10
Goto bb1
bb1:
predecessor blocks: bb0 bb6 bb2
- Const mutate child$7 = JSX
- Call read y$3.push(read props$1.p4)
- Const mutate $8 = JSX {read child$7}
- Return read $8
+ Component$17: phi(bb0: Component$0, bb6: Component$0, bb2: Component$0)
+ x$18: phi(bb0: x$10, bb6: x$10, bb2: x$10)
+ y$20: phi(bb0: y$11, bb6: y$15, bb2: y$16)
+ props$21: phi(bb0: props$9, bb6: props$9, bb2: props$9)
+ Const mutate child$19 = JSX
+ Call read y$20.push(read props$21.p4)
+ Const mutate $22 = JSX {read child$19}
+ Return read $22
```
## Code
```javascript
-function Component$0(props$1) {
- let x$2 = [];
- let y$3 = undefined;
- switch (props$1.p0) {
+function Component$0(props$9) {
+ let x$10 = [];
+ let y$11 = undefined;
+ switch (props$9.p0) {
case 1:
break;
case true: {
- x$2.push(props$1.p2);
- y$3 = [];
+ x$10.push(props$9.p2);
+ y$15 = [];
("<>");
}
@@ -79,14 +83,14 @@ function Component$0(props$1) {
break;
case false: {
- y$3 = x$2;
+ y$16 = x$10;
("<>");
}
}
- const child$7 = ;
- y$3.push(props$1.p4);
- return {child$7};
+ const child$19 = ;
+ y$20.push(props$21.p4);
+ return {child$19};
}
```
diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
index f026f2b65e..921ed4febf 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+++ b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
@@ -28,55 +28,62 @@ function Component(props) {
```
bb0:
- Let mutate x$2 = Array []
- Let mutate y$3 = undefined
- Const mutate $4 = false
- Const mutate $5 = true
- Switch ( props$1.p0)
- Case read $5: bb4
- Case read $4: bb2
+ Let mutate x$9 = Array []
+ Let mutate y$10 = undefined
+ Const mutate $11 = false
+ Const mutate $12 = true
+ Switch ( props$8.p0)
+ Case read $12: bb4
+ Case read $11: bb2
Default: bb1
bb4:
predecessor blocks: bb0
- Call mutate x$2.push(read props$1.p2)
- Call mutate x$2.push(read props$1.p3)
- Reassign mutate y$3 = Array []
+ Call mutate x$9.push(read props$8.p2)
+ Call mutate x$9.push(read props$8.p3)
+ Reassign mutate y$13 = Array []
Goto bb2
bb2:
predecessor blocks: bb4 bb0
- Reassign mutate y$3 = read x$2
+ x$14: phi(bb4: x$9, bb0: x$9)
+ Component$17: phi(bb4: Component$0, bb0: Component$0)
+ props$22: phi(bb4: props$8, bb0: props$8)
+ Reassign mutate y$15 = read x$14
Goto bb1
bb1:
predecessor blocks: bb2 bb0
- Const mutate child$6 = JSX
- Call read y$3.push(read props$1.p4)
- Const mutate $7 = JSX {read child$6}
- Return read $7
+ Component$16: phi(bb2: Component$17, bb0: Component$0)
+ x$18: phi(bb2: x$14, bb0: x$9)
+ y$20: phi(bb2: y$15, bb0: y$10)
+ props$21: phi(bb2: props$22, bb0: props$8)
+ Const mutate child$19 = JSX
+ Call read y$20.push(read props$21.p4)
+ Const mutate $23 = JSX {read child$19}
+ Return read $23
```
## Code
```javascript
-function Component$0(props$1) {
- let x$2 = [];
- let y$3 = undefined;
- switch (props$1.p0) {
+function Component$0(props$8) {
+ let x$9 = [];
+ let y$10 = undefined;
+ switch (props$8.p0) {
case true: {
- x$2.push(props$1.p2);
- x$2.push(props$1.p3);
- y$3 = [];
+ x$9.push(props$8.p2);
+ x$9.push(props$8.p3);
+ y$13 = [];
("<>");
}
case false: {
- y$3 = x$2;
+ y$15 = x$14;
("<>");
}
}
- const child$6 = ;
- y$3.push(props$1.p4);
- return {child$6};
+ const child$19 = ;
+ y$20.push(props$21.p4);
+ return {child$19};
}
```
diff --git a/compiler/forget/src/__tests__/hir-test.ts b/compiler/forget/src/__tests__/hir-test.ts
index 0bc636ce16..08c8e27963 100644
--- a/compiler/forget/src/__tests__/hir-test.ts
+++ b/compiler/forget/src/__tests__/hir-test.ts
@@ -47,9 +47,7 @@ describe("React Forget (HIR version)", () => {
enter(nodePath) {
const env: Environment = new Environment();
const ir: HIRFunction = lower(nodePath, env);
- if (file.startsWith("ssa")) {
- buildSSA(ir, env);
- }
+ buildSSA(ir, env);
inferReferenceEffects(ir);
// const lifetimeGraph = buildDefUseGraph(ir);
const textHIR = printHIR(ir.body);