1
+
2
+## Input
3
+
4
+```javascript
5
+function foo(props) {
6
+ let x = [];
7
+ x.push(props.bar);
8
+ const _ = props.cond
9
+ ? ((x = {}), (x = []), x.push(props.foo))
10
+ : ((x = []), (x = []), x.push(props.bar));
11
+ console.log(_);
12
+ mut(x);
13
+ return x;
14
+}
15
+
16
+```
17
+
18
+## HIR
19
+
20
+```javascript
21
+bb0 (block):
22
+ [1] store $44[1:7] = Array []
23
+ [2] store $46[2:7] = StoreLocal Let mutate x$45[2:42] = capture $44[1:7]
24
+ [3] mutate $47[3:7] = LoadLocal capture x$45[2:42]
25
+ [4] mutate $48 = LoadLocal read props$43
26
+ [5] mutate $49 = PropertyLoad read $48.bar
27
+ [6] mutate $50 = PropertyCall mutate $47[3:7].push(read $49)
28
+ [7] Ternary test:bb2 fallthrough=bb1
29
+bb2 (value):
30
+ predecessor blocks: bb0
31
+ [8] mutate $51 = LoadLocal read props$43
32
+ [9] mutate $52 = PropertyLoad read $51.cond
33
+ [10] Branch (read $52) then:bb3 else:bb4
34
+bb3 (value):
35
+ predecessor blocks: bb2
36
+ [14] store $57[14:42] = Array []
37
+ [15] store $59[15:42] = StoreLocal Reassign mutate x$45[15:42] = capture $57[14:42]
38
+ [17] mutate $61[17:42] = LoadLocal capture x$45[15:42]
39
+ [18] mutate $62 = LoadLocal read props$43
40
+ [19] mutate $63 = PropertyLoad read $62.foo
41
+ [20] mutate $64[20:39] = PropertyCall mutate $61[17:42].push(read $63)
42
+ [21] store $66[21:39] = StoreLocal Const mutate $65[7:39] = capture $64[20:39]
43
+ [22] Goto bb1
44
+bb4 (value):
45
+ predecessor blocks: bb2
46
+ [26] store $71[26:42] = Array []
47
+ [27] store $73[27:42] = StoreLocal Reassign mutate x$45[27:42] = capture $71[26:42]
48
+ [29] mutate $75[29:42] = LoadLocal capture x$45[27:42]
49
+ [30] mutate $76 = LoadLocal read props$43
50
+ [31] mutate $77 = PropertyLoad read $76.bar
51
+ [32] mutate $78[32:39] = PropertyCall mutate $75[29:42].push(read $77)
52
+ [33] store $80[33:39] = StoreLocal Const mutate $65[7:39] = capture $78[32:39]
53
+ [34] Goto bb1
54
+bb1 (block):
55
+ predecessor blocks: bb3 bb4
56
+ $83[7:39]:TPhi: phi(bb3: $65, bb4: $79)
57
+ x$45[15:42]:TPhi: phi(bb3: x$45, bb4: x$45)
58
+ [35] store $82[35:39] = StoreLocal Const mutate _$81[35:39] = capture $65[7:39]
59
+ [36] mutate $84 = Global console
60
+ [37] mutate $85[37:39] = LoadLocal capture _$81[35:39]
61
+ [38] mutate $86 = PropertyCall read $84.log(mutate $85[37:39])
62
+ [39] mutate $87:TFunction = Global mut
63
+ [40] mutate $88[40:42] = LoadLocal capture x$45[15:42]
64
+ [41] mutate $90 = Call read $87:TFunction(mutate $88[40:42])
65
+ [42] mutate $91 = LoadLocal capture x$45[15:42]
66
+ [43] Return freeze $91
67
+```
68
+
\ No newline at end of file