Expect files are input/ouput code only (no HIR/scopes)
Joe Savona committed
Dec 22, 2022 at 10:23 UTC
47e20c3f66f06f3c4d22bdb17d47f44c1ec33363
102 files changed
+41
-5420
compiler/forget/src/CompilerPipeline.ts
+4
-5
@@ -14,13 +14,13 @@ import {
14
inferTypes,
15
lower,
16
} from "./HIR";
17
+import { ReactiveFunction } from "./HIR/HIR";
18
import {
19
buildReactiveFunction,
20
codegenReactiveFunction,
21
flattenReactiveLoops,
22
inferReactiveScopes,
23
inferReactiveScopeVariables,
23
- printReactiveFunction,
24
propagateScopeDependencies,
25
pruneUnusedLabels,
26
pruneUnusedScopes,
@@ -30,9 +30,9 @@ import { eliminateRedundantPhi, enterSSA, leaveSSA } from "./SSA";
30
import { logHIRFunction } from "./Utils/logger";
31
32
export type CompilerResult = {
33
- ir: HIRFunction;
33
ast: t.Function;
35
- scopes: string;
34
+ ir: HIRFunction;
35
+ reactiveFunction: ReactiveFunction;
36
};
37
38
export default function (
@@ -73,12 +73,11 @@ export default function (
73
propagateScopeDependencies(reactiveFunction);
74
pruneUnusedScopes(reactiveFunction);
75
renameVariables(reactiveFunction);
76
- const scopes = printReactiveFunction(reactiveFunction);
76
const ast = codegenReactiveFunction(reactiveFunction);
77
78
return {
79
ast,
80
ir,
82
- scopes,
81
+ reactiveFunction,
82
};
83
}
compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md
-34
@@ -20,40 +20,6 @@ function Component(props) {
20
21
```
22
23
-## HIR
24
-
25
-```
26
-bb0:
27
- [1] Const mutate a$4_@0[1:7] = Array []
28
- [2] Call mutate a$4_@0.push(read props$3.a)
29
- [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2
30
-bb2:
31
- predecessor blocks: bb0
32
- [4] Call mutate a$4_@0.push(read props$3.c)
33
- [5] Goto bb1
34
-bb1:
35
- predecessor blocks: bb0 bb2
36
- [6] Call mutate a$4_@0.push(read props$3.d)
37
- [7] Return freeze a$4_@0
38
-```
39
-
40
-## Reactive Scopes
41
-
42
-```
43
-function Component(
44
- props,
45
-) {
46
- [1] Const mutate a$4_@0[1:7] = Array []
47
- [2] Call mutate a$4_@0.push(read props$3.a)
48
- if (read props$3.b) {
49
- [6] Call mutate a$4_@0.push(read props$3.d)
50
- return freeze a$4_@0
51
- }
52
- [4] Call mutate a$4_@0.push(read props$3.c)
53
-}
54
-
55
-```
56
-
23
## Code
24
25
```javascript
compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md
-25
@@ -11,31 +11,6 @@ function f() {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$4:TPrimitive = 1
19
- [2] Const mutate x$0$5:TPrimitive = 2
20
- [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive
21
- [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive
22
- [5] Return read $7:TPrimitive
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function f(
29
-) {
30
- [1] Const mutate x$4:TPrimitive = 1
31
- [2] Const mutate x$0$5:TPrimitive = 2
32
- [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive
33
- [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive
34
- return read $7:TPrimitive
35
-}
36
-
37
-```
38
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md
-29
@@ -13,35 +13,6 @@ function component() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate z$5_@0[1:7] = Array []
21
- [2] Const mutate y$6_@0:TObject[1:7] = Object { }
22
- [3] Reassign store y$6_@0.z[1:7] = read z$5_@0
23
- [4] Const mutate x$7_@0:TObject[1:7] = Object { }
24
- [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject
25
- [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z)
26
- [7] Return
27
-```
28
-
29
-## Reactive Scopes
30
-
31
-```
32
-function component(
33
-) {
34
- [1] Const mutate z$5_@0[1:7] = Array []
35
- [2] Const mutate y$6_@0:TObject[1:7] = Object { }
36
- [3] Reassign store y$6_@0.z[1:7] = read z$5_@0
37
- [4] Const mutate x$7_@0:TObject[1:7] = Object { }
38
- [5] Reassign store x$7_@0.y[1:7] = read y$6_@0:TObject
39
- [6] Call mutate mutate$4:TFunction(mutate x$7_@0.y.z)
40
- return
41
-}
42
-
43
-```
44
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md
-33
@@ -13,39 +13,6 @@ function component() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate z$4_@0 = Array []
21
- [2] Const mutate y$5_@1:TObject[2:4] = Object { }
22
- [3] Reassign store y$5_@1.z[2:4] = read z$4_@0
23
- [4] Const mutate x$6_@2:TObject[4:6] = Object { }
24
- [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject
25
- [6] Return freeze x$6_@2:TObject
26
-```
27
-
28
-## Reactive Scopes
29
-
30
-```
31
-function component(
32
-) {
33
- scope @0 [1:2] deps=[] out=[z$4_@0] {
34
- [1] Const mutate z$4_@0 = Array []
35
- }
36
- scope @1 [2:4] deps=[read z$4_@0] out=[y$5_@1] {
37
- [2] Const mutate y$5_@1:TObject[2:4] = Object { }
38
- [3] Reassign store y$5_@1.z[2:4] = read z$4_@0
39
- }
40
- scope @2 [4:6] deps=[read y$5_@1:TObject] out=[x$6_@2] {
41
- [4] Const mutate x$6_@2:TObject[4:6] = Object { }
42
- [5] Reassign store x$6_@2.y[4:6] = read y$5_@1:TObject
43
- }
44
- return freeze x$6_@2:TObject
45
-}
46
-
47
-```
48
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
-74
@@ -23,61 +23,6 @@ function mutate(x, y) {}
23
24
```
25
26
-## HIR
27
-
28
-```
29
-bb0:
30
- [1] Let mutate a$8_@0:TObject[1:12] = Object { }
31
- [2] Let mutate b$9_@0:TObject[1:12] = Object { }
32
- [3] Let mutate c$10_@0:TObject[1:12] = Object { }
33
- [4] While test=bb1 loop=bb3 fallthrough=bb2
34
-bb1:
35
- predecessor blocks: bb0 bb3
36
- [5] If (read cond$7) then:bb3 else:bb2 fallthrough=bb2
37
-bb3:
38
- predecessor blocks: bb1
39
- [6] Const mutate z$13_@0[1:12] = read a$8_@0:TObject
40
- [7] Reassign mutate a$8_@0:TObject[1:12] = read b$9_@0:TObject
41
- [8] Reassign mutate b$9_@0:TObject[1:12] = read c$10_@0:TObject
42
- [9] Reassign mutate c$10_@0:TObject[1:12] = read z$13_@0
43
- [10] Call mutate mutate$6:TFunction(mutate a$8_@0:TObject, mutate b$9_@0:TObject)
44
- [11] Goto(Continue) bb1
45
-bb2:
46
- predecessor blocks: bb1
47
- [12] read a$8_@0:TObject
48
- [13] read b$9_@0:TObject
49
- [14] read c$10_@0:TObject
50
- [15] Return freeze a$8_@0:TObject
51
-```
52
-
53
-## Reactive Scopes
54
-
55
-```
56
-function foo(
57
- cond,
58
-) {
59
- scope @0 [1:12] deps=[read cond$7] out=[a$8_@0, b$9_@0, c$10_@0] {
60
- [1] Let mutate a$8_@0:TObject[1:12] = Object { }
61
- [2] Let mutate b$9_@0:TObject[1:12] = Object { }
62
- [3] Let mutate c$10_@0:TObject[1:12] = Object { }
63
- while (
64
- read cond$7
65
- ) {
66
- [6] Const mutate z$13_@0[1:12] = read a$8_@0:TObject
67
- [7] Reassign mutate a$8_@0:TObject[1:12] = read b$9_@0:TObject
68
- [8] Reassign mutate b$9_@0:TObject[1:12] = read c$10_@0:TObject
69
- [9] Reassign mutate c$10_@0:TObject[1:12] = read z$13_@0
70
- [10] Call mutate mutate$6:TFunction(mutate a$8_@0:TObject, mutate b$9_@0:TObject)
71
- }
72
- }
73
- [12] read a$8_@0:TObject
74
- [13] read b$9_@0:TObject
75
- [14] read c$10_@0:TObject
76
- return freeze a$8_@0:TObject
77
-}
78
-
79
-```
80
-
26
## Code
27
28
```javascript
@@ -117,25 +62,6 @@ function foo(cond) {
62
}
63
64
```
120
-## HIR
121
-
122
-```
123
-bb0:
124
- [1] Return
125
-```
126
-
127
-## Reactive Scopes
128
-
129
-```
130
-function mutate(
131
- x,
132
- y,
133
-) {
134
- return
135
-}
136
-
137
-```
138
-
65
## Code
66
67
```javascript
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
-59
@@ -16,37 +16,6 @@ function g(a) {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Const mutate x$5:TPrimitive = 1
24
- [2] Const mutate $6:TPrimitive = 1
25
- [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive
26
- [4] Const mutate $8:TPrimitive = 1
27
- [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive
28
- [6] Const mutate $10:TPrimitive = 1
29
- [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive
30
- [8] Return
31
-```
32
-
33
-## Reactive Scopes
34
-
35
-```
36
-function f(
37
-) {
38
- [1] Const mutate x$5:TPrimitive = 1
39
- [2] Const mutate $6:TPrimitive = 1
40
- [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive
41
- [4] Const mutate $8:TPrimitive = 1
42
- [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive
43
- [6] Const mutate $10:TPrimitive = 1
44
- [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive
45
- return
46
-}
47
-
48
-```
49
-
19
## Code
20
21
```javascript
@@ -58,34 +27,6 @@ function f() {
27
}
28
29
```
61
-## HIR
62
-
63
-```
64
-bb0:
65
- [1] Const mutate $6:TPrimitive = 1
66
- [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive
67
- [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive
68
- [4] Const mutate $8:TPrimitive = 2
69
- [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive
70
- [6] Return
71
-```
72
-
73
-## Reactive Scopes
74
-
75
-```
76
-function g(
77
- a,
78
-) {
79
- [1] Const mutate $6:TPrimitive = 1
80
- [2] Const mutate $7:TPrimitive = Binary read a$5_@0.b.c + read $6:TPrimitive
81
- [3] Reassign read a$5_@0.b.c[0:6] = read $7:TPrimitive
82
- [4] Const mutate $8:TPrimitive = 2
83
- [5] Reassign mutate a$5_@0.b.c[0:6] = Binary read a$5_@0.b.c * read $8:TPrimitive
84
- return
85
-}
86
-
87
-```
88
-
30
## Code
31
32
```javascript
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
-55
@@ -15,67 +15,12 @@ function Component(props) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
-) {
30
- return
31
-}
32
-
33
-```
34
-
18
## Code
19
20
```javascript
21
function foo() {}
22
23
```
41
-## HIR
42
-
43
-```
44
-bb0:
45
- [1] Const mutate a$10_@0[1:7] = Array []
46
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
47
- [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
48
- [4] Const mutate $12:TPrimitive = "div"
49
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
50
- [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
51
- [7] Const mutate $14:TPrimitive = "div"
52
- [8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
53
- [9] Return read t4$15_@2
54
-```
55
-
56
-## Reactive Scopes
57
-
58
-```
59
-function Component(
60
- props,
61
-) {
62
- scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
- [1] Const mutate a$10_@0[1:7] = Array []
64
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
- [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
66
- [4] Const mutate $12:TPrimitive = "div"
67
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
68
- [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
69
- }
70
- [7] Const mutate $14:TPrimitive = "div"
71
- scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] {
72
- [8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
73
- }
74
- return read $15_@2
75
-}
76
-
77
-```
78
-
24
## Code
25
26
```javascript
compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md
-44
@@ -14,50 +14,6 @@ function foo(a, b, c) {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] If (read a$4) then:bb3 else:bb1 fallthrough=bb1
22
-bb3:
23
- predecessor blocks: bb0
24
- [2] While test=bb4 loop=bb6 fallthrough=bb1
25
-bb4:
26
- predecessor blocks: bb3 bb7
27
- [3] If (read b$5) then:bb6 else:bb1 fallthrough=bb1
28
-bb6:
29
- predecessor blocks: bb4
30
- [4] If (read c$6) then:bb1 else:bb7 fallthrough=bb7
31
-bb7:
32
- predecessor blocks: bb6
33
- [5] Goto(Continue) bb4
34
-bb1:
35
- predecessor blocks: bb6 bb4 bb0
36
- [6] Return
37
-```
38
-
39
-## Reactive Scopes
40
-
41
-```
42
-function foo(
43
- a,
44
- b,
45
- c,
46
-) {
47
- if (read a$4) {
48
- while (
49
- read b$5
50
- ) {
51
- if (read c$6) {
52
- break
53
- }
54
- }
55
- }
56
- return
57
-}
58
-
59
-```
60
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
-140
@@ -31,146 +31,6 @@ function Component(props) {
31
32
```
33
34
-## HIR
35
-
36
-```
37
-bb0:
38
- [1] Const mutate items$30 = read props$29.items
39
- [2] Const mutate maxItems$31 = read props$29.maxItems
40
- [3] Const mutate renderedItems$32_@0[3:33] = Array []
41
- [4] Const mutate seen$33_@0[3:33] = New mutate Set$5()
42
- [5] Const mutate $34:TPrimitive = 0
43
- [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$7.max(read $34:TPrimitive, read maxItems$31)
44
- [7] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2
45
-bb3:
46
- predecessor blocks: bb0
47
- [8] Let mutate i$36_@0:TPrimitive[3:33] = 0
48
- [9] Goto bb1
49
-bb1:
50
- predecessor blocks: bb3 bb4
51
- [10] Const mutate $39:TPrimitive = Binary read i$36_@0:TPrimitive < read items$30.length
52
- [11] If (read $39:TPrimitive) then:bb5 else:bb2 fallthrough=bb2
53
-bb5:
54
- predecessor blocks: bb1
55
- [12] Const mutate item$40_@0:TPrimitive[3:33] = Call read items$30.at(read i$36_@0:TPrimitive)
56
- [13] Const mutate $41:TPrimitive = null
57
- [14] Const mutate $42:TPrimitive = Binary read item$40_@0:TPrimitive == read $41:TPrimitive
58
- [15] Let mutate $46_@0[3:33] = undefined
59
- [15] If (read $42:TPrimitive) then:bb10 else:bb11 fallthrough=bb9
60
-bb10:
61
- predecessor blocks: bb5
62
- [16] Const mutate $43:TPrimitive = read $42:TPrimitive
63
- [17] Reassign mutate $46_@0[3:33] = read $43:TPrimitive
64
- [17] Goto bb9
65
-bb11:
66
- predecessor blocks: bb5
67
- [18] Const mutate $45_@0[3:33] = Call mutate seen$33_@0.has(mutate item$40_@0:TPrimitive)
68
- [19] Reassign mutate $46_@0[3:33] = read $45_@0
69
- [19] Goto bb9
70
-bb9:
71
- predecessor blocks: bb10 bb11
72
- [20] If (read $46_@0) then:bb7 else:bb6 fallthrough=bb6
73
-bb7:
74
- predecessor blocks: bb9
75
- [21] Goto(Continue) bb4
76
-bb6:
77
- predecessor blocks: bb9
78
- [22] Call mutate seen$33_@0.add(mutate item$40_@0:TPrimitive)
79
- [23] Const mutate $49:TPrimitive = "div"
80
- [24] Const mutate $50_@4 = JSX <read $49:TPrimitive>{freeze item$40_@0:TPrimitive}</read $49:TPrimitive>
81
- [25] Call mutate renderedItems$32_@0.push(read $50_@4)
82
- [26] Const mutate $55:TPrimitive = Binary read renderedItems$32_@0.length >= read max$35_@2:TPrimitive
83
- [27] If (read $55:TPrimitive) then:bb2 else:bb12 fallthrough=bb12
84
-bb12:
85
- predecessor blocks: bb6
86
- [28] Goto(Continue) bb4
87
-bb4:
88
- predecessor blocks: bb7 bb12
89
- [29] Const mutate $56:TPrimitive = 1
90
- [30] Reassign mutate i$36_@0:TPrimitive[3:33] = Binary read i$36_@0:TPrimitive + read $56:TPrimitive
91
- [31] read i$36_@0:TPrimitive
92
- [32] Goto bb1
93
-bb2:
94
- predecessor blocks: bb6 bb1
95
- [33] Const mutate count$66 = read renderedItems$32_@0.length
96
- [34] Const mutate $67:TPrimitive = "div"
97
- [35] Const mutate $68:TPrimitive = "\n "
98
- [36] Const mutate $69:TPrimitive = "h1"
99
- [37] Const mutate $70:TPrimitive = " Items"
100
- [38] Const mutate t7$71_@5 = JSX <read $69:TPrimitive>{freeze count$66}{read $70:TPrimitive}</read $69:TPrimitive>
101
- [39] Const mutate $72:TPrimitive = "\n "
102
- [40] Const mutate $73:TPrimitive = "\n "
103
- [41] Const mutate t10$74_@6 = JSX <read $67:TPrimitive>{read $68:TPrimitive}{read t7$71_@5}{read $72:TPrimitive}{freeze renderedItems$32_@0}{read $73:TPrimitive}</read $67:TPrimitive>
104
- [42] Return read t10$74_@6
105
-```
106
-
107
-## Reactive Scopes
108
-
109
-```
110
-function Component(
111
- props,
112
-) {
113
- [1] Const mutate items$30 = read props$29.items
114
- [2] Const mutate maxItems$31 = read props$29.maxItems
115
- scope @0 [3:33] deps=[read maxItems$31, read items$30.length, read items$30] out=[renderedItems$32_@0] {
116
- [3] Const mutate renderedItems$32_@0[3:33] = Array []
117
- [4] Const mutate seen$33_@0[3:33] = New mutate Set$5()
118
- [5] Const mutate $34:TPrimitive = 0
119
- scope @2 [6:7] deps=[read maxItems$31] out=[max$35_@2] {
120
- [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$7.max(read $34:TPrimitive, read maxItems$31)
121
- }
122
- for (
123
- [8] Let mutate i$36_@0:TPrimitive[3:33] = 0
124
- ;
125
- [10] Const mutate $39:TPrimitive = Binary read i$36_@0:TPrimitive < read items$30.length
126
- read $39:TPrimitive
127
- ;
128
- [29] Const mutate $56:TPrimitive = 1
129
- [30] Reassign mutate i$36_@0:TPrimitive[3:33] = Binary read i$36_@0:TPrimitive + read $56:TPrimitive
130
- read i$36_@0:TPrimitive
131
- ) {
132
- [12] Const mutate item$40_@0:TPrimitive[3:33] = Call read items$30.at(read i$36_@0:TPrimitive)
133
- [13] Const mutate $41:TPrimitive = null
134
- [14] Const mutate $42:TPrimitive = Binary read item$40_@0:TPrimitive == read $41:TPrimitive
135
- [15] Let mutate $46_@0[3:33] = undefined
136
- if (read $42:TPrimitive) {
137
- [16] Const mutate $43:TPrimitive = read $42:TPrimitive
138
- [17] Reassign mutate $46_@0[3:33] = read $43:TPrimitive
139
- } else {
140
- [18] Const mutate $45_@0[3:33] = Call mutate seen$33_@0.has(mutate item$40_@0:TPrimitive)
141
- [19] Reassign mutate $46_@0[3:33] = read $45_@0
142
- }
143
- if (read $46_@0) {
144
- continue
145
- }
146
- [22] Call mutate seen$33_@0.add(mutate item$40_@0:TPrimitive)
147
- [23] Const mutate $49:TPrimitive = "div"
148
- [24] Const mutate $50_@4 = JSX <read $49:TPrimitive>{freeze item$40_@0:TPrimitive}</read $49:TPrimitive>
149
- [25] Call mutate renderedItems$32_@0.push(read $50_@4)
150
- [26] Const mutate $55:TPrimitive = Binary read renderedItems$32_@0.length >= read max$35_@2:TPrimitive
151
- if (read $55:TPrimitive) {
152
- break
153
- }
154
- }
155
- }
156
- [33] Const mutate count$66 = read renderedItems$32_@0.length
157
- [34] Const mutate $67:TPrimitive = "div"
158
- [35] Const mutate $68:TPrimitive = "\n "
159
- [36] Const mutate $69:TPrimitive = "h1"
160
- [37] Const mutate $70:TPrimitive = " Items"
161
- scope @5 [38:39] deps=[freeze count$66] out=[$71_@5] {
162
- [38] Const mutate $71_@5 = JSX <read $69:TPrimitive>{freeze count$66}{read $70:TPrimitive}</read $69:TPrimitive>
163
- }
164
- [39] Const mutate $72:TPrimitive = "\n "
165
- [40] Const mutate $73:TPrimitive = "\n "
166
- scope @6 [41:42] deps=[read $71_@5, freeze renderedItems$32_@0] out=[$74_@6] {
167
- [41] Const mutate $74_@6 = JSX <read $67:TPrimitive>{read $68:TPrimitive}{read $71_@5}{read $72:TPrimitive}{freeze renderedItems$32_@0}{read $73:TPrimitive}</read $67:TPrimitive>
168
- }
169
- return read $74_@6
170
-}
171
-
172
-```
173
-
34
## Code
35
36
```javascript
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
-183
@@ -74,43 +74,6 @@ function Component(props) {
74
75
```
76
77
-## HIR
78
-
79
-```
80
-bb0:
81
- [1] Const mutate a_DEBUG$5_@0[1:7] = Array []
82
- [2] Call mutate a_DEBUG$5_@0.push(read props$4.a)
83
- [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1
84
-bb2:
85
- predecessor blocks: bb0
86
- [4] Const mutate $6:TPrimitive = null
87
- [5] Return read $6:TPrimitive
88
-bb1:
89
- predecessor blocks: bb0
90
- [6] Call mutate a_DEBUG$5_@0.push(read props$4.d)
91
- [7] Return freeze a_DEBUG$5_@0
92
-```
93
-
94
-## Reactive Scopes
95
-
96
-```
97
-function Component(
98
- props,
99
-) {
100
- scope @0 [1:7] deps=[read props$4.a, read props$4.b, read props$4.d] out=[a_DEBUG$5_@0] {
101
- [1] Const mutate a_DEBUG$5_@0[1:7] = Array []
102
- [2] Call mutate a_DEBUG$5_@0.push(read props$4.a)
103
- if (read props$4.b) {
104
- [4] Const mutate $6:TPrimitive = null
105
- return read $6:TPrimitive
106
- }
107
- [6] Call mutate a_DEBUG$5_@0.push(read props$4.d)
108
- }
109
- return freeze a_DEBUG$5_@0
110
-}
111
-
112
-```
113
-
77
## Code
78
79
```javascript
@@ -141,42 +104,6 @@ function Component(props) {
104
}
105
106
```
144
-## HIR
145
-
146
-```
147
-bb0:
148
- [1] Const mutate a$4_@0[1:7] = Array []
149
- [2] Call mutate a$4_@0.push(read props$3.a)
150
- [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1
151
-bb2:
152
- predecessor blocks: bb0
153
- [4] Call mutate a$4_@0.push(read props$3.c)
154
- [5] Goto bb1
155
-bb1:
156
- predecessor blocks: bb2 bb0
157
- [6] Call mutate a$4_@0.push(read props$3.d)
158
- [7] Return freeze a$4_@0
159
-```
160
-
161
-## Reactive Scopes
162
-
163
-```
164
-function Component(
165
- props,
166
-) {
167
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] {
168
- [1] Const mutate a$4_@0[1:7] = Array []
169
- [2] Call mutate a$4_@0.push(read props$3.a)
170
- if (read props$3.b) {
171
- [4] Call mutate a$4_@0.push(read props$3.c)
172
- }
173
- [6] Call mutate a$4_@0.push(read props$3.d)
174
- }
175
- return freeze a$4_@0
176
-}
177
-
178
-```
179
-
107
## Code
108
109
```javascript
@@ -209,45 +136,6 @@ function Component(props) {
136
}
137
138
```
212
-## HIR
213
-
214
-```
215
-bb0:
216
- [1] Const mutate a$5_@0[1:8] = Array []
217
- [2] Call mutate a$5_@0.push(read props$4.a)
218
- [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1
219
-bb2:
220
- predecessor blocks: bb0
221
- [4] Call mutate a$5_@0.push(read props$4.c)
222
- [5] Const mutate $6:TPrimitive = null
223
- [6] Return read $6:TPrimitive
224
-bb1:
225
- predecessor blocks: bb0
226
- [7] Call mutate a$5_@0.push(read props$4.d)
227
- [8] Return freeze a$5_@0
228
-```
229
-
230
-## Reactive Scopes
231
-
232
-```
233
-function Component(
234
- props,
235
-) {
236
- scope @0 [1:8] deps=[read props$4.a, read props$4.b, read props$4.c, read props$4.d] out=[a$5_@0] {
237
- [1] Const mutate a$5_@0[1:8] = Array []
238
- [2] Call mutate a$5_@0.push(read props$4.a)
239
- if (read props$4.b) {
240
- [4] Call mutate a$5_@0.push(read props$4.c)
241
- [5] Const mutate $6:TPrimitive = null
242
- return read $6:TPrimitive
243
- }
244
- [7] Call mutate a$5_@0.push(read props$4.d)
245
- }
246
- return freeze a$5_@0
247
-}
248
-
249
-```
250
-
139
## Code
140
141
```javascript
@@ -281,43 +169,6 @@ function Component(props) {
169
}
170
171
```
284
-## HIR
285
-
286
-```
287
-bb0:
288
- [1] Const mutate a$4_@0[1:7] = Array []
289
- [2] Call mutate a$4_@0.push(read props$3.a)
290
- [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1
291
-bb2:
292
- predecessor blocks: bb0
293
- [4] Call mutate a$4_@0.push(read props$3.c)
294
- [5] Return freeze a$4_@0
295
-bb1:
296
- predecessor blocks: bb0
297
- [6] Call mutate a$4_@0.push(read props$3.d)
298
- [7] Return freeze a$4_@0
299
-```
300
-
301
-## Reactive Scopes
302
-
303
-```
304
-function Component(
305
- props,
306
-) {
307
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] {
308
- [1] Const mutate a$4_@0[1:7] = Array []
309
- [2] Call mutate a$4_@0.push(read props$3.a)
310
- if (read props$3.b) {
311
- [4] Call mutate a$4_@0.push(read props$3.c)
312
- return freeze a$4_@0
313
- }
314
- [6] Call mutate a$4_@0.push(read props$3.d)
315
- }
316
- return freeze a$4_@0
317
-}
318
-
319
-```
320
-
172
## Code
173
174
```javascript
@@ -351,40 +202,6 @@ function Component(props) {
202
}
203
204
```
354
-## HIR
355
-
356
-```
357
-bb0:
358
- [1] Const mutate a$4_@0[1:7] = Array []
359
- [2] Call mutate a$4_@0.push(read props$3.a)
360
- [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2
361
-bb2:
362
- predecessor blocks: bb0
363
- [4] Call mutate a$4_@0.push(read props$3.c)
364
- [5] Goto bb1
365
-bb1:
366
- predecessor blocks: bb0 bb2
367
- [6] Call mutate a$4_@0.push(read props$3.d)
368
- [7] Return freeze a$4_@0
369
-```
370
-
371
-## Reactive Scopes
372
-
373
-```
374
-function Component(
375
- props,
376
-) {
377
- [1] Const mutate a$4_@0[1:7] = Array []
378
- [2] Call mutate a$4_@0.push(read props$3.a)
379
- if (read props$3.b) {
380
- [6] Call mutate a$4_@0.push(read props$3.d)
381
- return freeze a$4_@0
382
- }
383
- [4] Call mutate a$4_@0.push(read props$3.c)
384
-}
385
-
386
-```
387
-
205
## Code
206
207
```javascript
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
-132
@@ -31,54 +31,6 @@ function mayMutate() {}
31
32
```
33
34
-## HIR
35
-
36
-```
37
-bb0:
38
- [1] Const mutate a$7_@0[1:9] = Array []
39
- [2] Const mutate b$8_@0[1:9] = Array []
40
- [3] If (read b$8_@0) then:bb2 else:bb1 fallthrough=bb1
41
-bb2:
42
- predecessor blocks: bb0
43
- [4] Call mutate a$7_@0.push(read props$6.p0)
44
- [5] Goto bb1
45
-bb1:
46
- predecessor blocks: bb2 bb0
47
- [6] If (read props$6.p1) then:bb4 else:bb3 fallthrough=bb3
48
-bb4:
49
- predecessor blocks: bb1
50
- [7] Call mutate b$8_@0.push(read props$6.p2)
51
- [8] Goto bb3
52
-bb3:
53
- predecessor blocks: bb4 bb1
54
- [9] Const mutate t6$16_@2 = JSX <read Foo$4 a={freeze a$7_@0} b={freeze b$8_@0} ></read Foo$4>
55
- [10] Return read t6$16_@2
56
-```
57
-
58
-## Reactive Scopes
59
-
60
-```
61
-function Component(
62
- props,
63
-) {
64
- scope @0 [1:9] deps=[read props$6.p0, read props$6.p1, read props$6.p2] out=[a$7_@0] {
65
- [1] Const mutate a$7_@0[1:9] = Array []
66
- [2] Const mutate b$8_@0[1:9] = Array []
67
- if (read b$8_@0) {
68
- [4] Call mutate a$7_@0.push(read props$6.p0)
69
- }
70
- if (read props$6.p1) {
71
- [7] Call mutate b$8_@0.push(read props$6.p2)
72
- }
73
- }
74
- scope @2 [9:10] deps=[freeze a$7_@0, freeze b$8_@0] out=[$16_@2] {
75
- [9] Const mutate $16_@2 = JSX <read Foo$4 a={freeze a$7_@0} b={freeze b$8_@0} ></read Foo$4>
76
- }
77
- return read $16_@2
78
-}
79
-
80
-```
81
-
34
## Code
35
36
```javascript
@@ -125,56 +77,6 @@ function Component(props) {
77
}
78
79
```
128
-## HIR
129
-
130
-```
131
-bb0:
132
- [1] Const mutate a$9_@0[1:10] = Array []
133
- [2] Const mutate b$10_@0[1:10] = Array []
134
- [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0)
135
- [4] If (read $11_@0) then:bb2 else:bb1 fallthrough=bb1
136
-bb2:
137
- predecessor blocks: bb0
138
- [5] Call mutate a$9_@0.push(read props$8.p0)
139
- [6] Goto bb1
140
-bb1:
141
- predecessor blocks: bb2 bb0
142
- [7] If (read props$8.p1) then:bb4 else:bb3 fallthrough=bb3
143
-bb4:
144
- predecessor blocks: bb1
145
- [8] Call mutate b$10_@0.push(read props$8.p2)
146
- [9] Goto bb3
147
-bb3:
148
- predecessor blocks: bb4 bb1
149
- [10] Const mutate t6$19_@2 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
150
- [11] Return read t6$19_@2
151
-```
152
-
153
-## Reactive Scopes
154
-
155
-```
156
-function Component(
157
- props,
158
-) {
159
- scope @0 [1:10] deps=[read props$8.p0, read props$8.p1, read props$8.p2] out=[a$9_@0] {
160
- [1] Const mutate a$9_@0[1:10] = Array []
161
- [2] Const mutate b$10_@0[1:10] = Array []
162
- [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0)
163
- if (read $11_@0) {
164
- [5] Call mutate a$9_@0.push(read props$8.p0)
165
- }
166
- if (read props$8.p1) {
167
- [8] Call mutate b$10_@0.push(read props$8.p2)
168
- }
169
- }
170
- scope @2 [10:11] deps=[freeze a$9_@0, freeze b$10_@0] out=[$19_@2] {
171
- [10] Const mutate $19_@2 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
172
- }
173
- return read $19_@2
174
-}
175
-
176
-```
177
-
80
## Code
81
82
```javascript
@@ -221,46 +123,12 @@ function Component(props) {
123
}
124
125
```
224
-## HIR
225
-
226
-```
227
-bb0:
228
- [1] Return
229
-```
230
-
231
-## Reactive Scopes
232
-
233
-```
234
-function Foo(
235
-) {
236
- return
237
-}
238
-
239
-```
240
-
126
## Code
127
128
```javascript
129
function Foo() {}
130
131
```
247
-## HIR
248
-
249
-```
250
-bb0:
251
- [1] Return
252
-```
253
-
254
-## Reactive Scopes
255
-
256
-```
257
-function mayMutate(
258
-) {
259
- return
260
-}
261
-
262
-```
263
-
132
## Code
133
134
```javascript
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
-55
@@ -15,67 +15,12 @@ function Component(props) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function Foo(
29
-) {
30
- return
31
-}
32
-
33
-```
34
-
18
## Code
19
20
```javascript
21
function Foo() {}
22
23
```
41
-## HIR
42
-
43
-```
44
-bb0:
45
- [1] Const mutate a$10_@0[1:7] = Array []
46
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
47
- [3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject)
48
- [4] Const mutate $12:TPrimitive = "div"
49
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
50
- [6] New mutate Foo$4(mutate b$11_@0:TObject)
51
- [7] Const mutate $14:TPrimitive = "div"
52
- [8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
53
- [9] Return read t4$15_@2
54
-```
55
-
56
-## Reactive Scopes
57
-
58
-```
59
-function Component(
60
- props,
61
-) {
62
- scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
- [1] Const mutate a$10_@0[1:7] = Array []
64
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
- [3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject)
66
- [4] Const mutate $12:TPrimitive = "div"
67
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
68
- [6] New mutate Foo$4(mutate b$11_@0:TObject)
69
- }
70
- [7] Const mutate $14:TPrimitive = "div"
71
- scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] {
72
- [8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
73
- }
74
- return read $15_@2
75
-}
76
-
77
-```
78
-
24
## Code
25
26
```javascript
compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md
-51
@@ -18,57 +18,6 @@ function foo(a, b) {
18
19
```
20
21
-## HIR
22
-
23
-```
24
-bb0:
25
- [1] Const mutate x$8_@0[1:3] = Array []
26
- [2] Call mutate x$8_@0.push(read a$6)
27
- [3] Const mutate $9:TPrimitive = "div"
28
- [4] JSX <read $9:TPrimitive>{freeze x$8_@0}</read $9:TPrimitive>
29
- [5] Const mutate y$10_@1[5:12] = Array []
30
- [6] If (read x$8_@0.length) then:bb2 else:bb1 fallthrough=bb1
31
-bb2:
32
- predecessor blocks: bb0
33
- [7] Call mutate y$10_@1.push(read x$8_@0)
34
- [8] Goto bb1
35
-bb1:
36
- predecessor blocks: bb2 bb0
37
- [9] If (read b$7) then:bb4 else:bb3 fallthrough=bb3
38
-bb4:
39
- predecessor blocks: bb1
40
- [10] Call mutate y$10_@1.push(read b$7)
41
- [11] Goto bb3
42
-bb3:
43
- predecessor blocks: bb4 bb1
44
- [12] Return
45
-```
46
-
47
-## Reactive Scopes
48
-
49
-```
50
-function foo(
51
- a,
52
- b,
53
-) {
54
- scope @0 [1:3] deps=[read a$6] out=[x$8_@0] {
55
- [1] Const mutate x$8_@0[1:3] = Array []
56
- [2] Call mutate x$8_@0.push(read a$6)
57
- }
58
- [3] Const mutate $9:TPrimitive = "div"
59
- [4] JSX <read $9:TPrimitive>{freeze x$8_@0}</read $9:TPrimitive>
60
- [5] Const mutate y$10_@1[5:12] = Array []
61
- if (read x$8_@0.length) {
62
- [7] Call mutate y$10_@1.push(read x$8_@0)
63
- }
64
- if (read b$7) {
65
- [10] Call mutate y$10_@1.push(read b$7)
66
- }
67
- return
68
-}
69
-
70
-```
71
-
21
## Code
22
23
```javascript
compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md
-48
@@ -20,54 +20,6 @@ function foo(x, y, z) {
20
21
```
22
23
-## HIR
24
-
25
-```
26
-bb0:
27
- [1] Const mutate items$9_@0[1:10] = Array [read z$8]
28
- [2] Call mutate items$9_@0.push(read x$6)
29
- [3] Const mutate items2$10_@1[3:7] = Array []
30
- [4] If (read x$6) then:bb2 else:bb1 fallthrough=bb1
31
-bb2:
32
- predecessor blocks: bb0
33
- [5] Call mutate items2$10_@1.push(read y$7)
34
- [6] Goto bb1
35
-bb1:
36
- predecessor blocks: bb2 bb0
37
- [7] If (read y$7) then:bb4 else:bb3 fallthrough=bb3
38
-bb4:
39
- predecessor blocks: bb1
40
- [8] Call mutate items$9_@0.push(read x$6)
41
- [9] Goto bb3
42
-bb3:
43
- predecessor blocks: bb4 bb1
44
- [10] Return freeze items2$10_@1
45
-```
46
-
47
-## Reactive Scopes
48
-
49
-```
50
-function foo(
51
- x,
52
- y,
53
- z,
54
-) {
55
- [1] Const mutate items$9_@0[1:10] = Array [read z$8]
56
- [2] Call mutate items$9_@0.push(read x$6)
57
- scope @1 [3:7] deps=[read x$6, read y$7] out=[items2$10_@1] {
58
- [3] Const mutate items2$10_@1[3:7] = Array []
59
- if (read x$6) {
60
- [5] Call mutate items2$10_@1.push(read y$7)
61
- }
62
- }
63
- if (read y$7) {
64
- [8] Call mutate items$9_@0.push(read x$6)
65
- }
66
- return freeze items2$10_@1
67
-}
68
-
69
-```
70
-
23
## Code
24
25
```javascript
compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md
-55
@@ -19,61 +19,6 @@ function foo(a, b, c) {
19
20
```
21
22
-## HIR
23
-
24
-```
25
-bb0:
26
- [1] Const mutate x$10_@0[1:8] = Array []
27
- [2] If (read a$7) then:bb2 else:bb1 fallthrough=bb1
28
-bb2:
29
- predecessor blocks: bb0
30
- [3] If (read b$8) then:bb4 else:bb1 fallthrough=bb1
31
-bb4:
32
- predecessor blocks: bb2
33
- [4] If (read c$9) then:bb6 else:bb1 fallthrough=bb1
34
-bb6:
35
- predecessor blocks: bb4
36
- [5] Const mutate $11:TPrimitive = 0
37
- [6] Call mutate x$10_@0.push(read $11:TPrimitive)
38
- [7] Goto bb1
39
-bb1:
40
- predecessor blocks: bb6 bb4 bb2 bb0
41
- [8] If (read a$7.length) then:bb8 else:bb7 fallthrough=bb7
42
-bb8:
43
- predecessor blocks: bb1
44
- [9] Return read a$7
45
-bb7:
46
- predecessor blocks: bb1
47
- [10] Const mutate $13:TPrimitive = null
48
- [11] Return read $13:TPrimitive
49
-```
50
-
51
-## Reactive Scopes
52
-
53
-```
54
-function foo(
55
- a,
56
- b,
57
- c,
58
-) {
59
- [1] Const mutate x$10_@0[1:8] = Array []
60
- if (read a$7) {
61
- if (read b$8) {
62
- if (read c$9) {
63
- [5] Const mutate $11:TPrimitive = 0
64
- [6] Call mutate x$10_@0.push(read $11:TPrimitive)
65
- }
66
- }
67
- }
68
- if (read a$7.length) {
69
- return read a$7
70
- }
71
- [10] Const mutate $13:TPrimitive = null
72
- return read $13:TPrimitive
73
-}
74
-
75
-```
76
-
22
## Code
23
24
```javascript
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
-62
@@ -14,33 +14,6 @@ function foo(x) {}
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate a$5_@0 = Array []
22
- [2] Const mutate b$6 = read a$5_@0
23
- [3] Call read useFreeze$3:TFunction(freeze a$5_@0)
24
- [4] Call mutate foo$4:TFunction(read b$6)
25
- [5] Return
26
-```
27
-
28
-## Reactive Scopes
29
-
30
-```
31
-function Component(
32
-) {
33
- scope @0 [1:2] deps=[] out=[a$5_@0] {
34
- [1] Const mutate a$5_@0 = Array []
35
- }
36
- [2] Const mutate b$6 = read a$5_@0
37
- [3] Call read useFreeze$3:TFunction(freeze a$5_@0)
38
- [4] Call mutate foo$4:TFunction(read b$6)
39
- return
40
-}
41
-
42
-```
43
-
17
## Code
18
19
```javascript
@@ -60,47 +33,12 @@ function Component() {
33
}
34
35
```
63
-## HIR
64
-
65
-```
66
-bb0:
67
- [1] Return
68
-```
69
-
70
-## Reactive Scopes
71
-
72
-```
73
-function useFreeze(
74
-) {
75
- return
76
-}
77
-
78
-```
79
-
36
## Code
37
38
```javascript
39
function useFreeze() {}
40
41
```
86
-## HIR
87
-
88
-```
89
-bb0:
90
- [1] Return
91
-```
92
-
93
-## Reactive Scopes
94
-
95
-```
96
-function foo(
97
- x,
98
-) {
99
- return
100
-}
101
-
102
-```
103
-
42
## Code
43
44
```javascript
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
-72
@@ -19,90 +19,18 @@ function Component(props) {
19
20
```
21
22
-## HIR
23
-
24
-```
25
-bb0:
26
- [1] Return
27
-```
28
-
29
-## Reactive Scopes
30
-
31
-```
32
-function useFreeze(
33
-) {
34
- return
35
-}
36
-
37
-```
38
-
22
## Code
23
24
```javascript
25
function useFreeze() {}
26
27
```
45
-## HIR
46
-
47
-```
48
-bb0:
49
- [1] Return
50
-```
51
-
52
-## Reactive Scopes
53
-
54
-```
55
-function foo(
56
-) {
57
- return
58
-}
59
-
60
-```
61
-
28
## Code
29
30
```javascript
31
function foo() {}
32
33
```
68
-## HIR
69
-
70
-```
71
-bb0:
72
- [1] Const mutate x$11_@0 = Array []
73
- [2] Const mutate y$12_@1 = Call read useFreeze$3:TFunction(freeze x$11_@0)
74
- [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0)
75
- [4] Const mutate $13:TPrimitive = "\n "
76
- [5] Const mutate $14:TPrimitive = "\n "
77
- [6] Const mutate $15:TPrimitive = "\n "
78
- [7] Const mutate t5$16_@2 = JSX <read Component$0>{read $13:TPrimitive}{read x$11_@0}{read $14:TPrimitive}{read y$12_@1}{read $15:TPrimitive}</read Component$0>
79
- [8] Return read t5$16_@2
80
-```
81
-
82
-## Reactive Scopes
83
-
84
-```
85
-function Component(
86
- props,
87
-) {
88
- scope @0 [1:2] deps=[] out=[x$11_@0] {
89
- [1] Const mutate x$11_@0 = Array []
90
- }
91
- scope @1 [2:3] deps=[freeze x$11_@0] out=[y$12_@1] {
92
- [2] Const mutate y$12_@1 = Call read useFreeze$3:TFunction(freeze x$11_@0)
93
- }
94
- [3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0)
95
- [4] Const mutate $13:TPrimitive = "\n "
96
- [5] Const mutate $14:TPrimitive = "\n "
97
- [6] Const mutate $15:TPrimitive = "\n "
98
- scope @2 [7:8] deps=[read x$11_@0, read y$12_@1] out=[$16_@2] {
99
- [7] Const mutate $16_@2 = JSX <read Component$0>{read $13:TPrimitive}{read x$11_@0}{read $14:TPrimitive}{read y$12_@1}{read $15:TPrimitive}</read Component$0>
100
- }
101
- return read $16_@2
102
-}
103
-
104
-```
105
-
34
## Code
35
36
```javascript
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
-63
@@ -15,33 +15,6 @@ function call(x) {}
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate a$4_@0 = Array []
23
- [2] Call read useFreeze$2:TFunction(freeze a$4_@0)
24
- [3] Call read useFreeze$2:TFunction(read a$4_@0)
25
- [4] Call mutate call$3:TFunction(read a$4_@0)
26
- [5] Return read a$4_@0
27
-```
28
-
29
-## Reactive Scopes
30
-
31
-```
32
-function Component(
33
-) {
34
- scope @0 [1:2] deps=[] out=[a$4_@0] {
35
- [1] Const mutate a$4_@0 = Array []
36
- }
37
- [2] Call read useFreeze$2:TFunction(freeze a$4_@0)
38
- [3] Call read useFreeze$2:TFunction(read a$4_@0)
39
- [4] Call mutate call$3:TFunction(read a$4_@0)
40
- return read a$4_@0
41
-}
42
-
43
-```
44
-
18
## Code
19
20
```javascript
@@ -62,48 +35,12 @@ function Component() {
35
}
36
37
```
65
-## HIR
66
-
67
-```
68
-bb0:
69
- [1] Return
70
-```
71
-
72
-## Reactive Scopes
73
-
74
-```
75
-function useFreeze(
76
- x,
77
-) {
78
- return
79
-}
80
-
81
-```
82
-
38
## Code
39
40
```javascript
41
function useFreeze(x) {}
42
43
```
89
-## HIR
90
-
91
-```
92
-bb0:
93
- [1] Return
94
-```
95
-
96
-## Reactive Scopes
97
-
98
-```
99
-function call(
100
- x,
101
-) {
102
- return
103
-}
104
-
105
-```
106
-
44
## Code
45
46
```javascript
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
-92
@@ -22,62 +22,6 @@ function call(x) {}
22
23
```
24
25
-## HIR
26
-
27
-```
28
-bb0:
29
- [1] Const mutate cond$8 = read props$7.cond
30
- [2] Const mutate x$9 = read props$7.x
31
- [3] Const mutate a$10:TPrimitive = undefined
32
- [4] Let mutate a$0$14_@0[4:9] = undefined
33
- [4] If (read cond$8) then:bb2 else:bb3 fallthrough=bb1
34
-bb2:
35
- predecessor blocks: bb0
36
- [5] Const mutate a$1$11 = read x$9
37
- [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11
38
- [6] Goto bb1
39
-bb3:
40
- predecessor blocks: bb0
41
- [7] Const mutate a$2$12_@1 = Array []
42
- [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1
43
- [8] Goto bb1
44
-bb1:
45
- predecessor blocks: bb2 bb3
46
- [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0)
47
- [10] Call read useFreeze$5:TFunction(read a$0$14_@0)
48
- [11] Call mutate call$6:TFunction(read a$0$14_@0)
49
- [12] Return read a$0$14_@0
50
-```
51
-
52
-## Reactive Scopes
53
-
54
-```
55
-function Component(
56
- props,
57
-) {
58
- [1] Const mutate cond$8 = read props$7.cond
59
- [2] Const mutate x$9 = read props$7.x
60
- [3] Const mutate a$10:TPrimitive = undefined
61
- scope @0 [4:9] deps=[read cond$8, read x$9] out=[a$0$14_@0] {
62
- [4] Let mutate a$0$14_@0[4:9] = undefined
63
- if (read cond$8) {
64
- [5] Const mutate a$1$11 = read x$9
65
- [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11
66
- } else {
67
- scope @1 [7:8] deps=[] out=[a$2$12_@1] {
68
- [7] Const mutate a$2$12_@1 = Array []
69
- }
70
- [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1
71
- }
72
- }
73
- [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0)
74
- [10] Call read useFreeze$5:TFunction(read a$0$14_@0)
75
- [11] Call mutate call$6:TFunction(read a$0$14_@0)
76
- return read a$0$14_@0
77
-}
78
-
79
-```
80
-
25
## Code
26
27
```javascript
@@ -122,48 +66,12 @@ function Component(props) {
66
}
67
68
```
125
-## HIR
126
-
127
-```
128
-bb0:
129
- [1] Return
130
-```
131
-
132
-## Reactive Scopes
133
-
134
-```
135
-function useFreeze(
136
- x,
137
-) {
138
- return
139
-}
140
-
141
-```
142
-
69
## Code
70
71
```javascript
72
function useFreeze(x) {}
73
74
```
149
-## HIR
150
-
151
-```
152
-bb0:
153
- [1] Return
154
-```
155
-
156
-## Reactive Scopes
157
-
158
-```
159
-function call(
160
- x,
161
-) {
162
- return
163
-}
164
-
165
-```
166
-
75
## Code
76
77
```javascript
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
-108
@@ -33,138 +33,30 @@ function Component(props) {
33
34
```
35
36
-## HIR
37
-
38
-```
39
-bb0:
40
- [1] Return
41
-```
42
-
43
-## Reactive Scopes
44
-
45
-```
46
-function compute(
47
-) {
48
- return
49
-}
50
-
51
-```
52
-
36
## Code
37
38
```javascript
39
function compute() {}
40
41
```
59
-## HIR
60
-
61
-```
62
-bb0:
63
- [1] Return
64
-```
65
-
66
-## Reactive Scopes
67
-
68
-```
69
-function mutate(
70
-) {
71
- return
72
-}
73
-
74
-```
75
-
42
## Code
43
44
```javascript
45
function mutate() {}
46
47
```
82
-## HIR
83
-
84
-```
85
-bb0:
86
- [1] Return
87
-```
88
-
89
-## Reactive Scopes
90
-
91
-```
92
-function foo(
93
-) {
94
- return
95
-}
96
-
97
-```
98
-
48
## Code
49
50
```javascript
51
function foo() {}
52
53
```
105
-## HIR
106
-
107
-```
108
-bb0:
109
- [1] Return
110
-```
111
-
112
-## Reactive Scopes
113
-
114
-```
115
-function Foo(
116
-) {
117
- return
118
-}
119
-
120
-```
121
-
54
## Code
55
56
```javascript
57
function Foo() {}
58
59
```
128
-## HIR
129
-
130
-```
131
-bb0:
132
- [1] Const mutate a$9_@1[1:7] = Call mutate compute$2:TFunction(read props$8.a)
133
- [2] Const mutate b$10_@1[1:7] = Call mutate compute$2:TFunction(read props$8.b)
134
- [3] If (read props$8.c) then:bb2 else:bb1 fallthrough=bb1
135
-bb2:
136
- predecessor blocks: bb0
137
- [4] Call mutate mutate$5:TFunction(mutate a$9_@1)
138
- [5] Call mutate mutate$5:TFunction(mutate b$10_@1)
139
- [6] Goto bb1
140
-bb1:
141
- predecessor blocks: bb2 bb0
142
- [7] Const mutate t6$14_@2 = JSX <read Foo$6 a={freeze a$9_@1} b={freeze b$10_@1} ></read Foo$6>
143
- [8] Return read t6$14_@2
144
-```
145
-
146
-## Reactive Scopes
147
-
148
-```
149
-function Component(
150
- props,
151
-) {
152
- scope @1 [1:7] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@1] {
153
- [1] Const mutate a$9_@1[1:7] = Call mutate compute$2:TFunction(read props$8.a)
154
- [2] Const mutate b$10_@1[1:7] = Call mutate compute$2:TFunction(read props$8.b)
155
- if (read props$8.c) {
156
- [4] Call mutate mutate$5:TFunction(mutate a$9_@1)
157
- [5] Call mutate mutate$5:TFunction(mutate b$10_@1)
158
- }
159
- }
160
- scope @2 [7:8] deps=[freeze a$9_@1, freeze b$10_@1] out=[$14_@2] {
161
- [7] Const mutate $14_@2 = JSX <read Foo$6 a={freeze a$9_@1} b={freeze b$10_@1} ></read Foo$6>
162
- }
163
- return read $14_@2
164
-}
165
-
166
-```
167
-
60
## Code
61
62
```javascript
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
-81
@@ -24,36 +24,6 @@ function Foo() {}
24
25
```
26
27
-## HIR
28
-
29
-```
30
-bb0:
31
- [1] Const mutate a$8_@0 = Call mutate compute$2:TFunction(read props$7.a)
32
- [2] Const mutate b$9_@1 = Call mutate compute$2:TFunction(read props$7.b)
33
- [3] Const mutate t6$10_@2 = JSX <read Foo$5 a={freeze a$8_@0} b={freeze b$9_@1} ></read Foo$5>
34
- [4] Return read t6$10_@2
35
-```
36
-
37
-## Reactive Scopes
38
-
39
-```
40
-function Component(
41
- props,
42
-) {
43
- scope @0 [1:2] deps=[read props$7.a] out=[a$8_@0] {
44
- [1] Const mutate a$8_@0 = Call mutate compute$2:TFunction(read props$7.a)
45
- }
46
- scope @1 [2:3] deps=[read props$7.b] out=[b$9_@1] {
47
- [2] Const mutate b$9_@1 = Call mutate compute$2:TFunction(read props$7.b)
48
- }
49
- scope @2 [3:4] deps=[freeze a$8_@0, freeze b$9_@1] out=[$10_@2] {
50
- [3] Const mutate $10_@2 = JSX <read Foo$5 a={freeze a$8_@0} b={freeze b$9_@1} ></read Foo$5>
51
- }
52
- return read $10_@2
53
-}
54
-
55
-```
56
-
27
## Code
28
29
```javascript
@@ -97,69 +67,18 @@ function Component(props) {
67
}
68
69
```
100
-## HIR
101
-
102
-```
103
-bb0:
104
- [1] Return
105
-```
106
-
107
-## Reactive Scopes
108
-
109
-```
110
-function compute(
111
-) {
112
- return
113
-}
114
-
115
-```
116
-
70
## Code
71
72
```javascript
73
function compute() {}
74
75
```
123
-## HIR
124
-
125
-```
126
-bb0:
127
- [1] Return
128
-```
129
-
130
-## Reactive Scopes
131
-
132
-```
133
-function foo(
134
-) {
135
- return
136
-}
137
-
138
-```
139
-
76
## Code
77
78
```javascript
79
function foo() {}
80
81
```
146
-## HIR
147
-
148
-```
149
-bb0:
150
- [1] Return
151
-```
152
-
153
-## Reactive Scopes
154
-
155
-```
156
-function Foo(
157
-) {
158
- return
159
-}
160
-
161
-```
162
-
82
## Code
83
84
```javascript
compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md
-30
@@ -12,36 +12,6 @@ function foo(a, b, c) {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate x$9_@0:TObject[1:4] = Object { a: read a$6 }
20
- [2] Const mutate t6$10_@1 = Array [read b$7, read c$8]
21
- [3] Reassign store x$9_@0.y[1:4] = read t6$10_@1
22
- [4] Return freeze x$9_@0:TObject
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
- a,
30
- b,
31
- c,
32
-) {
33
- scope @0 [1:4] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] {
34
- [1] Const mutate x$9_@0:TObject[1:4] = Object { a: read a$6 }
35
- scope @1 [2:3] deps=[read b$7, read c$8] out=[$10_@1] {
36
- [2] Const mutate $10_@1 = Array [read b$7, read c$8]
37
- }
38
- [3] Reassign store x$9_@0.y[1:4] = read $10_@1
39
- }
40
- return freeze x$9_@0:TObject
41
-}
42
-
43
-```
44
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
-89
@@ -27,113 +27,24 @@ function Component(props) {
27
28
```
29
30
-## HIR
31
-
32
-```
33
-bb0:
34
- [1] Return
35
-```
36
-
37
-## Reactive Scopes
38
-
39
-```
40
-function compute(
41
-) {
42
- return
43
-}
44
-
45
-```
46
-
30
## Code
31
32
```javascript
33
function compute() {}
34
35
```
53
-## HIR
54
-
55
-```
56
-bb0:
57
- [1] Return
58
-```
59
-
60
-## Reactive Scopes
61
-
62
-```
63
-function foo(
64
-) {
65
- return
66
-}
67
-
68
-```
69
-
36
## Code
37
38
```javascript
39
function foo() {}
40
41
```
76
-## HIR
77
-
78
-```
79
-bb0:
80
- [1] Return
81
-```
82
-
83
-## Reactive Scopes
84
-
85
-```
86
-function Foo(
87
-) {
88
- return
89
-}
90
-
91
-```
92
-
42
## Code
43
44
```javascript
45
function Foo() {}
46
47
```
99
-## HIR
100
-
101
-```
102
-bb0:
103
- [1] Const mutate a$9_@0[1:6] = Call mutate compute$2:TFunction(read props$8.a)
104
- [2] Const mutate b$10_@0[1:6] = Call mutate compute$2:TFunction(read props$8.b)
105
- [3] If (read props$8.c) then:bb2 else:bb1 fallthrough=bb1
106
-bb2:
107
- predecessor blocks: bb0
108
- [4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
109
- [5] Goto bb1
110
-bb1:
111
- predecessor blocks: bb2 bb0
112
- [6] Const mutate t7$14_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
113
- [7] Return read t7$14_@1
114
-```
115
-
116
-## Reactive Scopes
117
-
118
-```
119
-function Component(
120
- props,
121
-) {
122
- scope @0 [1:6] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@0, b$10_@0] {
123
- [1] Const mutate a$9_@0[1:6] = Call mutate compute$2:TFunction(read props$8.a)
124
- [2] Const mutate b$10_@0[1:6] = Call mutate compute$2:TFunction(read props$8.b)
125
- if (read props$8.c) {
126
- [4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
127
- }
128
- }
129
- scope @1 [6:7] deps=[freeze a$9_@0, freeze b$10_@0] out=[$14_@1] {
130
- [6] Const mutate $14_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
131
- }
132
- return read $14_@1
133
-}
134
-
135
-```
136
-
48
## Code
49
50
```javascript
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
-81
@@ -24,36 +24,6 @@ function Foo() {}
24
25
```
26
27
-## HIR
28
-
29
-```
30
-bb0:
31
- [1] Const mutate a$9_@0[1:4] = Call mutate compute$2:TFunction(read props$8.a)
32
- [2] Const mutate b$10_@0[1:4] = Call mutate compute$2:TFunction(read props$8.b)
33
- [3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
34
- [4] Const mutate t6$11_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
35
- [5] Return read t6$11_@1
36
-```
37
-
38
-## Reactive Scopes
39
-
40
-```
41
-function Component(
42
- props,
43
-) {
44
- scope @0 [1:4] deps=[read props$8.a, read props$8.b] out=[a$9_@0, b$10_@0] {
45
- [1] Const mutate a$9_@0[1:4] = Call mutate compute$2:TFunction(read props$8.a)
46
- [2] Const mutate b$10_@0[1:4] = Call mutate compute$2:TFunction(read props$8.b)
47
- [3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
48
- }
49
- scope @1 [4:5] deps=[freeze a$9_@0, freeze b$10_@0] out=[$11_@1] {
50
- [4] Const mutate $11_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
51
- }
52
- return read $11_@1
53
-}
54
-
55
-```
56
-
27
## Code
28
29
```javascript
@@ -93,69 +63,18 @@ function Component(props) {
63
}
64
65
```
96
-## HIR
97
-
98
-```
99
-bb0:
100
- [1] Return
101
-```
102
-
103
-## Reactive Scopes
104
-
105
-```
106
-function compute(
107
-) {
108
- return
109
-}
110
-
111
-```
112
-
66
## Code
67
68
```javascript
69
function compute() {}
70
71
```
119
-## HIR
120
-
121
-```
122
-bb0:
123
- [1] Return
124
-```
125
-
126
-## Reactive Scopes
127
-
128
-```
129
-function foo(
130
-) {
131
- return
132
-}
133
-
134
-```
135
-
72
## Code
73
74
```javascript
75
function foo() {}
76
77
```
142
-## HIR
143
-
144
-```
145
-bb0:
146
- [1] Return
147
-```
148
-
149
-## Reactive Scopes
150
-
151
-```
152
-function Foo(
153
-) {
154
- return
155
-}
156
-
157
-```
158
-
78
## Code
79
80
```javascript
compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md
-37
@@ -14,43 +14,6 @@ function foo(a, b, c) {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate y$8_@0[1:6] = Array []
22
- [2] If (read a$5) then:bb3 else:bb1 fallthrough=bb1
23
-bb3:
24
- predecessor blocks: bb0
25
- [3] If (read b$6) then:bb5 else:bb1 fallthrough=bb1
26
-bb5:
27
- predecessor blocks: bb3
28
- [4] Call mutate y$8_@0.push(read c$7)
29
- [5] Goto bb1
30
-bb1:
31
- predecessor blocks: bb5 bb3 bb0
32
- [6] Return
33
-```
34
-
35
-## Reactive Scopes
36
-
37
-```
38
-function foo(
39
- a,
40
- b,
41
- c,
42
-) {
43
- [1] Const mutate y$8_@0[1:6] = Array []
44
- if (read a$5) {
45
- if (read b$6) {
46
- [4] Call mutate y$8_@0.push(read c$7)
47
- }
48
- }
49
- return
50
-}
51
-
52
-```
53
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md
-28
@@ -11,34 +11,6 @@ function Component(c) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 }
19
- [2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject)
20
- [3] Const mutate a$8:TObject = read x$7_@0:TObject
21
- [4] Const mutate b$9:TObject = read a$8:TObject
22
- [5] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function Component(
29
- c,
30
-) {
31
- scope @0 [1:3] deps=[read c$6] out=[x$7_@0] {
32
- [1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 }
33
- [2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject)
34
- }
35
- [3] Const mutate a$8:TObject = read x$7_@0:TObject
36
- [4] Const mutate b$9:TObject = read a$8:TObject
37
- return
38
-}
39
-
40
-```
41
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
-46
@@ -15,52 +15,6 @@ function Foo(props) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate $14:TPrimitive = "\n Hello "
23
- [2] Const mutate $15:TPrimitive = " "
24
- [3] Const mutate $16:TPrimitive = "\n "
25
- [4] Const mutate $17:TPrimitive = "div"
26
- [5] Const mutate $18:TPrimitive = "\n "
27
- [6] Const mutate $19:TPrimitive = "Text"
28
- [7] Const mutate t0$20_@0 = JsxFragment [read $19:TPrimitive]
29
- [8] Const mutate $21:TPrimitive = "\n "
30
- [9] Const mutate t2$22_@1 = JSX <read $17:TPrimitive>{read $18:TPrimitive}{read t0$20_@0}{read $21:TPrimitive}</read $17:TPrimitive>
31
- [10] Const mutate $23:TPrimitive = "\n "
32
- [11] Const mutate t5$24_@2 = JsxFragment [read $14:TPrimitive, read props$13.greeting, read $15:TPrimitive, read $16:TPrimitive, read t2$22_@1, read $23:TPrimitive]
33
- [12] Return read t5$24_@2
34
-```
35
-
36
-## Reactive Scopes
37
-
38
-```
39
-function Foo(
40
- props,
41
-) {
42
- [1] Const mutate $14:TPrimitive = "\n Hello "
43
- [2] Const mutate $15:TPrimitive = " "
44
- [3] Const mutate $16:TPrimitive = "\n "
45
- [4] Const mutate $17:TPrimitive = "div"
46
- [5] Const mutate $18:TPrimitive = "\n "
47
- [6] Const mutate $19:TPrimitive = "Text"
48
- scope @0 [7:8] deps=[] out=[$20_@0] {
49
- [7] Const mutate $20_@0 = JsxFragment [read $19:TPrimitive]
50
- }
51
- [8] Const mutate $21:TPrimitive = "\n "
52
- scope @1 [9:10] deps=[read $20_@0] out=[$22_@1] {
53
- [9] Const mutate $22_@1 = JSX <read $17:TPrimitive>{read $18:TPrimitive}{read $20_@0}{read $21:TPrimitive}</read $17:TPrimitive>
54
- }
55
- [10] Const mutate $23:TPrimitive = "\n "
56
- scope @2 [11:12] deps=[read props$13.greeting, read $22_@1] out=[$24_@2] {
57
- [11] Const mutate $24_@2 = JsxFragment [read $14:TPrimitive, read props$13.greeting, read $15:TPrimitive, read $16:TPrimitive, read $22_@1, read $23:TPrimitive]
58
- }
59
- return read $24_@2
60
-}
61
-
62
-```
63
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
-180
@@ -19,53 +19,6 @@ function g() {}
19
20
```
21
22
-## HIR
23
-
24
-```
25
-bb0:
26
- [1] Const mutate t0$5_@0 = Call mutate f$1:TFunction()
27
- [2] Let mutate t2$8_@1[2:7] = undefined
28
- [2] If (read t0$5_@0) then:bb2 else:bb3 fallthrough=bb1
29
-bb2:
30
- predecessor blocks: bb0
31
- [3] Const mutate t3$6_@2 = Call mutate g$4:TFunction()
32
- [4] Reassign mutate t2$8_@1[2:7] = read t3$6_@2
33
- [4] Goto bb1
34
-bb3:
35
- predecessor blocks: bb0
36
- [5] Const mutate $7 = read t0$5_@0
37
- [6] Reassign mutate t2$8_@1[2:7] = read $7
38
- [6] Goto bb1
39
-bb1:
40
- predecessor blocks: bb2 bb3
41
- [7] Return freeze t2$8_@1
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function And(
48
-) {
49
- scope @0 [1:2] deps=[] out=[$5_@0] {
50
- [1] Const mutate $5_@0 = Call mutate f$1:TFunction()
51
- }
52
- scope @1 [2:7] deps=[read $5_@0] out=[$8_@1] {
53
- [2] Let mutate $8_@1[2:7] = undefined
54
- if (read $5_@0) {
55
- scope @2 [3:4] deps=[] out=[$6_@2] {
56
- [3] Const mutate $6_@2 = Call mutate g$4:TFunction()
57
- }
58
- [4] Reassign mutate $8_@1[2:7] = read $6_@2
59
- } else {
60
- [5] Const mutate $7 = read $5_@0
61
- [6] Reassign mutate $8_@1[2:7] = read $7
62
- }
63
- }
64
- return freeze $8_@1
65
-}
66
-
67
-```
68
-
22
## Code
23
24
```javascript
@@ -110,53 +63,6 @@ function And() {
63
}
64
65
```
113
-## HIR
114
-
115
-```
116
-bb0:
117
- [1] Const mutate t0$5_@0 = Call mutate f$1:TFunction()
118
- [2] Let mutate t2$8_@1[2:7] = undefined
119
- [2] If (read t0$5_@0) then:bb2 else:bb3 fallthrough=bb1
120
-bb2:
121
- predecessor blocks: bb0
122
- [3] Const mutate $6 = read t0$5_@0
123
- [4] Reassign mutate t2$8_@1[2:7] = read $6
124
- [4] Goto bb1
125
-bb3:
126
- predecessor blocks: bb0
127
- [5] Const mutate t3$7_@2 = Call mutate g$4:TFunction()
128
- [6] Reassign mutate t2$8_@1[2:7] = read t3$7_@2
129
- [6] Goto bb1
130
-bb1:
131
- predecessor blocks: bb2 bb3
132
- [7] Return freeze t2$8_@1
133
-```
134
-
135
-## Reactive Scopes
136
-
137
-```
138
-function Or(
139
-) {
140
- scope @0 [1:2] deps=[] out=[$5_@0] {
141
- [1] Const mutate $5_@0 = Call mutate f$1:TFunction()
142
- }
143
- scope @1 [2:7] deps=[read $5_@0] out=[$8_@1] {
144
- [2] Let mutate $8_@1[2:7] = undefined
145
- if (read $5_@0) {
146
- [3] Const mutate $6 = read $5_@0
147
- [4] Reassign mutate $8_@1[2:7] = read $6
148
- } else {
149
- scope @2 [5:6] deps=[] out=[$7_@2] {
150
- [5] Const mutate $7_@2 = Call mutate g$4:TFunction()
151
- }
152
- [6] Reassign mutate $8_@1[2:7] = read $7_@2
153
- }
154
- }
155
- return freeze $8_@1
156
-}
157
-
158
-```
159
-
66
## Code
67
68
```javascript
@@ -201,58 +107,6 @@ function Or() {
107
}
108
109
```
204
-## HIR
205
-
206
-```
207
-bb0:
208
- [1] Const mutate t0$9_@0:TPrimitive = Call mutate f$2:TFunction()
209
- [2] Const mutate $10:TPrimitive = null
210
- [3] Const mutate $11:TPrimitive = Binary read t0$9_@0:TPrimitive != read $10:TPrimitive
211
- [4] Let mutate t2$14_@1[4:9] = undefined
212
- [4] If (read $11:TPrimitive) then:bb2 else:bb3 fallthrough=bb1
213
-bb2:
214
- predecessor blocks: bb0
215
- [5] Const mutate $12:TPrimitive = read t0$9_@0:TPrimitive
216
- [6] Reassign mutate t2$14_@1[4:9] = read $12:TPrimitive
217
- [6] Goto bb1
218
-bb3:
219
- predecessor blocks: bb0
220
- [7] Const mutate t3$13_@2 = Call mutate g$7:TFunction()
221
- [8] Reassign mutate t2$14_@1[4:9] = read t3$13_@2
222
- [8] Goto bb1
223
-bb1:
224
- predecessor blocks: bb2 bb3
225
- [9] Return freeze t2$14_@1
226
-```
227
-
228
-## Reactive Scopes
229
-
230
-```
231
-function QuestionQuestion(
232
- props,
233
-) {
234
- scope @0 [1:2] deps=[] out=[$9_@0] {
235
- [1] Const mutate $9_@0:TPrimitive = Call mutate f$2:TFunction()
236
- }
237
- [2] Const mutate $10:TPrimitive = null
238
- [3] Const mutate $11:TPrimitive = Binary read $9_@0:TPrimitive != read $10:TPrimitive
239
- scope @1 [4:9] deps=[read $9_@0:TPrimitive] out=[$14_@1] {
240
- [4] Let mutate $14_@1[4:9] = undefined
241
- if (read $11:TPrimitive) {
242
- [5] Const mutate $12:TPrimitive = read $9_@0:TPrimitive
243
- [6] Reassign mutate $14_@1[4:9] = read $12:TPrimitive
244
- } else {
245
- scope @2 [7:8] deps=[] out=[$13_@2] {
246
- [7] Const mutate $13_@2 = Call mutate g$7:TFunction()
247
- }
248
- [8] Reassign mutate $14_@1[4:9] = read $13_@2
249
- }
250
- }
251
- return freeze $14_@1
252
-}
253
-
254
-```
255
-
110
## Code
111
112
```javascript
@@ -297,46 +151,12 @@ function QuestionQuestion(props) {
151
}
152
153
```
300
-## HIR
301
-
302
-```
303
-bb0:
304
- [1] Return
305
-```
306
-
307
-## Reactive Scopes
308
-
309
-```
310
-function f(
311
-) {
312
- return
313
-}
314
-
315
-```
316
-
154
## Code
155
156
```javascript
157
function f() {}
158
159
```
323
-## HIR
324
-
325
-```
326
-bb0:
327
- [1] Return
328
-```
329
-
330
-## Reactive Scopes
331
-
332
-```
333
-function g(
334
-) {
335
- return
336
-}
337
-
338
-```
339
-
160
## Code
161
162
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
-138
@@ -39,156 +39,18 @@ function Component(props) {
39
40
```
41
42
-## HIR
43
-
44
-```
45
-bb0:
46
- [1] Return
47
-```
48
-
49
-## Reactive Scopes
50
-
51
-```
52
-function mutate(
53
- x,
54
- y,
55
-) {
56
- return
57
-}
58
-
59
-```
60
-
42
## Code
43
44
```javascript
45
function mutate(x, y) {}
46
47
```
67
-## HIR
68
-
69
-```
70
-bb0:
71
- [1] Return
72
-```
73
-
74
-## Reactive Scopes
75
-
76
-```
77
-function cond(
78
- x,
79
-) {
80
- return
81
-}
82
-
83
-```
84
-
48
## Code
49
50
```javascript
51
function cond(x) {}
52
53
```
91
-## HIR
92
-
93
-```
94
-bb0:
95
- [1] Let mutate a$13_@0:TObject[1:23] = Object { }
96
- [2] Let mutate b$14_@0:TObject[1:23] = Object { }
97
- [3] Let mutate c$15_@0:TObject[1:23] = Object { }
98
- [4] Let mutate d$16_@0:TObject[1:23] = Object { }
99
- [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject
100
- [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject
101
- [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject
102
- [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject
103
- [5] While test=bb1 loop=bb3 fallthrough=bb2
104
-bb1:
105
- predecessor blocks: bb0 bb4
106
- [6] Const mutate $17:TPrimitive = true
107
- [7] If (read $17:TPrimitive) then:bb3 else:bb2 fallthrough=bb2
108
-bb3:
109
- predecessor blocks: bb1
110
- [8] Const mutate z$19_@0[1:23] = read a$13_@0:TObject
111
- [9] Reassign mutate a$13_@0:TObject[1:23] = read b$14_@0:TObject
112
- [10] Reassign mutate b$14_@0:TObject[1:23] = read c$15_@0:TObject
113
- [11] Reassign mutate c$15_@0:TObject[1:23] = read d$16_@0:TObject
114
- [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0
115
- [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject)
116
- [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject)
117
- [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject
118
- [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject
119
- [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject
120
- [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject
121
- [15] If (read $29_@0) then:bb2 else:bb4 fallthrough=bb4
122
-bb4:
123
- predecessor blocks: bb3
124
- [16] Goto(Continue) bb1
125
-bb2:
126
- predecessor blocks: bb3 bb1
127
- [17] If (read a$0$30_@0) then:bb7 else:bb7 fallthrough=bb7
128
-bb7:
129
- predecessor blocks: bb2
130
- [18] If (read b$1$31_@0) then:bb9 else:bb9 fallthrough=bb9
131
-bb9:
132
- predecessor blocks: bb7
133
- [19] If (read c$2$32_@0) then:bb11 else:bb11 fallthrough=bb11
134
-bb11:
135
- predecessor blocks: bb9
136
- [20] If (read d$3$33_@0) then:bb13 else:bb13 fallthrough=bb13
137
-bb13:
138
- predecessor blocks: bb11
139
- [21] Const mutate $34:TPrimitive = null
140
- [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive)
141
- [23] Return
142
-```
143
-
144
-## Reactive Scopes
145
-
146
-```
147
-function Component(
148
- props,
149
-) {
150
- [1] Let mutate a$13_@0:TObject[1:23] = Object { }
151
- [2] Let mutate b$14_@0:TObject[1:23] = Object { }
152
- [3] Let mutate c$15_@0:TObject[1:23] = Object { }
153
- [4] Let mutate d$16_@0:TObject[1:23] = Object { }
154
- [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject
155
- [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject
156
- [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject
157
- [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject
158
- while (
159
- [6] Const mutate $17:TPrimitive = true
160
- read $17:TPrimitive
161
- ) {
162
- [8] Const mutate z$19_@0[1:23] = read a$13_@0:TObject
163
- [9] Reassign mutate a$13_@0:TObject[1:23] = read b$14_@0:TObject
164
- [10] Reassign mutate b$14_@0:TObject[1:23] = read c$15_@0:TObject
165
- [11] Reassign mutate c$15_@0:TObject[1:23] = read d$16_@0:TObject
166
- [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0
167
- [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject)
168
- [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject)
169
- [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject
170
- [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject
171
- [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject
172
- [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject
173
- if (read $29_@0) {
174
- break
175
- }
176
- }
177
- if (read a$0$30_@0) {
178
- }
179
- if (read b$1$31_@0) {
180
- }
181
- if (read c$2$32_@0) {
182
- }
183
- if (read d$3$33_@0) {
184
- }
185
- [21] Const mutate $34:TPrimitive = null
186
- [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive)
187
- return
188
-}
189
-
190
-```
191
-
54
## Code
55
56
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
-84
@@ -35,96 +35,12 @@ function Component(props) {
35
36
```
37
38
-## HIR
39
-
40
-```
41
-bb0:
42
- [1] Return
43
-```
44
-
45
-## Reactive Scopes
46
-
47
-```
48
-function mutate(
49
- x,
50
- y,
51
-) {
52
- return
53
-}
54
-
55
-```
56
-
38
## Code
39
40
```javascript
41
function mutate(x, y) {}
42
43
```
63
-## HIR
64
-
65
-```
66
-bb0:
67
- [1] Const mutate a$11_@0:TObject = Object { }
68
- [2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject]
69
- [3] Const mutate c$13_@2:TObject = Object { }
70
- [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject }
71
- [5] Const mutate x$15_@1:TObject[2:15] = Object { }
72
- [6] Reassign store x$15_@1.b[2:15] = read b$12_@1
73
- [7] Const mutate y$16_@1[2:15] = Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject)
74
- [8] If (read a$11_@0:TObject) then:bb1 else:bb1 fallthrough=bb1
75
-bb1:
76
- predecessor blocks: bb0
77
- [9] If (read b$12_@1) then:bb3 else:bb3 fallthrough=bb3
78
-bb3:
79
- predecessor blocks: bb1
80
- [10] If (read c$13_@2:TObject) then:bb5 else:bb5 fallthrough=bb5
81
-bb5:
82
- predecessor blocks: bb3
83
- [11] If (read d$14_@1:TObject) then:bb7 else:bb7 fallthrough=bb7
84
-bb7:
85
- predecessor blocks: bb5
86
- [12] If (read y$16_@1) then:bb9 else:bb9 fallthrough=bb9
87
-bb9:
88
- predecessor blocks: bb7
89
- [13] Const mutate $17:TPrimitive = null
90
- [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive)
91
- [15] Return
92
-```
93
-
94
-## Reactive Scopes
95
-
96
-```
97
-function Component(
98
- props,
99
-) {
100
- scope @0 [1:2] deps=[] out=[a$11_@0] {
101
- [1] Const mutate a$11_@0:TObject = Object { }
102
- }
103
- [2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject]
104
- scope @2 [3:4] deps=[] out=[c$13_@2] {
105
- [3] Const mutate c$13_@2:TObject = Object { }
106
- }
107
- [4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject }
108
- [5] Const mutate x$15_@1:TObject[2:15] = Object { }
109
- [6] Reassign store x$15_@1.b[2:15] = read b$12_@1
110
- [7] Const mutate y$16_@1[2:15] = Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, mutate d$14_@1:TObject)
111
- if (read a$11_@0:TObject) {
112
- }
113
- if (read b$12_@1) {
114
- }
115
- if (read c$13_@2:TObject) {
116
- }
117
- if (read d$14_@1:TObject) {
118
- }
119
- if (read y$16_@1) {
120
- }
121
- [13] Const mutate $17:TPrimitive = null
122
- [14] Call mutate mutate$7:TFunction(mutate x$15_@1:TObject, read $17:TPrimitive)
123
- return
124
-}
125
-
126
-```
127
-
44
## Code
45
46
```javascript
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
-111
@@ -34,129 +34,18 @@ function Component(props) {
34
35
```
36
37
-## HIR
38
-
39
-```
40
-bb0:
41
- [1] Return
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function mutate(
48
-) {
49
- return
50
-}
51
-
52
-```
53
-
37
## Code
38
39
```javascript
40
function mutate() {}
41
42
```
60
-## HIR
61
-
62
-```
63
-bb0:
64
- [1] Return
65
-```
66
-
67
-## Reactive Scopes
68
-
69
-```
70
-function cond(
71
-) {
72
- return
73
-}
74
-
75
-```
76
-
43
## Code
44
45
```javascript
46
function cond() {}
47
48
```
83
-## HIR
84
-
85
-```
86
-bb0:
87
- [1] Const mutate a$12_@0:TObject[1:18] = Object { }
88
- [2] Const mutate b$13_@0:TObject[1:18] = Object { }
89
- [3] Const mutate c$14_@1:TObject = Object { }
90
- [4] Const mutate d$15_@0:TObject[1:18] = Object { }
91
- [5] While test=bb1 loop=bb3 fallthrough=bb2
92
-bb1:
93
- predecessor blocks: bb0 bb4
94
- [6] Const mutate $16:TPrimitive = true
95
- [7] If (read $16:TPrimitive) then:bb3 else:bb2 fallthrough=bb2
96
-bb3:
97
- predecessor blocks: bb1
98
- [8] Call mutate mutate$6:TFunction(mutate a$12_@0:TObject, mutate b$13_@0:TObject)
99
- [9] Const mutate $21_@0[1:18] = Call mutate cond$7:TFunction(mutate a$12_@0:TObject)
100
- [10] If (read $21_@0) then:bb2 else:bb4 fallthrough=bb4
101
-bb4:
102
- predecessor blocks: bb3
103
- [11] Goto(Continue) bb1
104
-bb2:
105
- predecessor blocks: bb3 bb1
106
- [12] If (read a$12_@0:TObject) then:bb7 else:bb7 fallthrough=bb7
107
-bb7:
108
- predecessor blocks: bb2
109
- [13] If (read b$13_@0:TObject) then:bb9 else:bb9 fallthrough=bb9
110
-bb9:
111
- predecessor blocks: bb7
112
- [14] If (read c$14_@1:TObject) then:bb11 else:bb11 fallthrough=bb11
113
-bb11:
114
- predecessor blocks: bb9
115
- [15] If (read d$15_@0:TObject) then:bb13 else:bb13 fallthrough=bb13
116
-bb13:
117
- predecessor blocks: bb11
118
- [16] Const mutate $28:TPrimitive = null
119
- [17] Call mutate mutate$6:TFunction(mutate d$15_@0:TObject, read $28:TPrimitive)
120
- [18] Return
121
-```
122
-
123
-## Reactive Scopes
124
-
125
-```
126
-function Component(
127
- props,
128
-) {
129
- [1] Const mutate a$12_@0:TObject[1:18] = Object { }
130
- [2] Const mutate b$13_@0:TObject[1:18] = Object { }
131
- scope @1 [3:4] deps=[] out=[c$14_@1] {
132
- [3] Const mutate c$14_@1:TObject = Object { }
133
- }
134
- [4] Const mutate d$15_@0:TObject[1:18] = Object { }
135
- while (
136
- [6] Const mutate $16:TPrimitive = true
137
- read $16:TPrimitive
138
- ) {
139
- [8] Call mutate mutate$6:TFunction(mutate a$12_@0:TObject, mutate b$13_@0:TObject)
140
- [9] Const mutate $21_@0[1:18] = Call mutate cond$7:TFunction(mutate a$12_@0:TObject)
141
- if (read $21_@0) {
142
- break
143
- }
144
- }
145
- if (read a$12_@0:TObject) {
146
- }
147
- if (read b$13_@0:TObject) {
148
- }
149
- if (read c$14_@1:TObject) {
150
- }
151
- if (read d$15_@0:TObject) {
152
- }
153
- [16] Const mutate $28:TPrimitive = null
154
- [17] Call mutate mutate$6:TFunction(mutate d$15_@0:TObject, read $28:TPrimitive)
155
- return
156
-}
157
-
158
-```
159
-
49
## Code
50
51
```javascript
compiler/forget/src/__tests__/fixtures/hir/object-properties.expect.md
new
+27
@@ -0,0 +1,27 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+function foo(a, b, c) {
6
+ const x = a.x;
7
+ const y = b.c.d;
8
+ y.z = c.d.e;
9
+ foo(a.b.c);
10
+ [a.b.c];
11
+}
12
+
13
+```
14
+
15
+## Code
16
+
17
+```javascript
18
+function foo(a, b, c) {
19
+ const x = a.x;
20
+ const y = b.c.d;
21
+ y.z = c.d.e;
22
+ foo(a.b.c);
23
+ [a.b.c];
24
+}
25
+
26
+```
27
+
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/object-properties.js
new
+7
@@ -0,0 +1,7 @@
1
+function foo(a, b, c) {
2
+ const x = a.x;
3
+ const y = b.c.d;
4
+ y.z = c.d.e;
5
+ foo(a.b.c);
6
+ [a.b.c];
7
+}
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md
-33
@@ -15,39 +15,6 @@ function foo(a, b, c) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate x$9_@0[1:6] = Array []
23
- [2] Const mutate y$10_@0[1:6] = Array []
24
- [3] If (read x$9_@0) then:bb1 else:bb1 fallthrough=bb1
25
-bb1:
26
- predecessor blocks: bb0
27
- [4] Call mutate y$10_@0.push(read a$6)
28
- [5] Call mutate x$9_@0.push(read b$7)
29
- [6] Return
30
-```
31
-
32
-## Reactive Scopes
33
-
34
-```
35
-function foo(
36
- a,
37
- b,
38
- c,
39
-) {
40
- [1] Const mutate x$9_@0[1:6] = Array []
41
- [2] Const mutate y$10_@0[1:6] = Array []
42
- if (read x$9_@0) {
43
- }
44
- [4] Call mutate y$10_@0.push(read a$6)
45
- [5] Call mutate x$9_@0.push(read b$7)
46
- return
47
-}
48
-
49
-```
50
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md
-27
@@ -11,33 +11,6 @@ function foo(a, b) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$7_@0[1:5] = Array []
19
- [2] Const mutate y$8_@0[1:5] = Array []
20
- [3] Call mutate x$7_@0.push(read a$5)
21
- [4] Call mutate y$8_@0.push(read b$6)
22
- [5] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
- a,
30
- b,
31
-) {
32
- [1] Const mutate x$7_@0[1:5] = Array []
33
- [2] Const mutate y$8_@0[1:5] = Array []
34
- [3] Call mutate x$7_@0.push(read a$5)
35
- [4] Call mutate y$8_@0.push(read b$6)
36
- return
37
-}
38
-
39
-```
40
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md
-27
@@ -11,33 +11,6 @@ function foo(a, b) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$7_@0[1:5] = Array []
19
- [2] Const mutate y$8_@1[2:4] = Array []
20
- [3] Call mutate y$8_@1.push(read b$6)
21
- [4] Call mutate x$7_@0.push(read a$5)
22
- [5] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
- a,
30
- b,
31
-) {
32
- [1] Const mutate x$7_@0[1:5] = Array []
33
- [2] Const mutate y$8_@1[2:4] = Array []
34
- [3] Call mutate y$8_@1.push(read b$6)
35
- [4] Call mutate x$7_@0.push(read a$5)
36
- return
37
-}
38
-
39
-```
40
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md
-54
@@ -17,60 +17,6 @@ function foo(a, b, c) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$11_@0[1:11] = Array []
25
- [2] If (read a$8) then:bb2 else:bb1 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [3] Const mutate y$12_@1[3:7] = Array []
29
- [4] If (read b$9) then:bb4 else:bb3 fallthrough=bb3
30
-bb4:
31
- predecessor blocks: bb2
32
- [5] Call mutate y$12_@1.push(read c$10)
33
- [6] Goto bb3
34
-bb3:
35
- predecessor blocks: bb4 bb2
36
- [7] Const mutate $13:TPrimitive = "div"
37
- [8] Const mutate t8$15_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1}</read $13:TPrimitive>
38
- [9] Call mutate x$11_@0.push(read t8$15_@2)
39
- [10] Goto bb1
40
-bb1:
41
- predecessor blocks: bb3 bb0
42
- [11] Return freeze x$11_@0
43
-```
44
-
45
-## Reactive Scopes
46
-
47
-```
48
-function foo(
49
- a,
50
- b,
51
- c,
52
-) {
53
- scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] {
54
- [1] Const mutate x$11_@0[1:11] = Array []
55
- if (read a$8) {
56
- scope @1 [3:7] deps=[read b$9, read c$10] out=[y$12_@1] {
57
- [3] Const mutate y$12_@1[3:7] = Array []
58
- if (read b$9) {
59
- [5] Call mutate y$12_@1.push(read c$10)
60
- }
61
- }
62
- [7] Const mutate $13:TPrimitive = "div"
63
- scope @2 [8:9] deps=[freeze y$12_@1] out=[$15_@2] {
64
- [8] Const mutate $15_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1}</read $13:TPrimitive>
65
- }
66
- [9] Call mutate x$11_@0.push(read $15_@2)
67
- }
68
- }
69
- return freeze x$11_@0
70
-}
71
-
72
-```
73
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md
-41
@@ -13,47 +13,6 @@ function foo(a, b, c) {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate x$9_@0[1:8] = Array []
21
- [2] Const mutate y$10_@0[1:8] = Array []
22
- [3] While test=bb1 loop=bb3 fallthrough=bb2
23
-bb1:
24
- predecessor blocks: bb0 bb3
25
- [4] If (read c$8) then:bb3 else:bb2 fallthrough=bb2
26
-bb3:
27
- predecessor blocks: bb1
28
- [5] Call mutate y$10_@0.push(read b$7)
29
- [6] Call mutate x$9_@0.push(read a$6)
30
- [7] Goto(Continue) bb1
31
-bb2:
32
- predecessor blocks: bb1
33
- [8] Return
34
-```
35
-
36
-## Reactive Scopes
37
-
38
-```
39
-function foo(
40
- a,
41
- b,
42
- c,
43
-) {
44
- [1] Const mutate x$9_@0[1:8] = Array []
45
- [2] Const mutate y$10_@0[1:8] = Array []
46
- while (
47
- read c$8
48
- ) {
49
- [5] Call mutate y$10_@0.push(read b$7)
50
- [6] Call mutate x$9_@0.push(read a$6)
51
- }
52
- return
53
-}
54
-
55
-```
56
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md
-46
@@ -17,52 +17,6 @@ function foo(a, b, c) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$9_@0[1:9] = Array []
25
- [2] If (read a$6) then:bb2 else:bb1 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [3] Const mutate y$10_@0[1:9] = Array []
29
- [4] If (read b$7) then:bb4 else:bb3 fallthrough=bb3
30
-bb4:
31
- predecessor blocks: bb2
32
- [5] Call mutate y$10_@0.push(read c$8)
33
- [6] Goto bb3
34
-bb3:
35
- predecessor blocks: bb4 bb2
36
- [7] Call mutate x$9_@0.push(mutate y$10_@0)
37
- [8] Goto bb1
38
-bb1:
39
- predecessor blocks: bb3 bb0
40
- [9] Return freeze x$9_@0
41
-```
42
-
43
-## Reactive Scopes
44
-
45
-```
46
-function foo(
47
- a,
48
- b,
49
- c,
50
-) {
51
- scope @0 [1:9] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] {
52
- [1] Const mutate x$9_@0[1:9] = Array []
53
- if (read a$6) {
54
- [3] Const mutate y$10_@0[1:9] = Array []
55
- if (read b$7) {
56
- [5] Call mutate y$10_@0.push(read c$8)
57
- }
58
- [7] Call mutate x$9_@0.push(mutate y$10_@0)
59
- }
60
- }
61
- return freeze x$9_@0
62
-}
63
-
64
-```
65
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
-34
@@ -13,40 +13,6 @@ function Component(props) {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate x$7_@0:TObject[1:6] = Object { }
21
- [2] Const mutate y$8_@0[1:6] = Array []
22
- [3] Reassign store x$7_@0.y[1:6] = read y$8_@0
23
- [4] Const mutate child$9_@0[1:6] = JSX <read Component$0 data={freeze y$8_@0} ></read Component$0>
24
- [5] Call mutate x$7_@0.y.push(read props$6.p0)
25
- [6] Const mutate t5$10_@1 = JSX <read Component$0 data={freeze x$7_@0:TObject} >{read child$9_@0}</read Component$0>
26
- [7] Return read t5$10_@1
27
-```
28
-
29
-## Reactive Scopes
30
-
31
-```
32
-function Component(
33
- props,
34
-) {
35
- scope @0 [1:6] deps=[read props$6.p0] out=[x$7_@0, child$9_@0] {
36
- [1] Const mutate x$7_@0:TObject[1:6] = Object { }
37
- [2] Const mutate y$8_@0[1:6] = Array []
38
- [3] Reassign store x$7_@0.y[1:6] = read y$8_@0
39
- [4] Const mutate child$9_@0[1:6] = JSX <read Component$0 data={freeze y$8_@0} ></read Component$0>
40
- [5] Call mutate x$7_@0.y.push(read props$6.p0)
41
- }
42
- scope @1 [6:7] deps=[freeze x$7_@0:TObject, read child$9_@0] out=[$10_@1] {
43
- [6] Const mutate $10_@1 = JSX <read Component$0 data={freeze x$7_@0:TObject} >{read child$9_@0}</read Component$0>
44
- }
45
- return read $10_@1
46
-}
47
-
48
-```
49
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
-31
@@ -14,37 +14,6 @@ function foo() {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate x$4_@0:TObject[1:6] = Object { }
22
- [2] Const mutate y$5_@1[2:5] = Array []
23
- [3] Const mutate z$6_@1:TObject[2:5] = Object { }
24
- [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject)
25
- [5] Reassign store x$4_@0.y[1:6] = read y$5_@1
26
- [6] Return freeze x$4_@0:TObject
27
-```
28
-
29
-## Reactive Scopes
30
-
31
-```
32
-function foo(
33
-) {
34
- scope @0 [1:6] deps=[] out=[x$4_@0] {
35
- [1] Const mutate x$4_@0:TObject[1:6] = Object { }
36
- scope @1 [2:5] deps=[] out=[y$5_@1] {
37
- [2] Const mutate y$5_@1[2:5] = Array []
38
- [3] Const mutate z$6_@1:TObject[2:5] = Object { }
39
- [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject)
40
- }
41
- [5] Reassign store x$4_@0.y[1:6] = read y$5_@1
42
- }
43
- return freeze x$4_@0:TObject
44
-}
45
-
46
-```
47
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md
-52
@@ -16,58 +16,6 @@ function foo(a, b, c) {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Const mutate x$11_@0[1:11] = Array []
24
- [2] If (read a$8) then:bb2 else:bb3 fallthrough=bb1
25
-bb2:
26
- predecessor blocks: bb0
27
- [3] Const mutate y$12_@1[3:5] = Array []
28
- [4] Call mutate y$12_@1.push(read b$9)
29
- [5] Const mutate $13:TPrimitive = "div"
30
- [6] Const mutate t7$14_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1}</read $13:TPrimitive>
31
- [7] Call mutate x$11_@0.push(read t7$14_@2)
32
- [8] Goto bb1
33
-bb3:
34
- predecessor blocks: bb0
35
- [9] Call mutate x$11_@0.push(read c$10)
36
- [10] Goto bb1
37
-bb1:
38
- predecessor blocks: bb2 bb3
39
- [11] Return freeze x$11_@0
40
-```
41
-
42
-## Reactive Scopes
43
-
44
-```
45
-function foo(
46
- a,
47
- b,
48
- c,
49
-) {
50
- scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] {
51
- [1] Const mutate x$11_@0[1:11] = Array []
52
- if (read a$8) {
53
- scope @1 [3:5] deps=[read b$9] out=[y$12_@1] {
54
- [3] Const mutate y$12_@1[3:5] = Array []
55
- [4] Call mutate y$12_@1.push(read b$9)
56
- }
57
- [5] Const mutate $13:TPrimitive = "div"
58
- scope @2 [6:7] deps=[freeze y$12_@1] out=[$14_@2] {
59
- [6] Const mutate $14_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1}</read $13:TPrimitive>
60
- }
61
- [7] Call mutate x$11_@0.push(read $14_@2)
62
- } else {
63
- [9] Call mutate x$11_@0.push(read c$10)
64
- }
65
- }
66
- return freeze x$11_@0
67
-}
68
-
69
-```
70
-
19
## Code
20
21
```javascript
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
-48
@@ -15,54 +15,6 @@ function f(a, b) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate x$10_@0[1:8] = Array []
23
- [2] Const mutate $11:TPrimitive = 1
24
- [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive
25
- [4] If (read $12:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [5] If (read b$9) then:bb4 else:bb1 fallthrough=bb1
29
-bb4:
30
- predecessor blocks: bb2
31
- [6] Call mutate x$10_@0.push(read b$9)
32
- [7] Goto bb1
33
-bb1:
34
- predecessor blocks: bb4 bb2 bb0
35
- [8] Const mutate $13:TPrimitive = "div"
36
- [9] Const mutate t4$15_@1 = JSX <read $13:TPrimitive>{freeze x$10_@0}</read $13:TPrimitive>
37
- [10] Return read t4$15_@1
38
-```
39
-
40
-## Reactive Scopes
41
-
42
-```
43
-function f(
44
- a,
45
- b,
46
-) {
47
- scope @0 [1:8] deps=[read a$8.length, read b$9] out=[x$10_@0] {
48
- [1] Const mutate x$10_@0[1:8] = Array []
49
- [2] Const mutate $11:TPrimitive = 1
50
- [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive
51
- if (read $12:TPrimitive) {
52
- if (read b$9) {
53
- [6] Call mutate x$10_@0.push(read b$9)
54
- }
55
- }
56
- }
57
- [8] Const mutate $13:TPrimitive = "div"
58
- scope @1 [9:10] deps=[freeze x$10_@0] out=[$15_@1] {
59
- [9] Const mutate $15_@1 = JSX <read $13:TPrimitive>{freeze x$10_@0}</read $13:TPrimitive>
60
- }
61
- return read $15_@1
62
-}
63
-
64
-```
65
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
-52
@@ -19,58 +19,6 @@ function Component(props) {
19
20
```
21
22
-## HIR
23
-
24
-```
25
-bb0:
26
- [1] Const mutate x$7_@0[1:3] = Array []
27
- [2] Call mutate x$7_@0.push(read props$6.p0)
28
- [3] Const mutate y$8 = read x$7_@0
29
- [4] Let mutate x$0$11_@1[1:7] = read x$7_@0
30
- [4] If (read props$6.p1) then:bb2 else:bb1 fallthrough=bb1
31
-bb2:
32
- predecessor blocks: bb0
33
- [5] Const mutate x$1$9_@2 = Array []
34
- [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2
35
- [6] Goto bb1
36
-bb1:
37
- predecessor blocks: bb2 bb0
38
- [7] Const mutate _$12_@3 = JSX <read Component$0 x={freeze x$0$11_@1} ></read Component$0>
39
- [8] Call read y$8.push(read props$6.p2)
40
- [9] Const mutate t7$15_@4 = JSX <read Component$0 x={read x$0$11_@1} y={read y$8} ></read Component$0>
41
- [10] Return read t7$15_@4
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function Component(
48
- props,
49
-) {
50
- scope @0 [1:3] deps=[read props$6.p0] out=[x$7_@0] {
51
- [1] Const mutate x$7_@0[1:3] = Array []
52
- [2] Call mutate x$7_@0.push(read props$6.p0)
53
- }
54
- [3] Const mutate y$8 = read x$7_@0
55
- scope @1 [1:7] deps=[read props$6.p1] out=[x$0$11_@1] {
56
- [4] Let mutate x$0$11_@1[1:7] = read x$7_@0
57
- if (read props$6.p1) {
58
- scope @2 [5:6] deps=[] out=[x$1$9_@2] {
59
- [5] Const mutate x$1$9_@2 = Array []
60
- }
61
- [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2
62
- }
63
- }
64
- [7] Const mutate _$12_@3 = JSX <read Component$0 x={freeze x$0$11_@1} ></read Component$0>
65
- [8] Call read y$8.push(read props$6.p2)
66
- scope @4 [9:10] deps=[read x$0$11_@1, read y$8] out=[$15_@4] {
67
- [9] Const mutate $15_@4 = JSX <read Component$0 x={read x$0$11_@1} y={read y$8} ></read Component$0>
68
- }
69
- return read $15_@4
70
-}
71
-
72
-```
73
-
22
## Code
23
24
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md
-93
@@ -30,99 +30,6 @@ function foo(a, b, c) {
30
31
```
32
33
-## HIR
34
-
35
-```
36
-bb0:
37
- [1] Const mutate x$16_@0[1:5] = Array []
38
- [2] If (read a$13) then:bb2 else:bb1 fallthrough=bb1
39
-bb2:
40
- predecessor blocks: bb0
41
- [3] Call mutate x$16_@0.push(read a$13)
42
- [4] Goto bb1
43
-bb1:
44
- predecessor blocks: bb2 bb0
45
- [5] Const mutate $17:TPrimitive = "div"
46
- [6] Const mutate y$19_@1 = JSX <read $17:TPrimitive>{freeze x$16_@0}</read $17:TPrimitive>
47
- [7] Const mutate $20:TPrimitive = 0
48
- [8] Let mutate x$0$30_@2[8:15] = undefined
49
- [8] Switch (read b$14)
50
- Case read $20:TPrimitive: bb5
51
- Default: bb4
52
- Fallthrough: bb3
53
-bb5:
54
- predecessor blocks: bb1
55
- [9] Const mutate x$1$22_@3[9:11] = Array []
56
- [10] Call mutate x$1$22_@3.push(read b$14)
57
- [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3
58
- [11] Goto bb3
59
-bb4:
60
- predecessor blocks: bb1
61
- [12] Const mutate x$2$23_@4[12:14] = Array []
62
- [13] Call mutate x$2$23_@4.push(read c$15)
63
- [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4
64
- [14] Goto bb3
65
-bb3:
66
- predecessor blocks: bb5 bb4
67
- [15] Const mutate $25:TPrimitive = "div"
68
- [16] Const mutate $26:TPrimitive = "\n "
69
- [17] Const mutate $27:TPrimitive = "\n "
70
- [18] Const mutate $28:TPrimitive = "\n "
71
- [19] Const mutate t13$31_@5 = JSX <read $25:TPrimitive>{read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive}</read $25:TPrimitive>
72
- [20] Return read t13$31_@5
73
-```
74
-
75
-## Reactive Scopes
76
-
77
-```
78
-function foo(
79
- a,
80
- b,
81
- c,
82
-) {
83
- scope @0 [1:5] deps=[read a$13] out=[x$16_@0] {
84
- [1] Const mutate x$16_@0[1:5] = Array []
85
- if (read a$13) {
86
- [3] Call mutate x$16_@0.push(read a$13)
87
- }
88
- }
89
- [5] Const mutate $17:TPrimitive = "div"
90
- scope @1 [6:7] deps=[freeze x$16_@0] out=[y$19_@1] {
91
- [6] Const mutate y$19_@1 = JSX <read $17:TPrimitive>{freeze x$16_@0}</read $17:TPrimitive>
92
- }
93
- [7] Const mutate $20:TPrimitive = 0
94
- scope @2 [8:15] deps=[read b$14, read c$15] out=[x$0$30_@2] {
95
- [8] Let mutate x$0$30_@2[8:15] = undefined
96
- switch (read b$14) {
97
- case read $20:TPrimitive: {
98
- scope @3 [9:11] deps=[read b$14] out=[x$1$22_@3] {
99
- [9] Const mutate x$1$22_@3[9:11] = Array []
100
- [10] Call mutate x$1$22_@3.push(read b$14)
101
- }
102
- [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3
103
- break bb3
104
- }
105
- default: {
106
- scope @4 [12:14] deps=[read c$15] out=[x$2$23_@4] {
107
- [12] Const mutate x$2$23_@4[12:14] = Array []
108
- [13] Call mutate x$2$23_@4.push(read c$15)
109
- }
110
- [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4
111
- }
112
- }
113
- }
114
- [15] Const mutate $25:TPrimitive = "div"
115
- [16] Const mutate $26:TPrimitive = "\n "
116
- [17] Const mutate $27:TPrimitive = "\n "
117
- [18] Const mutate $28:TPrimitive = "\n "
118
- scope @5 [19:20] deps=[read y$19_@1, freeze x$0$30_@2] out=[$31_@5] {
119
- [19] Const mutate $31_@5 = JSX <read $25:TPrimitive>{read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive}</read $25:TPrimitive>
120
- }
121
- return read $31_@5
122
-}
123
-
124
-```
125
-
33
## Code
34
35
```javascript
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
-38
@@ -17,44 +17,6 @@ function Component(props) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$7_@0[1:7] = Array []
25
- [2] Call mutate x$7_@0.push(read props$6.p0)
26
- [3] Const mutate y$8_@0[1:7] = read x$7_@0
27
- [4] Const mutate x$0$9_@1 = Array []
28
- [5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$0$9_@1} ></read Component$0>
29
- [6] Call mutate y$8_@0.push(read props$6.p1)
30
- [7] Const mutate t6$11_@3 = JSX <read Component$0 x={read x$0$9_@1} y={freeze y$8_@0} ></read Component$0>
31
- [8] Return read t6$11_@3
32
-```
33
-
34
-## Reactive Scopes
35
-
36
-```
37
-function Component(
38
- props,
39
-) {
40
- scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[y$8_@0] {
41
- [1] Const mutate x$7_@0[1:7] = Array []
42
- [2] Call mutate x$7_@0.push(read props$6.p0)
43
- [3] Const mutate y$8_@0[1:7] = read x$7_@0
44
- scope @1 [4:5] deps=[] out=[x$0$9_@1] {
45
- [4] Const mutate x$0$9_@1 = Array []
46
- }
47
- [5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$0$9_@1} ></read Component$0>
48
- [6] Call mutate y$8_@0.push(read props$6.p1)
49
- }
50
- scope @3 [7:8] deps=[read x$0$9_@1, freeze y$8_@0] out=[$11_@3] {
51
- [7] Const mutate $11_@3 = JSX <read Component$0 x={read x$0$9_@1} y={freeze y$8_@0} ></read Component$0>
52
- }
53
- return read $11_@3
54
-}
55
-
56
-```
57
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
-99
@@ -32,105 +32,6 @@ function Component(props) {
32
33
```
34
35
-## HIR
36
-
37
-```
38
-bb0:
39
- [1] Const mutate x$7:TPrimitive = undefined
40
- [2] Let mutate x$0$16_@0[2:18] = undefined
41
- [2] If (read props$6.cond) then:bb2 else:bb10 fallthrough=bb1
42
-bb2:
43
- predecessor blocks: bb0
44
- [3] Const mutate $8:TPrimitive = 2
45
- [4] Const mutate $9:TPrimitive = 1
46
- [5] Const mutate $10:TPrimitive = 0
47
- [6] Switch (read props$6.test)
48
- Case read $10:TPrimitive: bb8
49
- Case read $9:TPrimitive: bb6
50
- Case read $8:TPrimitive: bb4
51
- Default: bb4
52
- Fallthrough: bb1
53
-bb8:
54
- predecessor blocks: bb2
55
- [7] Const mutate x$1$11 = read props$6.v0
56
- [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11
57
- [8] Goto bb1
58
-bb6:
59
- predecessor blocks: bb2
60
- [9] Const mutate x$2$12 = read props$6.v1
61
- [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12
62
- [10] Goto bb1
63
-bb4:
64
- predecessor blocks: bb2
65
- [11] Const mutate x$3$13 = read props$6.v2
66
- [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13
67
- [12] Goto bb1
68
-bb10:
69
- predecessor blocks: bb0
70
- [13] If (read props$6.cond2) then:bb12 else:bb13 fallthrough=bb1
71
-bb12:
72
- predecessor blocks: bb10
73
- [14] Const mutate x$4$14 = read props$6.b
74
- [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14
75
- [15] Goto bb1
76
-bb13:
77
- predecessor blocks: bb10
78
- [16] Const mutate x$5$15 = read props$6.c
79
- [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15
80
- [17] Goto bb1
81
-bb1:
82
- predecessor blocks: bb8 bb6 bb4 bb12 bb13
83
- [18] read x$0$16_@0
84
- [19] Return
85
-```
86
-
87
-## Reactive Scopes
88
-
89
-```
90
-function Component(
91
- props,
92
-) {
93
- [1] Const mutate x$7:TPrimitive = undefined
94
- scope @0 [2:18] deps=[read props$6.cond, read props$6.test, read props$6.v0, read props$6.v1, read props$6.v2, read props$6.cond2, read props$6.b, read props$6.c] out=[x$0$16_@0] {
95
- [2] Let mutate x$0$16_@0[2:18] = undefined
96
- if (read props$6.cond) {
97
- [3] Const mutate $8:TPrimitive = 2
98
- [4] Const mutate $9:TPrimitive = 1
99
- [5] Const mutate $10:TPrimitive = 0
100
- switch (read props$6.test) {
101
- case read $10:TPrimitive: {
102
- [7] Const mutate x$1$11 = read props$6.v0
103
- [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11
104
- break bb1
105
- }
106
- case read $9:TPrimitive: {
107
- [9] Const mutate x$2$12 = read props$6.v1
108
- [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12
109
- break bb1
110
- }
111
- case read $8:TPrimitive: {
112
- }
113
- default: {
114
- [11] Const mutate x$3$13 = read props$6.v2
115
- [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13
116
- }
117
- }
118
- } else {
119
- if (read props$6.cond2) {
120
- [14] Const mutate x$4$14 = read props$6.b
121
- [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14
122
- } else {
123
- [16] Const mutate x$5$15 = read props$6.c
124
- [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15
125
- }
126
- }
127
- }
128
- [18] read x$0$16_@0
129
- return
130
-}
131
-
132
-```
133
-
35
## Code
36
37
```javascript
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
-50
@@ -16,62 +16,12 @@ function foo() {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Return
24
-```
25
-
26
-## Reactive Scopes
27
-
28
-```
29
-function mutate(
30
-) {
31
- return
32
-}
33
-
34
-```
35
-
19
## Code
20
21
```javascript
22
function mutate() {}
23
24
```
42
-## HIR
43
-
44
-```
45
-bb0:
46
- [1] Const mutate a$5_@0:TObject = Object { }
47
- [2] Const mutate b$6_@1:TObject[2:8] = Object { }
48
- [3] Const mutate c$7_@1:TObject[2:8] = Object { }
49
- [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject
50
- [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject
51
- [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject
52
- [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject)
53
- [8] Return freeze c$2$10_@1:TObject
54
-```
55
-
56
-## Reactive Scopes
57
-
58
-```
59
-function foo(
60
-) {
61
- [1] Const mutate a$5_@0:TObject = Object { }
62
- scope @1 [2:8] deps=[] out=[c$2$10_@1] {
63
- [2] Const mutate b$6_@1:TObject[2:8] = Object { }
64
- [3] Const mutate c$7_@1:TObject[2:8] = Object { }
65
- [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject
66
- [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject
67
- [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject
68
- [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject)
69
- }
70
- return freeze c$2$10_@1:TObject
71
-}
72
-
73
-```
74
-
25
## Code
26
27
```javascript
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
-42
@@ -11,48 +11,6 @@ function foo(x, y) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] If (read x$8) then:bb2 else:bb1 fallthrough=bb1
19
-bb2:
20
- predecessor blocks: bb0
21
- [2] Const mutate $10:TPrimitive = false
22
- [3] Const mutate t1$11_@0 = Call read foo$0:TFunction(read $10:TPrimitive, read y$9:TPrimitive)
23
- [4] Return freeze t1$11_@0
24
-bb1:
25
- predecessor blocks: bb0
26
- [5] Const mutate $12:TPrimitive = 10
27
- [6] Const mutate $13:TPrimitive = Binary read y$9:TPrimitive * read $12:TPrimitive
28
- [7] Const mutate t2$14_@1 = Array [read $13:TPrimitive]
29
- [8] Return freeze t2$14_@1
30
-```
31
-
32
-## Reactive Scopes
33
-
34
-```
35
-function foo(
36
- x,
37
- y,
38
-) {
39
- if (read x$8) {
40
- [2] Const mutate $10:TPrimitive = false
41
- scope @0 [3:4] deps=[read y$9:TPrimitive] out=[$11_@0] {
42
- [3] Const mutate $11_@0 = Call read foo$0:TFunction(read $10:TPrimitive, read y$9:TPrimitive)
43
- }
44
- return freeze $11_@0
45
- }
46
- [5] Const mutate $12:TPrimitive = 10
47
- [6] Const mutate $13:TPrimitive = Binary read y$9:TPrimitive * read $12:TPrimitive
48
- scope @1 [7:8] deps=[] out=[$14_@1] {
49
- [7] Const mutate $14_@1 = Array [read $13:TPrimitive]
50
- }
51
- return freeze $14_@1
52
-}
53
-
54
-```
55
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
-26
@@ -11,32 +11,6 @@ function Component(props) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate a$6:TPrimitive = 1
19
- [2] Const mutate b$7:TPrimitive = 2
20
- [3] Const mutate x$8_@0 = Array [read a$6:TPrimitive, read b$7:TPrimitive]
21
- [4] Return freeze x$8_@0
22
-```
23
-
24
-## Reactive Scopes
25
-
26
-```
27
-function Component(
28
- props,
29
-) {
30
- [1] Const mutate a$6:TPrimitive = 1
31
- [2] Const mutate b$7:TPrimitive = 2
32
- scope @0 [3:4] deps=[] out=[x$8_@0] {
33
- [3] Const mutate x$8_@0 = Array [read a$6:TPrimitive, read b$7:TPrimitive]
34
- }
35
- return freeze x$8_@0
36
-}
37
-
38
-```
39
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
-67
@@ -18,79 +18,12 @@ function Component(props) {
18
19
```
20
21
-## HIR
22
-
23
-```
24
-bb0:
25
- [1] Return
26
-```
27
-
28
-## Reactive Scopes
29
-
30
-```
31
-function foo(
32
-) {
33
- return
34
-}
35
-
36
-```
37
-
21
## Code
22
23
```javascript
24
function foo() {}
25
26
```
44
-## HIR
45
-
46
-```
47
-bb0:
48
- [1] Const mutate a$11_@0[1:10] = Array []
49
- [2] Const mutate b$12_@0:TObject[1:10] = Object { }
50
- [3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject)
51
- [4] Const mutate t2$13_@1 = Call mutate foo$4:TFunction()
52
- [5] If (read t2$13_@1) then:bb2 else:bb1 fallthrough=bb1
53
-bb2:
54
- predecessor blocks: bb0
55
- [6] Const mutate $14:TPrimitive = "div"
56
- [7] Const mutate _$15_@2 = JSX <read $14:TPrimitive a={freeze a$11_@0} ></read $14:TPrimitive>
57
- [8] Goto bb1
58
-bb1:
59
- predecessor blocks: bb2 bb0
60
- [9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject)
61
- [10] Const mutate $19:TPrimitive = "div"
62
- [11] Const mutate t5$20_@3 = JSX <read $19:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19:TPrimitive>
63
- [12] Return read t5$20_@3
64
-```
65
-
66
-## Reactive Scopes
67
-
68
-```
69
-function Component(
70
- props,
71
-) {
72
- scope @0 [1:10] deps=[] out=[a$11_@0, b$12_@0] {
73
- [1] Const mutate a$11_@0[1:10] = Array []
74
- [2] Const mutate b$12_@0:TObject[1:10] = Object { }
75
- [3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject)
76
- scope @1 [4:5] deps=[] out=[$13_@1] {
77
- [4] Const mutate $13_@1 = Call mutate foo$4:TFunction()
78
- }
79
- if (read $13_@1) {
80
- [6] Const mutate $14:TPrimitive = "div"
81
- [7] Const mutate _$15_@2 = JSX <read $14:TPrimitive a={freeze a$11_@0} ></read $14:TPrimitive>
82
- }
83
- [9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject)
84
- }
85
- [10] Const mutate $19:TPrimitive = "div"
86
- scope @3 [11:12] deps=[freeze a$11_@0, freeze b$12_@0:TObject] out=[$20_@3] {
87
- [11] Const mutate $20_@3 = JSX <read $19:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19:TPrimitive>
88
- }
89
- return read $20_@3
90
-}
91
-
92
-```
93
-
27
## Code
28
29
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
-55
@@ -15,67 +15,12 @@ function Component(props) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
-) {
30
- return
31
-}
32
-
33
-```
34
-
18
## Code
19
20
```javascript
21
function foo() {}
22
23
```
41
-## HIR
42
-
43
-```
44
-bb0:
45
- [1] Const mutate a$10_@0[1:7] = Array []
46
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
47
- [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
48
- [4] Const mutate $12:TPrimitive = "div"
49
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
50
- [6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
51
- [7] Const mutate $14:TPrimitive = "div"
52
- [8] Const mutate t4$15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
53
- [9] Return read t4$15_@2
54
-```
55
-
56
-## Reactive Scopes
57
-
58
-```
59
-function Component(
60
- props,
61
-) {
62
- scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
- [1] Const mutate a$10_@0[1:7] = Array []
64
- [2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
- [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
66
- [4] Const mutate $12:TPrimitive = "div"
67
- [5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
68
- [6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
69
- }
70
- [7] Const mutate $14:TPrimitive = "div"
71
- scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] {
72
- [8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
73
- }
74
- return read $15_@2
75
-}
76
-
77
-```
78
-
24
## Code
25
26
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
-63
@@ -17,69 +17,6 @@ function foo() {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$7:TPrimitive = 1
25
- [2] Const mutate y$8:TPrimitive = 2
26
- [3] Const mutate $9:TPrimitive = 2
27
- [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive
28
- [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive
29
- [5] If (read $10:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
30
-bb2:
31
- predecessor blocks: bb0
32
- [6] Const mutate x$1$11:TPrimitive = 3
33
- [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive
34
- [7] Goto bb1
35
-bb1:
36
- predecessor blocks: bb2 bb0
37
- [8] Const mutate $12:TPrimitive = 3
38
- [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive
39
- [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0
40
- [10] If (read $14:TPrimitive) then:bb4 else:bb3 fallthrough=bb3
41
-bb4:
42
- predecessor blocks: bb1
43
- [11] Const mutate x$3$15:TPrimitive = 5
44
- [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive
45
- [12] Goto bb3
46
-bb3:
47
- predecessor blocks: bb4 bb1
48
- [13] Const mutate y$4$18 = read x$2$16_@1
49
- [14] Return
50
-```
51
-
52
-## Reactive Scopes
53
-
54
-```
55
-function foo(
56
-) {
57
- [1] Const mutate x$7:TPrimitive = 1
58
- [2] Const mutate y$8:TPrimitive = 2
59
- [3] Const mutate $9:TPrimitive = 2
60
- [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive
61
- scope @0 [1:8] deps=[] out=[x$0$17_@0] {
62
- [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive
63
- if (read $10:TPrimitive) {
64
- [6] Const mutate x$1$11:TPrimitive = 3
65
- [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive
66
- }
67
- }
68
- [8] Const mutate $12:TPrimitive = 3
69
- [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive
70
- scope @1 [1:13] deps=[] out=[x$2$16_@1] {
71
- [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0
72
- if (read $14:TPrimitive) {
73
- [11] Const mutate x$3$15:TPrimitive = 5
74
- [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive
75
- }
76
- }
77
- [13] Const mutate y$4$18 = read x$2$16_@1
78
- return
79
-}
80
-
81
-```
82
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
-43
@@ -14,49 +14,6 @@ function foo() {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate x$5:TPrimitive = 1
22
- [2] Const mutate y$6:TPrimitive = 2
23
- [3] Const mutate $7:TPrimitive = 2
24
- [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive
25
- [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive
26
- [5] If (read $8:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
27
-bb2:
28
- predecessor blocks: bb0
29
- [6] Const mutate x$1$9:TPrimitive = 3
30
- [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive
31
- [7] Goto bb1
32
-bb1:
33
- predecessor blocks: bb2 bb0
34
- [8] Const mutate y$2$11 = read x$0$10_@0
35
- [9] Return
36
-```
37
-
38
-## Reactive Scopes
39
-
40
-```
41
-function foo(
42
-) {
43
- [1] Const mutate x$5:TPrimitive = 1
44
- [2] Const mutate y$6:TPrimitive = 2
45
- [3] Const mutate $7:TPrimitive = 2
46
- [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive
47
- scope @0 [1:8] deps=[] out=[x$0$10_@0] {
48
- [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive
49
- if (read $8:TPrimitive) {
50
- [6] Const mutate x$1$9:TPrimitive = 3
51
- [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive
52
- }
53
- }
54
- [8] Const mutate y$2$11 = read x$0$10_@0
55
- return
56
-}
57
-
58
-```
59
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
-36
@@ -15,42 +15,6 @@ function foo(cond) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate items$5_@0 = Array []
23
- [2] Goto bb1
24
-bb1:
25
- predecessor blocks: bb0 bb4
26
- [3] If (read items$5_@0) then:bb3 else:bb2 fallthrough=bb2
27
-bb3:
28
- predecessor blocks: bb1
29
- [4] Const mutate y$7:TPrimitive = 0
30
- [5] If (read cond$4) then:bb5 else:bb4 fallthrough=bb4
31
-bb5:
32
- predecessor blocks: bb3
33
- [6] Const mutate y$9:TPrimitive = 1
34
- [7] Goto bb4
35
-bb4:
36
- predecessor blocks: bb5 bb3
37
- [8] Goto(Continue) bb1
38
-bb2:
39
- predecessor blocks: bb1
40
- [9] Return freeze items$5_@0
41
-```
42
-
43
-## Reactive Scopes
44
-
45
-```
46
-function foo(
47
- cond,
48
-) {
49
- [1] Const mutate items$5_@0 = Array []
50
-}
51
-
52
-```
53
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md
-54
@@ -12,60 +12,6 @@ function foo() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Let mutate x$6_@0:TPrimitive[1:13] = 1
20
- [2] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2
21
-bb3:
22
- predecessor blocks: bb0
23
- [3] Const mutate i$7:TPrimitive = 0
24
- [4] Goto bb1
25
-bb1:
26
- predecessor blocks: bb3 bb4
27
- [5] Const mutate $8:TPrimitive = 10
28
- [6] Const mutate $10:TPrimitive = Binary read i$7:TPrimitive < read $8:TPrimitive
29
- [7] If (read $10:TPrimitive) then:bb5 else:bb2 fallthrough=bb2
30
-bb5:
31
- predecessor blocks: bb1
32
- [8] Const mutate $11:TPrimitive = 1
33
- [9] Reassign mutate x$6_@0:TPrimitive[1:13] = Binary read x$6_@0:TPrimitive + read $11:TPrimitive
34
- [10] Goto(Continue) bb4
35
-bb4:
36
- predecessor blocks: bb5
37
- [11] read i$7:TPrimitive
38
- [12] Goto bb1
39
-bb2:
40
- predecessor blocks: bb1
41
- [13] Return read x$6_@0:TPrimitive
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function foo(
48
-) {
49
- scope @0 [1:13] deps=[] out=[x$6_@0] {
50
- [1] Let mutate x$6_@0:TPrimitive[1:13] = 1
51
- for (
52
- [3] Const mutate i$7:TPrimitive = 0
53
- ;
54
- [5] Const mutate $8:TPrimitive = 10
55
- [6] Const mutate $10:TPrimitive = Binary read i$7:TPrimitive < read $8:TPrimitive
56
- read $10:TPrimitive
57
- ;
58
- read i$7:TPrimitive
59
- ) {
60
- [8] Const mutate $11:TPrimitive = 1
61
- [9] Reassign mutate x$6_@0:TPrimitive[1:13] = Binary read x$6_@0:TPrimitive + read $11:TPrimitive
62
- }
63
- }
64
- return read x$6_@0:TPrimitive
65
-}
66
-
67
-```
68
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
-58
@@ -12,64 +12,6 @@ function foo() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Let mutate x$7_@1:TPrimitive[1:15] = 1
20
- [2] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2
21
-bb3:
22
- predecessor blocks: bb0
23
- [3] Let mutate i$8_@1:TPrimitive[1:15] = 0
24
- [4] Goto bb1
25
-bb1:
26
- predecessor blocks: bb3 bb4
27
- [5] Const mutate $9:TPrimitive = 10
28
- [6] Const mutate $11:TPrimitive = Binary read i$8_@1:TPrimitive < read $9:TPrimitive
29
- [7] If (read $11:TPrimitive) then:bb5 else:bb2 fallthrough=bb2
30
-bb5:
31
- predecessor blocks: bb1
32
- [8] Const mutate $12:TPrimitive = 1
33
- [9] Reassign mutate x$7_@1:TPrimitive[1:15] = Binary read x$7_@1:TPrimitive + read $12:TPrimitive
34
- [10] Goto(Continue) bb4
35
-bb4:
36
- predecessor blocks: bb5
37
- [11] Const mutate $15:TPrimitive = 1
38
- [12] Reassign mutate i$8_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive + read $15:TPrimitive
39
- [13] read i$8_@1:TPrimitive
40
- [14] Goto bb1
41
-bb2:
42
- predecessor blocks: bb1
43
- [15] Return read x$7_@1:TPrimitive
44
-```
45
-
46
-## Reactive Scopes
47
-
48
-```
49
-function foo(
50
-) {
51
- scope @1 [1:15] deps=[] out=[x$7_@1] {
52
- [1] Let mutate x$7_@1:TPrimitive[1:15] = 1
53
- for (
54
- [3] Let mutate i$8_@1:TPrimitive[1:15] = 0
55
- ;
56
- [5] Const mutate $9:TPrimitive = 10
57
- [6] Const mutate $11:TPrimitive = Binary read i$8_@1:TPrimitive < read $9:TPrimitive
58
- read $11:TPrimitive
59
- ;
60
- [11] Const mutate $15:TPrimitive = 1
61
- [12] Reassign mutate i$8_@1:TPrimitive[1:15] = Binary read i$8_@1:TPrimitive + read $15:TPrimitive
62
- read i$8_@1:TPrimitive
63
- ) {
64
- [8] Const mutate $12:TPrimitive = 1
65
- [9] Reassign mutate x$7_@1:TPrimitive[1:15] = Binary read x$7_@1:TPrimitive + read $12:TPrimitive
66
- }
67
- }
68
- return read x$7_@1:TPrimitive
69
-}
70
-
71
-```
72
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
-37
@@ -15,43 +15,6 @@ function foo() {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate x$5:TPrimitive = 1
23
- [2] Const mutate y$6:TPrimitive = 2
24
- [3] If (read y$6:TPrimitive) then:bb2 else:bb3 fallthrough=bb1
25
-bb2:
26
- predecessor blocks: bb0
27
- [4] Const mutate z$7:TPrimitive = Binary read x$5:TPrimitive + read y$6:TPrimitive
28
- [5] Goto bb1
29
-bb3:
30
- predecessor blocks: bb0
31
- [6] Const mutate z$8:TPrimitive = read x$5:TPrimitive
32
- [7] Goto bb1
33
-bb1:
34
- predecessor blocks: bb2 bb3
35
- [8] Return
36
-```
37
-
38
-## Reactive Scopes
39
-
40
-```
41
-function foo(
42
-) {
43
- [1] Const mutate x$5:TPrimitive = 1
44
- [2] Const mutate y$6:TPrimitive = 2
45
- if (read y$6:TPrimitive) {
46
- [4] Const mutate z$7:TPrimitive = Binary read x$5:TPrimitive + read y$6:TPrimitive
47
- } else {
48
- [6] Const mutate z$8:TPrimitive = read x$5:TPrimitive
49
- }
50
- return
51
-}
52
-
53
-```
54
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md
-93
@@ -24,99 +24,6 @@ function foo(a, b, c, d) {
24
25
```
26
27
-## HIR
28
-
29
-```
30
-bb0:
31
- [1] Const mutate x$13:TPrimitive = 0
32
- [2] Const mutate $14:TPrimitive = true
33
- [3] Let mutate x$0$23_@0[3:20] = undefined
34
- [3] If (read $14:TPrimitive) then:bb2 else:bb6 fallthrough=bb1
35
-bb2:
36
- predecessor blocks: bb0
37
- [4] Const mutate $15:TPrimitive = true
38
- [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3
39
-bb4:
40
- predecessor blocks: bb2
41
- [6] Const mutate x$1$16 = read a$9
42
- [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16
43
- [7] Goto bb3
44
-bb5:
45
- predecessor blocks: bb2
46
- [8] Const mutate x$2$17 = read b$10
47
- [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17
48
- [9] Goto bb3
49
-bb3:
50
- predecessor blocks: bb4 bb5
51
- [10] read x$3$18
52
- [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18
53
- [11] Goto bb1
54
-bb6:
55
- predecessor blocks: bb0
56
- [12] Const mutate $19:TPrimitive = true
57
- [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7
58
-bb8:
59
- predecessor blocks: bb6
60
- [14] Const mutate x$4$20 = read c$11
61
- [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20
62
- [15] Goto bb7
63
-bb9:
64
- predecessor blocks: bb6
65
- [16] Const mutate x$5$21 = read d$12
66
- [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21
67
- [17] Goto bb7
68
-bb7:
69
- predecessor blocks: bb8 bb9
70
- [18] read x$6$22
71
- [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22
72
- [19] Goto bb1
73
-bb1:
74
- predecessor blocks: bb3 bb7
75
- [20] Return read x$0$23_@0
76
-```
77
-
78
-## Reactive Scopes
79
-
80
-```
81
-function foo(
82
- a,
83
- b,
84
- c,
85
- d,
86
-) {
87
- [1] Const mutate x$13:TPrimitive = 0
88
- [2] Const mutate $14:TPrimitive = true
89
- scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] out=[x$0$23_@0] {
90
- [3] Let mutate x$0$23_@0[3:20] = undefined
91
- if (read $14:TPrimitive) {
92
- [4] Const mutate $15:TPrimitive = true
93
- if (read $15:TPrimitive) {
94
- [6] Const mutate x$1$16 = read a$9
95
- [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16
96
- } else {
97
- [8] Const mutate x$2$17 = read b$10
98
- [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17
99
- }
100
- [10] read x$3$18
101
- [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18
102
- } else {
103
- [12] Const mutate $19:TPrimitive = true
104
- if (read $19:TPrimitive) {
105
- [14] Const mutate x$4$20 = read c$11
106
- [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20
107
- } else {
108
- [16] Const mutate x$5$21 = read d$12
109
- [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21
110
- }
111
- [18] read x$6$22
112
- [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22
113
- }
114
- }
115
- return read x$0$23_@0
116
-}
117
-
118
-```
119
-
27
## Code
28
29
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md
-65
@@ -17,71 +17,6 @@ function foo(a, b, c) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$9:TPrimitive = 0
25
- [2] While test=bb1 loop=bb3 fallthrough=bb2
26
-bb1:
27
- predecessor blocks: bb0 bb5
28
- [3] If (read a$6) then:bb3 else:bb2 fallthrough=bb2
29
-bb3:
30
- predecessor blocks: bb1
31
- [4] While test=bb4 loop=bb6 fallthrough=bb5
32
-bb4:
33
- predecessor blocks: bb3 bb8
34
- [5] If (read b$7) then:bb6 else:bb5 fallthrough=bb5
35
-bb6:
36
- predecessor blocks: bb4
37
- [6] While test=bb7 loop=bb9 fallthrough=bb8
38
-bb7:
39
- predecessor blocks: bb6 bb9
40
- [7] If (read c$8) then:bb9 else:bb8 fallthrough=bb8
41
-bb9:
42
- predecessor blocks: bb7
43
- [8] Const mutate $13:TPrimitive = 1
44
- [9] Binary read x$9:TPrimitive + read $13:TPrimitive
45
- [10] Goto(Continue) bb7
46
-bb8:
47
- predecessor blocks: bb7
48
- [11] Goto(Continue) bb4
49
-bb5:
50
- predecessor blocks: bb4
51
- [12] Goto(Continue) bb1
52
-bb2:
53
- predecessor blocks: bb1
54
- [13] Return read x$9:TPrimitive
55
-```
56
-
57
-## Reactive Scopes
58
-
59
-```
60
-function foo(
61
- a,
62
- b,
63
- c,
64
-) {
65
- [1] Const mutate x$9:TPrimitive = 0
66
- while (
67
- read a$6
68
- ) {
69
- while (
70
- read b$7
71
- ) {
72
- while (
73
- read c$8
74
- ) {
75
- [8] Const mutate $13:TPrimitive = 1
76
- [9] Binary read x$9:TPrimitive + read $13:TPrimitive
77
- }
78
- }
79
- }
80
- return read x$9:TPrimitive
81
-}
82
-
83
-```
84
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md
-48
@@ -14,54 +14,6 @@ function foo(a, b, c) {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate x$8 = read a$5
22
- [2] If (read b$6) then:bb2 else:bb1 fallthrough=bb1
23
-bb2:
24
- predecessor blocks: bb0
25
- [3] Let mutate x$0$10_@0[1:6] = read x$8
26
- [3] If (read c$7) then:bb4 else:bb3 fallthrough=bb3
27
-bb4:
28
- predecessor blocks: bb2
29
- [4] Const mutate x$1$9 = read c$7
30
- [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9
31
- [5] Goto bb3
32
-bb3:
33
- predecessor blocks: bb4 bb2
34
- [6] read x$0$10_@0
35
- [7] Goto bb1
36
-bb1:
37
- predecessor blocks: bb3 bb0
38
- [8] Return
39
-```
40
-
41
-## Reactive Scopes
42
-
43
-```
44
-function foo(
45
- a,
46
- b,
47
- c,
48
-) {
49
- [1] Const mutate x$8 = read a$5
50
- if (read b$6) {
51
- scope @0 [1:6] deps=[read c$7] out=[x$0$10_@0] {
52
- [3] Let mutate x$0$10_@0[1:6] = read x$8
53
- if (read c$7) {
54
- [4] Const mutate x$1$9 = read c$7
55
- [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9
56
- }
57
- }
58
- [6] read x$0$10_@0
59
- }
60
- return
61
-}
62
-
63
-```
64
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md
-53
@@ -16,59 +16,6 @@ function foo(a, b, c, d, e) {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Const mutate x$12:TPrimitive = null
24
- [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive
25
- [2] If (read a$7) then:bb2 else:bb3 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [3] Const mutate x$1$13 = read b$8
29
- [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13
30
- [4] Goto bb1
31
-bb3:
32
- predecessor blocks: bb0
33
- [5] If (read c$9) then:bb5 else:bb1 fallthrough=bb1
34
-bb5:
35
- predecessor blocks: bb3
36
- [6] Const mutate x$2$14 = read d$10
37
- [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14
38
- [7] Goto bb1
39
-bb1:
40
- predecessor blocks: bb2 bb5 bb3
41
- [8] Return read x$0$15_@0
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function foo(
48
- a,
49
- b,
50
- c,
51
- d,
52
- e,
53
-) {
54
- [1] Const mutate x$12:TPrimitive = null
55
- scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] out=[x$0$15_@0] {
56
- [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive
57
- if (read a$7) {
58
- [3] Const mutate x$1$13 = read b$8
59
- [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13
60
- } else {
61
- if (read c$9) {
62
- [6] Const mutate x$2$14 = read d$10
63
- [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14
64
- }
65
- }
66
- }
67
- return read x$0$15_@0
68
-}
69
-
70
-```
71
-
19
## Code
20
21
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
-43
@@ -13,55 +13,12 @@ function Component(props) {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Return
21
-```
22
-
23
-## Reactive Scopes
24
-
25
-```
26
-function Foo(
27
-) {
28
- return
29
-}
30
-
31
-```
32
-
16
## Code
17
18
```javascript
19
function Foo() {}
20
21
```
39
-## HIR
40
-
41
-```
42
-bb0:
43
- [1] Const mutate a$7_@0[1:4] = Array []
44
- [2] Const mutate b$8_@0:TObject[1:4] = Object { }
45
- [3] Const mutate c$9_@0[1:4] = New mutate Foo$4(mutate a$7_@0, mutate b$8_@0:TObject)
46
- [4] Return freeze c$9_@0
47
-```
48
-
49
-## Reactive Scopes
50
-
51
-```
52
-function Component(
53
- props,
54
-) {
55
- scope @0 [1:4] deps=[] out=[c$9_@0] {
56
- [1] Const mutate a$7_@0[1:4] = Array []
57
- [2] Const mutate b$8_@0:TObject[1:4] = Object { }
58
- [3] Const mutate c$9_@0[1:4] = New mutate Foo$4(mutate a$7_@0, mutate b$8_@0:TObject)
59
- }
60
- return freeze c$9_@0
61
-}
62
-
63
-```
64
-
22
## Code
23
24
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
-55
@@ -18,61 +18,6 @@ function foo() {
18
19
```
20
21
-## HIR
22
-
23
-```
24
-bb0:
25
- [1] Const mutate x$6:TPrimitive = 1
26
- [2] Const mutate y$7:TPrimitive = 2
27
- [3] Const mutate $8:TPrimitive = 1
28
- [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive
29
- [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive
30
- [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive
31
- [5] If (read $9:TPrimitive) then:bb2 else:bb3 fallthrough=bb1
32
-bb2:
33
- predecessor blocks: bb0
34
- [6] Const mutate x$2$10:TPrimitive = 2
35
- [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive
36
- [7] Goto bb1
37
-bb3:
38
- predecessor blocks: bb0
39
- [8] Const mutate y$3$11:TPrimitive = 3
40
- [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive
41
- [9] Goto bb1
42
-bb1:
43
- predecessor blocks: bb2 bb3
44
- [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 }
45
- [11] Return freeze t$14_@2:TObject
46
-```
47
-
48
-## Reactive Scopes
49
-
50
-```
51
-function foo(
52
-) {
53
- [1] Const mutate x$6:TPrimitive = 1
54
- [2] Const mutate y$7:TPrimitive = 2
55
- [3] Const mutate $8:TPrimitive = 1
56
- [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive
57
- scope @0 [1:10] deps=[] out=[x$0$12_@0] {
58
- [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive
59
- [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive
60
- if (read $9:TPrimitive) {
61
- [6] Const mutate x$2$10:TPrimitive = 2
62
- [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive
63
- } else {
64
- [8] Const mutate y$3$11:TPrimitive = 3
65
- [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive
66
- }
67
- }
68
- scope @2 [10:11] deps=[read x$0$12_@0, read y$1$13_@0] out=[t$14_@2] {
69
- [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 }
70
- }
71
- return freeze t$14_@2:TObject
72
-}
73
-
74
-```
75
-
21
## Code
22
23
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
-26
@@ -11,32 +11,6 @@ function Component(props) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate a$6:TPrimitive = 1
19
- [2] Const mutate b$7:TPrimitive = 2
20
- [3] Const mutate x$8_@0:TObject = Object { a: read a$6:TPrimitive, b: read b$7:TPrimitive }
21
- [4] Return freeze x$8_@0:TObject
22
-```
23
-
24
-## Reactive Scopes
25
-
26
-```
27
-function Component(
28
- props,
29
-) {
30
- [1] Const mutate a$6:TPrimitive = 1
31
- [2] Const mutate b$7:TPrimitive = 2
32
- scope @0 [3:4] deps=[] out=[x$8_@0] {
33
- [3] Const mutate x$8_@0:TObject = Object { a: read a$6:TPrimitive, b: read b$7:TPrimitive }
34
- }
35
- return freeze x$8_@0:TObject
36
-}
37
-
38
-```
39
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md
-46
@@ -18,52 +18,6 @@ function foo(a) {
18
19
```
20
21
-## HIR
22
-
23
-```
24
-bb0:
25
- [1] Const mutate b$8_@0:TObject[1:11] = Object { }
26
- [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject
27
- [3] If (read a$7) then:bb2 else:bb3 fallthrough=bb1
28
-bb2:
29
- predecessor blocks: bb0
30
- [4] Const mutate y$10_@0:TObject[1:11] = Object { }
31
- [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject
32
- [6] Goto bb1
33
-bb3:
34
- predecessor blocks: bb0
35
- [7] Const mutate z$11_@0:TObject[1:11] = Object { }
36
- [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject
37
- [9] Goto bb1
38
-bb1:
39
- predecessor blocks: bb2 bb3
40
- [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject)
41
- [11] Return freeze x$9_@0:TObject
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function foo(
48
- a,
49
-) {
50
- scope @0 [1:11] deps=[read a$7] out=[x$9_@0] {
51
- [1] Const mutate b$8_@0:TObject[1:11] = Object { }
52
- [2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject
53
- if (read a$7) {
54
- [4] Const mutate y$10_@0:TObject[1:11] = Object { }
55
- [5] Reassign store x$9_@0.y[1:11] = read y$10_@0:TObject
56
- } else {
57
- [7] Const mutate z$11_@0:TObject[1:11] = Object { }
58
- [8] Reassign store x$9_@0.z[1:11] = read z$11_@0:TObject
59
- }
60
- [10] Call mutate mutate$6:TFunction(mutate b$8_@0:TObject)
61
- }
62
- return freeze x$9_@0:TObject
63
-}
64
-
65
-```
66
-
21
## Code
22
23
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md
-46
@@ -16,52 +16,6 @@ function foo(a) {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
24
- [2] If (read a$5) then:bb2 else:bb3 fallthrough=bb1
25
-bb2:
26
- predecessor blocks: bb0
27
- [3] Const mutate y$7_@1:TObject = Object { }
28
- [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject
29
- [5] Goto bb1
30
-bb3:
31
- predecessor blocks: bb0
32
- [6] Const mutate z$8_@2:TObject = Object { }
33
- [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject
34
- [8] Goto bb1
35
-bb1:
36
- predecessor blocks: bb2 bb3
37
- [9] Return freeze x$6_@0:TObject
38
-```
39
-
40
-## Reactive Scopes
41
-
42
-```
43
-function foo(
44
- a,
45
-) {
46
- scope @0 [1:9] deps=[read a$5] out=[x$6_@0] {
47
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
48
- if (read a$5) {
49
- scope @1 [3:4] deps=[] out=[y$7_@1] {
50
- [3] Const mutate y$7_@1:TObject = Object { }
51
- }
52
- [4] Reassign store x$6_@0.y[1:9] = read y$7_@1:TObject
53
- } else {
54
- scope @2 [6:7] deps=[] out=[z$8_@2] {
55
- [6] Const mutate z$8_@2:TObject = Object { }
56
- }
57
- [7] Reassign store x$6_@0.z[1:9] = read z$8_@2:TObject
58
- }
59
- }
60
- return freeze x$6_@0:TObject
61
-}
62
-
63
-```
64
-
19
## Code
20
21
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md
-44
@@ -17,50 +17,6 @@ function foo(a) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
25
- [2] If (read a$6) then:bb2 else:bb3 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
29
- [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject
30
- [5] Goto bb1
31
-bb3:
32
- predecessor blocks: bb0
33
- [6] Const mutate z$9_@0:TObject[1:10] = Object { }
34
- [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject
35
- [8] Goto bb1
36
-bb1:
37
- predecessor blocks: bb2 bb3
38
- [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject)
39
- [10] Return freeze x$7_@0:TObject
40
-```
41
-
42
-## Reactive Scopes
43
-
44
-```
45
-function foo(
46
- a,
47
-) {
48
- scope @0 [1:10] deps=[read a$6] out=[x$7_@0] {
49
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
50
- if (read a$6) {
51
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
52
- [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject
53
- } else {
54
- [6] Const mutate z$9_@0:TObject[1:10] = Object { }
55
- [7] Reassign store x$7_@0.z[1:10] = read z$9_@0:TObject
56
- }
57
- [9] Call mutate mutate$5:TFunction(mutate x$7_@0:TObject)
58
- }
59
- return freeze x$7_@0:TObject
60
-}
61
-
62
-```
63
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md
-46
@@ -17,52 +17,6 @@ function foo(a) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
25
- [2] If (read a$6) then:bb2 else:bb3 fallthrough=bb1
26
-bb2:
27
- predecessor blocks: bb0
28
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
29
- [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject
30
- [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject)
31
- [6] Goto bb1
32
-bb3:
33
- predecessor blocks: bb0
34
- [7] Const mutate z$9_@1:TObject = Object { }
35
- [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject
36
- [9] Goto bb1
37
-bb1:
38
- predecessor blocks: bb2 bb3
39
- [10] Return freeze x$7_@0:TObject
40
-```
41
-
42
-## Reactive Scopes
43
-
44
-```
45
-function foo(
46
- a,
47
-) {
48
- scope @0 [1:10] deps=[read a$6] out=[x$7_@0] {
49
- [1] Const mutate x$7_@0:TObject[1:10] = Object { }
50
- if (read a$6) {
51
- [3] Const mutate y$8_@0:TObject[1:10] = Object { }
52
- [4] Reassign store x$7_@0.y[1:10] = read y$8_@0:TObject
53
- [5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject)
54
- } else {
55
- scope @1 [7:8] deps=[] out=[z$9_@1] {
56
- [7] Const mutate z$9_@1:TObject = Object { }
57
- }
58
- [8] Reassign store x$7_@0.z[1:10] = read z$9_@1:TObject
59
- }
60
- }
61
- return freeze x$7_@0:TObject
62
-}
63
-
64
-```
65
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md
-29
@@ -15,35 +15,6 @@ function foo() {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
23
- [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject
24
- [3] Const mutate y$7_@0:TObject[1:6] = Object { }
25
- [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject
26
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
27
- [6] Return freeze y$7_@0:TObject
28
-```
29
-
30
-## Reactive Scopes
31
-
32
-```
33
-function foo(
34
-) {
35
- scope @0 [1:6] deps=[] out=[y$7_@0] {
36
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
37
- [2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject
38
- [3] Const mutate y$7_@0:TObject[1:6] = Object { }
39
- [4] Reassign store y$7_@0.x[1:6] = read x$6_@0:TObject
40
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
41
- }
42
- return freeze y$7_@0:TObject
43
-}
44
-
45
-```
46
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
-29
@@ -11,35 +11,6 @@ function foo() {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$4_@0 = Array []
19
- [2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 }
20
- [3] Const mutate $6_@1[2:5] = Array []
21
- [4] Call mutate y$5_@1.x.push(mutate $6_@1)
22
- [5] Return freeze y$5_@1:TObject
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function foo(
29
-) {
30
- scope @0 [1:2] deps=[] out=[x$4_@0] {
31
- [1] Const mutate x$4_@0 = Array []
32
- }
33
- scope @1 [2:5] deps=[read x$4_@0] out=[y$5_@1] {
34
- [2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 }
35
- [3] Const mutate $6_@1[2:5] = Array []
36
- [4] Call mutate y$5_@1.x.push(mutate $6_@1)
37
- }
38
- return freeze y$5_@1:TObject
39
-}
40
-
41
-```
42
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md
-27
@@ -12,33 +12,6 @@ function foo() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate x$4_@0[1:5] = Array []
20
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
21
- [3] Reassign store y$5_@0.x[1:5] = read x$4_@0
22
- [4] Call mutate mutate$3:TFunction(mutate x$4_@0)
23
- [5] Return freeze y$5_@0:TObject
24
-```
25
-
26
-## Reactive Scopes
27
-
28
-```
29
-function foo(
30
-) {
31
- scope @0 [1:5] deps=[] out=[y$5_@0] {
32
- [1] Const mutate x$4_@0[1:5] = Array []
33
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
34
- [3] Reassign store y$5_@0.x[1:5] = read x$4_@0
35
- [4] Call mutate mutate$3:TFunction(mutate x$4_@0)
36
- }
37
- return freeze y$5_@0:TObject
38
-}
39
-
40
-```
41
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md
-29
@@ -15,35 +15,6 @@ function foo() {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
23
- [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject
24
- [3] Const mutate x$7_@0[1:6] = Array []
25
- [4] Reassign store y$6_@0.x[1:6] = read x$7_@0
26
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
27
- [6] Return freeze y$6_@0:TObject
28
-```
29
-
30
-## Reactive Scopes
31
-
32
-```
33
-function foo(
34
-) {
35
- scope @0 [1:6] deps=[] out=[y$6_@0] {
36
- [1] Const mutate a$5_@0:TObject[1:6] = Object { }
37
- [2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject
38
- [3] Const mutate x$7_@0[1:6] = Array []
39
- [4] Reassign store y$6_@0.x[1:6] = read x$7_@0
40
- [5] Call mutate mutate$4:TFunction(mutate a$5_@0:TObject)
41
- }
42
- return freeze y$6_@0:TObject
43
-}
44
-
45
-```
46
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md
-27
@@ -12,33 +12,6 @@ function foo() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate x$4_@0[1:5] = Array []
20
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
21
- [3] Reassign store y$5_@0.x[1:5] = read x$4_@0
22
- [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject)
23
- [5] Return freeze y$5_@0:TObject
24
-```
25
-
26
-## Reactive Scopes
27
-
28
-```
29
-function foo(
30
-) {
31
- scope @0 [1:5] deps=[] out=[y$5_@0] {
32
- [1] Const mutate x$4_@0[1:5] = Array []
33
- [2] Const mutate y$5_@0:TObject[1:5] = Object { }
34
- [3] Reassign store y$5_@0.x[1:5] = read x$4_@0
35
- [4] Call mutate mutate$3:TFunction(mutate y$5_@0:TObject)
36
- }
37
- return freeze y$5_@0:TObject
38
-}
39
-
40
-```
41
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
-27
@@ -11,33 +11,6 @@ function foo() {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$3_@0 = Array []
19
- [2] Const mutate y$4_@1:TObject[2:4] = Object { }
20
- [3] Reassign store y$4_@1.x[2:4] = read x$3_@0
21
- [4] Return freeze y$4_@1:TObject
22
-```
23
-
24
-## Reactive Scopes
25
-
26
-```
27
-function foo(
28
-) {
29
- scope @0 [1:2] deps=[] out=[x$3_@0] {
30
- [1] Const mutate x$3_@0 = Array []
31
- }
32
- scope @1 [2:4] deps=[read x$3_@0] out=[y$4_@1] {
33
- [2] Const mutate y$4_@1:TObject[2:4] = Object { }
34
- [3] Reassign store y$4_@1.x[2:4] = read x$3_@0
35
- }
36
- return freeze y$4_@1:TObject
37
-}
38
-
39
-```
40
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md
-28
@@ -12,34 +12,6 @@ function foo(a, b, c) {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate x$8:TPrimitive = 0
20
- [2] Const mutate x$0$9 = read a$5
21
- [3] Const mutate x$1$10 = read b$6
22
- [4] Const mutate x$2$11 = read c$7
23
- [5] Return read x$2$11
24
-```
25
-
26
-## Reactive Scopes
27
-
28
-```
29
-function foo(
30
- a,
31
- b,
32
- c,
33
-) {
34
- [1] Const mutate x$8:TPrimitive = 0
35
- [2] Const mutate x$0$9 = read a$5
36
- [3] Const mutate x$1$10 = read b$6
37
- [4] Const mutate x$2$11 = read c$7
38
- return read x$2$11
39
-}
40
-
41
-```
42
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
-39
@@ -13,45 +13,6 @@ function foo() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate x$4:TPrimitive = 1
21
- [2] Const mutate $5:TPrimitive = 1
22
- [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive
23
- [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive
24
- [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
25
-bb2:
26
- predecessor blocks: bb0
27
- [5] Const mutate x$1$7:TPrimitive = 2
28
- [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive
29
- [6] Goto bb1
30
-bb1:
31
- predecessor blocks: bb2 bb0
32
- [7] Return read x$0$8_@0
33
-```
34
-
35
-## Reactive Scopes
36
-
37
-```
38
-function foo(
39
-) {
40
- [1] Const mutate x$4:TPrimitive = 1
41
- [2] Const mutate $5:TPrimitive = 1
42
- [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive
43
- scope @0 [1:7] deps=[] out=[x$0$8_@0] {
44
- [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive
45
- if (read $6:TPrimitive) {
46
- [5] Const mutate x$1$7:TPrimitive = 2
47
- [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive
48
- }
49
- }
50
- return read x$0$8_@0
51
-}
52
-
53
-```
54
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
-63
@@ -17,75 +17,12 @@ function Foo(cond) {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Return
25
-```
26
-
27
-## Reactive Scopes
28
-
29
-```
30
-function log(
31
-) {
32
- return
33
-}
34
-
35
-```
36
-
20
## Code
21
22
```javascript
23
function log() {}
24
25
```
43
-## HIR
44
-
45
-```
46
-bb0:
47
- [1] Const mutate str$6:TPrimitive = ""
48
- [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive
49
- [2] If (read cond$5) then:bb2 else:bb3 fallthrough=bb1
50
-bb2:
51
- predecessor blocks: bb0
52
- [3] Const mutate str$1$7:TPrimitive = "other test"
53
- [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive)
54
- [5] Goto bb1
55
-bb3:
56
- predecessor blocks: bb0
57
- [6] Const mutate str$2$8:TPrimitive = "fallthrough test"
58
- [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive
59
- [7] Goto bb1
60
-bb1:
61
- predecessor blocks: bb2 bb3
62
- [8] Call mutate log$4:TFunction(read str$0$10_@0)
63
- [9] Return
64
-```
65
-
66
-## Reactive Scopes
67
-
68
-```
69
-function Foo(
70
- cond,
71
-) {
72
- [1] Const mutate str$6:TPrimitive = ""
73
- scope @0 [1:8] deps=[read cond$5] out=[str$0$10_@0] {
74
- [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive
75
- if (read cond$5) {
76
- [3] Const mutate str$1$7:TPrimitive = "other test"
77
- [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive)
78
- } else {
79
- [6] Const mutate str$2$8:TPrimitive = "fallthrough test"
80
- [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive
81
- }
82
- }
83
- [8] Call mutate log$4:TFunction(read str$0$10_@0)
84
- return
85
-}
86
-
87
-```
88
-
26
## Code
27
28
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md
-93
@@ -24,99 +24,6 @@ function foo(a, b, c, d) {
24
25
```
26
27
-## HIR
28
-
29
-```
30
-bb0:
31
- [1] Const mutate x$13:TPrimitive = 0
32
- [2] Const mutate $14:TPrimitive = true
33
- [3] If (read $14:TPrimitive) then:bb2 else:bb6 fallthrough=bb1
34
-bb2:
35
- predecessor blocks: bb0
36
- [4] Const mutate $15:TPrimitive = true
37
- [5] Let mutate x$0$18_@0[5:10] = undefined
38
- [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3
39
-bb4:
40
- predecessor blocks: bb2
41
- [6] Const mutate x$1$16 = read a$9
42
- [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16
43
- [7] Goto bb3
44
-bb5:
45
- predecessor blocks: bb2
46
- [8] Const mutate x$2$17 = read b$10
47
- [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17
48
- [9] Goto bb3
49
-bb3:
50
- predecessor blocks: bb4 bb5
51
- [10] read x$0$18_@0
52
- [11] Goto bb1
53
-bb6:
54
- predecessor blocks: bb0
55
- [12] Const mutate $19:TPrimitive = true
56
- [13] Let mutate x$3$22_@1[13:18] = undefined
57
- [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7
58
-bb8:
59
- predecessor blocks: bb6
60
- [14] Const mutate x$4$20 = read c$11
61
- [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20
62
- [15] Goto bb7
63
-bb9:
64
- predecessor blocks: bb6
65
- [16] Const mutate x$5$21 = read d$12
66
- [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21
67
- [17] Goto bb7
68
-bb7:
69
- predecessor blocks: bb8 bb9
70
- [18] read x$3$22_@1
71
- [19] Goto bb1
72
-bb1:
73
- predecessor blocks: bb3 bb7
74
- [20] Return
75
-```
76
-
77
-## Reactive Scopes
78
-
79
-```
80
-function foo(
81
- a,
82
- b,
83
- c,
84
- d,
85
-) {
86
- [1] Const mutate x$13:TPrimitive = 0
87
- [2] Const mutate $14:TPrimitive = true
88
- if (read $14:TPrimitive) {
89
- [4] Const mutate $15:TPrimitive = true
90
- scope @0 [5:10] deps=[read a$9, read b$10] out=[x$0$18_@0] {
91
- [5] Let mutate x$0$18_@0[5:10] = undefined
92
- if (read $15:TPrimitive) {
93
- [6] Const mutate x$1$16 = read a$9
94
- [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16
95
- } else {
96
- [8] Const mutate x$2$17 = read b$10
97
- [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17
98
- }
99
- }
100
- [10] read x$0$18_@0
101
- } else {
102
- [12] Const mutate $19:TPrimitive = true
103
- scope @1 [13:18] deps=[read c$11, read d$12] out=[x$3$22_@1] {
104
- [13] Let mutate x$3$22_@1[13:18] = undefined
105
- if (read $19:TPrimitive) {
106
- [14] Const mutate x$4$20 = read c$11
107
- [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20
108
- } else {
109
- [16] Const mutate x$5$21 = read d$12
110
- [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21
111
- }
112
- }
113
- [18] read x$3$22_@1
114
- }
115
- return
116
-}
117
-
118
-```
119
-
27
## Code
28
29
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
-49
@@ -16,55 +16,6 @@ function foo() {
16
17
```
18
19
-## HIR
20
-
21
-```
22
-bb0:
23
- [1] Const mutate y$5:TPrimitive = 2
24
- [2] Const mutate $6:TPrimitive = 1
25
- [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive
26
- [4] Let mutate y$0$10_@0[4:9] = undefined
27
- [4] If (read $7:TPrimitive) then:bb2 else:bb3 fallthrough=bb1
28
-bb2:
29
- predecessor blocks: bb0
30
- [5] Const mutate y$1$8:TPrimitive = 1
31
- [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive
32
- [6] Goto bb1
33
-bb3:
34
- predecessor blocks: bb0
35
- [7] Const mutate y$2$9:TPrimitive = 2
36
- [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive
37
- [8] Goto bb1
38
-bb1:
39
- predecessor blocks: bb2 bb3
40
- [9] Const mutate x$11 = read y$0$10_@0
41
- [10] Return
42
-```
43
-
44
-## Reactive Scopes
45
-
46
-```
47
-function foo(
48
-) {
49
- [1] Const mutate y$5:TPrimitive = 2
50
- [2] Const mutate $6:TPrimitive = 1
51
- [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive
52
- scope @0 [4:9] deps=[] out=[y$0$10_@0] {
53
- [4] Let mutate y$0$10_@0[4:9] = undefined
54
- if (read $7:TPrimitive) {
55
- [5] Const mutate y$1$8:TPrimitive = 1
56
- [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive
57
- } else {
58
- [7] Const mutate y$2$9:TPrimitive = 2
59
- [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive
60
- }
61
- }
62
- [9] Const mutate x$11 = read y$0$10_@0
63
- return
64
-}
65
-
66
-```
67
-
19
## Code
20
21
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md
-21
@@ -9,27 +9,6 @@ function foo() {
9
10
```
11
12
-## HIR
13
-
14
-```
15
-bb0:
16
- [1] Const mutate x$3:TPrimitive = 1
17
- [2] Const mutate y$4:TPrimitive = 2
18
- [3] Return
19
-```
20
-
21
-## Reactive Scopes
22
-
23
-```
24
-function foo(
25
-) {
26
- [1] Const mutate x$3:TPrimitive = 1
27
- [2] Const mutate y$4:TPrimitive = 2
28
- return
29
-}
30
-
31
-```
32
-
12
## Code
13
14
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md
-31
@@ -13,37 +13,6 @@ function foo() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate x$4:TPrimitive = 1
21
- [2] Const mutate y$5:TPrimitive = 2
22
- [3] If (read y$5:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
23
-bb2:
24
- predecessor blocks: bb0
25
- [4] Const mutate z$6:TPrimitive = Binary read x$4:TPrimitive + read y$5:TPrimitive
26
- [5] Goto bb1
27
-bb1:
28
- predecessor blocks: bb2 bb0
29
- [6] Return
30
-```
31
-
32
-## Reactive Scopes
33
-
34
-```
35
-function foo(
36
-) {
37
- [1] Const mutate x$4:TPrimitive = 1
38
- [2] Const mutate y$5:TPrimitive = 2
39
- if (read y$5:TPrimitive) {
40
- [4] Const mutate z$6:TPrimitive = Binary read x$4:TPrimitive + read y$5:TPrimitive
41
- }
42
- return
43
-}
44
-
45
-```
46
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
-77
@@ -24,83 +24,6 @@ function foo() {
24
25
```
26
27
-## HIR
28
-
29
-```
30
-bb0:
31
- [1] Const mutate x$10:TPrimitive = 1
32
- [2] Const mutate $11:TPrimitive = 2
33
- [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive
34
- [4] Const mutate $13:TPrimitive = 1
35
- [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive
36
- [6] Let mutate x$0$21_@0[6:16] = undefined
37
- [6] Switch (read x$10:TPrimitive)
38
- Case read $14:TPrimitive: bb5
39
- Case read $12:TPrimitive: bb3
40
- Default: bb2
41
- Fallthrough: bb1
42
-bb5:
43
- predecessor blocks: bb0
44
- [7] Const mutate $15:TPrimitive = 1
45
- [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive
46
- [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive
47
- [9] Goto bb1
48
-bb3:
49
- predecessor blocks: bb0
50
- [10] Const mutate $17:TPrimitive = 2
51
- [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive
52
- [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive
53
- [12] Goto bb1
54
-bb2:
55
- predecessor blocks: bb0
56
- [13] Const mutate $19:TPrimitive = 3
57
- [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive
58
- [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive
59
- [15] Goto bb1
60
-bb1:
61
- predecessor blocks: bb5 bb3 bb2
62
- [16] Const mutate y$22 = read x$0$21_@0
63
- [17] Return
64
-```
65
-
66
-## Reactive Scopes
67
-
68
-```
69
-function foo(
70
-) {
71
- [1] Const mutate x$10:TPrimitive = 1
72
- [2] Const mutate $11:TPrimitive = 2
73
- [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive
74
- [4] Const mutate $13:TPrimitive = 1
75
- [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive
76
- scope @0 [6:16] deps=[] out=[x$0$21_@0] {
77
- [6] Let mutate x$0$21_@0[6:16] = undefined
78
- switch (read x$10:TPrimitive) {
79
- case read $14:TPrimitive: {
80
- [7] Const mutate $15:TPrimitive = 1
81
- [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive
82
- [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive
83
- break bb1
84
- }
85
- case read $12:TPrimitive: {
86
- [10] Const mutate $17:TPrimitive = 2
87
- [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive
88
- [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive
89
- break bb1
90
- }
91
- default: {
92
- [13] Const mutate $19:TPrimitive = 3
93
- [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive
94
- [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive
95
- }
96
- }
97
- }
98
- [16] Const mutate y$22 = read x$0$21_@0
99
- return
100
-}
101
-
102
-```
103
-
27
## Code
28
29
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
-39
@@ -12,45 +12,6 @@ function foo() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate x$4:TPrimitive = 1
20
- [2] Const mutate $5:TPrimitive = 1
21
- [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive
22
- [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive
23
- [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
24
-bb2:
25
- predecessor blocks: bb0
26
- [5] Const mutate x$1$7:TPrimitive = 2
27
- [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive
28
- [6] Goto bb1
29
-bb1:
30
- predecessor blocks: bb2 bb0
31
- [7] Throw read x$0$8_@0
32
-```
33
-
34
-## Reactive Scopes
35
-
36
-```
37
-function foo(
38
-) {
39
- [1] Const mutate x$4:TPrimitive = 1
40
- [2] Const mutate $5:TPrimitive = 1
41
- [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive
42
- scope @0 [1:7] deps=[] out=[x$0$8_@0] {
43
- [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive
44
- if (read $6:TPrimitive) {
45
- [5] Const mutate x$1$7:TPrimitive = 2
46
- [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive
47
- }
48
- }
49
- throw read x$0$8_@0
50
-}
51
-
52
-```
53
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md
-40
@@ -13,46 +13,6 @@ function foo() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Const mutate x$5:TPrimitive = 1
21
- [2] While test=bb1 loop=bb3 fallthrough=bb2
22
-bb1:
23
- predecessor blocks: bb0 bb3
24
- [3] Const mutate $6:TPrimitive = 10
25
- [4] Const mutate $8:TPrimitive = Binary read x$5:TPrimitive < read $6:TPrimitive
26
- [5] If (read $8:TPrimitive) then:bb3 else:bb2 fallthrough=bb2
27
-bb3:
28
- predecessor blocks: bb1
29
- [6] Const mutate $9:TPrimitive = 1
30
- [7] Binary read x$5:TPrimitive + read $9:TPrimitive
31
- [8] Goto(Continue) bb1
32
-bb2:
33
- predecessor blocks: bb1
34
- [9] Return read x$5:TPrimitive
35
-```
36
-
37
-## Reactive Scopes
38
-
39
-```
40
-function foo(
41
-) {
42
- [1] Const mutate x$5:TPrimitive = 1
43
- while (
44
- [3] Const mutate $6:TPrimitive = 10
45
- [4] Const mutate $8:TPrimitive = Binary read x$5:TPrimitive < read $6:TPrimitive
46
- read $8:TPrimitive
47
- ) {
48
- [6] Const mutate $9:TPrimitive = 1
49
- [7] Binary read x$5:TPrimitive + read $9:TPrimitive
50
- }
51
- return read x$5:TPrimitive
52
-}
53
-
54
-```
55
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
-42
@@ -13,48 +13,6 @@ function foo() {
13
14
```
15
16
-## HIR
17
-
18
-```
19
-bb0:
20
- [1] Let mutate x$5_@0:TPrimitive[1:9] = 1
21
- [2] While test=bb1 loop=bb3 fallthrough=bb2
22
-bb1:
23
- predecessor blocks: bb0 bb3
24
- [3] Const mutate $6:TPrimitive = 10
25
- [4] Const mutate $8:TPrimitive = Binary read x$5_@0:TPrimitive < read $6:TPrimitive
26
- [5] If (read $8:TPrimitive) then:bb3 else:bb2 fallthrough=bb2
27
-bb3:
28
- predecessor blocks: bb1
29
- [6] Const mutate $9:TPrimitive = 1
30
- [7] Reassign mutate x$5_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive + read $9:TPrimitive
31
- [8] Goto(Continue) bb1
32
-bb2:
33
- predecessor blocks: bb1
34
- [9] Return read x$5_@0:TPrimitive
35
-```
36
-
37
-## Reactive Scopes
38
-
39
-```
40
-function foo(
41
-) {
42
- scope @0 [1:9] deps=[] out=[x$5_@0] {
43
- [1] Let mutate x$5_@0:TPrimitive[1:9] = 1
44
- while (
45
- [3] Const mutate $6:TPrimitive = 10
46
- [4] Const mutate $8:TPrimitive = Binary read x$5_@0:TPrimitive < read $6:TPrimitive
47
- read $8:TPrimitive
48
- ) {
49
- [6] Const mutate $9:TPrimitive = 1
50
- [7] Reassign mutate x$5_@0:TPrimitive[1:9] = Binary read x$5_@0:TPrimitive + read $9:TPrimitive
51
- }
52
- }
53
- return read x$5_@0:TPrimitive
54
-}
55
-
56
-```
57
-
16
## Code
17
18
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
-81
@@ -28,87 +28,6 @@ function Component(props) {
28
29
```
30
31
-## HIR
32
-
33
-```
34
-bb0:
35
- [1] Const mutate x$10_@1[1:12] = Array []
36
- [2] Const mutate y$11:TPrimitive = undefined
37
- [3] Const mutate $12:TPrimitive = false
38
- [4] Const mutate $13:TPrimitive = true
39
- [5] Const mutate $14:TPrimitive = 1
40
- [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive
41
- [6] Switch (read props$9.p0)
42
- Case read $14:TPrimitive: bb1
43
- Case read $13:TPrimitive: bb6
44
- Default: bb1
45
- Case read $12:TPrimitive: bb2
46
- Fallthrough: bb1
47
-bb6:
48
- predecessor blocks: bb0
49
- [7] Call mutate x$10_@1.push(read props$9.p2)
50
- [8] Const mutate y$1$15_@2 = Array []
51
- [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2
52
- [9] Goto bb1
53
-bb2:
54
- predecessor blocks: bb0
55
- [10] Const mutate y$2$16 = read x$10_@1
56
- [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16
57
- [11] Goto bb1
58
-bb1:
59
- predecessor blocks: bb0 bb6 bb2
60
- [12] Const mutate child$19_@3 = JSX <read Component$0 data={freeze x$10_@1} ></read Component$0>
61
- [13] Call read y$0$20_@1.push(read props$9.p4)
62
- [14] Const mutate t8$22_@4 = JSX <read Component$0 data={freeze y$0$20_@1} >{read child$19_@3}</read Component$0>
63
- [15] Return read t8$22_@4
64
-```
65
-
66
-## Reactive Scopes
67
-
68
-```
69
-function Component(
70
- props,
71
-) {
72
- scope @1 [1:12] deps=[read props$9.p0, read props$9.p2] out=[x$10_@1] {
73
- [1] Const mutate x$10_@1[1:12] = Array []
74
- [2] Const mutate y$11:TPrimitive = undefined
75
- [3] Const mutate $12:TPrimitive = false
76
- [4] Const mutate $13:TPrimitive = true
77
- [5] Const mutate $14:TPrimitive = 1
78
- [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive
79
- switch (read props$9.p0) {
80
- case read $14:TPrimitive: {
81
- break bb1
82
- }
83
- case read $13:TPrimitive: {
84
- [7] Call mutate x$10_@1.push(read props$9.p2)
85
- scope @2 [8:9] deps=[] out=[y$1$15_@2] {
86
- [8] Const mutate y$1$15_@2 = Array []
87
- }
88
- [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2
89
- break bb1
90
- }
91
- default: {
92
- break bb1
93
- }
94
- case read $12:TPrimitive: {
95
- [10] Const mutate y$2$16 = read x$10_@1
96
- [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16
97
- }
98
- }
99
- }
100
- scope @3 [12:13] deps=[freeze x$10_@1] out=[child$19_@3] {
101
- [12] Const mutate child$19_@3 = JSX <read Component$0 data={freeze x$10_@1} ></read Component$0>
102
- }
103
- [13] Call read y$0$20_@1.push(read props$9.p4)
104
- scope @4 [14:15] deps=[freeze y$0$20_@1, read child$19_@3] out=[$22_@4] {
105
- [14] Const mutate $22_@4 = JSX <read Component$0 data={freeze y$0$20_@1} >{read child$19_@3}</read Component$0>
106
- }
107
- return read $22_@4
108
-}
109
-
110
-```
111
-
31
## Code
32
33
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md
-92
@@ -32,98 +32,6 @@ function foo(x) {
32
33
```
34
35
-## HIR
36
-
37
-```
38
-bb0:
39
- [1] Const mutate y$10:TPrimitive = undefined
40
- [2] Const mutate $11:TPrimitive = 5
41
- [3] Const mutate $12:TPrimitive = 4
42
- [4] Const mutate $13:TPrimitive = 3
43
- [5] Const mutate $14:TPrimitive = 2
44
- [6] Const mutate $15:TPrimitive = 1
45
- [7] Const mutate $16:TPrimitive = 0
46
- [8] Switch (read x$9)
47
- Case read $16:TPrimitive: bb10
48
- Case read $15:TPrimitive: bb9
49
- Case read $14:TPrimitive: bb1
50
- Case read $13:TPrimitive: bb5
51
- Case read $12:TPrimitive: bb4
52
- Case read $11:TPrimitive: bb3
53
- Default: bb2
54
- Fallthrough: bb1
55
-bb10:
56
- predecessor blocks: bb0
57
- [9] Const mutate y$0$17:TPrimitive = 0
58
- [10] Goto bb9
59
-bb9:
60
- predecessor blocks: bb10 bb0
61
- [11] Const mutate y$1$18:TPrimitive = 1
62
- [12] Goto bb1
63
-bb5:
64
- predecessor blocks: bb0
65
- [13] Const mutate y$2$19:TPrimitive = 3
66
- [14] Goto bb1
67
-bb4:
68
- predecessor blocks: bb0
69
- [15] Const mutate y$3$20:TPrimitive = 4
70
- [16] Goto bb3
71
-bb3:
72
- predecessor blocks: bb4 bb0
73
- [17] Const mutate y$4$21:TPrimitive = 5
74
- [18] Goto bb2
75
-bb2:
76
- predecessor blocks: bb3 bb0
77
- [19] Const mutate y$5$22:TPrimitive = 0
78
- [20] Goto bb1
79
-bb1:
80
- predecessor blocks: bb9 bb0 bb5 bb2
81
- [21] Return
82
-```
83
-
84
-## Reactive Scopes
85
-
86
-```
87
-function foo(
88
- x,
89
-) {
90
- [1] Const mutate y$10:TPrimitive = undefined
91
- [2] Const mutate $11:TPrimitive = 5
92
- [3] Const mutate $12:TPrimitive = 4
93
- [4] Const mutate $13:TPrimitive = 3
94
- [5] Const mutate $14:TPrimitive = 2
95
- [6] Const mutate $15:TPrimitive = 1
96
- [7] Const mutate $16:TPrimitive = 0
97
- switch (read x$9) {
98
- case read $16:TPrimitive: {
99
- [9] Const mutate y$0$17:TPrimitive = 0
100
- }
101
- case read $15:TPrimitive: {
102
- [11] Const mutate y$1$18:TPrimitive = 1
103
- break bb1
104
- }
105
- case read $14:TPrimitive: {
106
- break bb1
107
- }
108
- case read $13:TPrimitive: {
109
- [13] Const mutate y$2$19:TPrimitive = 3
110
- break bb1
111
- }
112
- case read $12:TPrimitive: {
113
- [15] Const mutate y$3$20:TPrimitive = 4
114
- }
115
- case read $11:TPrimitive: {
116
- [17] Const mutate y$4$21:TPrimitive = 5
117
- }
118
- default: {
119
- [19] Const mutate y$5$22:TPrimitive = 0
120
- }
121
- }
122
- return
123
-}
124
-
125
-```
126
-
35
## Code
36
37
```javascript
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
-69
@@ -23,75 +23,6 @@ function Component(props) {
23
24
```
25
26
-## HIR
27
-
28
-```
29
-bb0:
30
- [1] Const mutate x$9_@1[1:12] = Array []
31
- [2] Const mutate y$10:TPrimitive = undefined
32
- [3] Const mutate $11:TPrimitive = false
33
- [4] Const mutate $12:TPrimitive = true
34
- [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive
35
- [5] Switch (read props$8.p0)
36
- Case read $12:TPrimitive: bb4
37
- Case read $11:TPrimitive: bb2
38
- Default: bb1
39
- Fallthrough: bb1
40
-bb4:
41
- predecessor blocks: bb0
42
- [6] Call mutate x$9_@1.push(read props$8.p2)
43
- [7] Call mutate x$9_@1.push(read props$8.p3)
44
- [8] Const mutate y$1$13_@2 = Array []
45
- [9] Goto bb2
46
-bb2:
47
- predecessor blocks: bb4 bb0
48
- [10] Const mutate y$2$15 = read x$9_@1
49
- [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15
50
- [11] Goto bb1
51
-bb1:
52
- predecessor blocks: bb2 bb0
53
- [12] Const mutate child$19_@3 = JSX <read Component$0 data={freeze x$9_@1} ></read Component$0>
54
- [13] Call read y$0$20_@1.push(read props$8.p4)
55
- [14] Const mutate t8$23_@4 = JSX <read Component$0 data={read y$0$20_@1} >{read child$19_@3}</read Component$0>
56
- [15] Return read t8$23_@4
57
-```
58
-
59
-## Reactive Scopes
60
-
61
-```
62
-function Component(
63
- props,
64
-) {
65
- scope @1 [1:12] deps=[read props$8.p0, read props$8.p2, read props$8.p3] out=[x$9_@1] {
66
- [1] Const mutate x$9_@1[1:12] = Array []
67
- [2] Const mutate y$10:TPrimitive = undefined
68
- [3] Const mutate $11:TPrimitive = false
69
- [4] Const mutate $12:TPrimitive = true
70
- [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive
71
- switch (read props$8.p0) {
72
- case read $12:TPrimitive: {
73
- [6] Call mutate x$9_@1.push(read props$8.p2)
74
- [7] Call mutate x$9_@1.push(read props$8.p3)
75
- [8] Const mutate y$1$13_@2 = Array []
76
- }
77
- case read $11:TPrimitive: {
78
- [10] Const mutate y$2$15 = read x$9_@1
79
- [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15
80
- }
81
- }
82
- }
83
- scope @3 [12:13] deps=[freeze x$9_@1] out=[child$19_@3] {
84
- [12] Const mutate child$19_@3 = JSX <read Component$0 data={freeze x$9_@1} ></read Component$0>
85
- }
86
- [13] Call read y$0$20_@1.push(read props$8.p4)
87
- scope @4 [14:15] deps=[read y$0$20_@1, read child$19_@3] out=[$23_@4] {
88
- [14] Const mutate $23_@4 = JSX <read Component$0 data={read y$0$20_@1} >{read child$19_@3}</read Component$0>
89
- }
90
- return read $23_@4
91
-}
92
-
93
-```
94
-
26
## Code
27
28
```javascript
compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md
-33
@@ -17,39 +17,6 @@ function component() {
17
18
```
19
20
-## HIR
21
-
22
-```
23
-bb0:
24
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
25
- [2] Const mutate p$7_@0:TObject[1:9] = Object { }
26
- [3] Const mutate q$8_@0:TObject[1:9] = Object { }
27
- [4] Const mutate y$9_@0:TObject[1:9] = Object { }
28
- [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject
29
- [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y
30
- [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y
31
- [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject)
32
- [9] Return
33
-```
34
-
35
-## Reactive Scopes
36
-
37
-```
38
-function component(
39
-) {
40
- [1] Const mutate x$6_@0:TObject[1:9] = Object { }
41
- [2] Const mutate p$7_@0:TObject[1:9] = Object { }
42
- [3] Const mutate q$8_@0:TObject[1:9] = Object { }
43
- [4] Const mutate y$9_@0:TObject[1:9] = Object { }
44
- [5] Reassign store x$6_@0.y[1:9] = read y$9_@0:TObject
45
- [6] Reassign store p$7_@0.y[1:9] = read x$6_@0.y
46
- [7] Reassign store q$8_@0.y[1:9] = read p$7_@0.y
47
- [8] Call mutate mutate$5:TFunction(mutate q$8_@0:TObject)
48
- return
49
-}
50
-
51
-```
52
-
20
## Code
21
22
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md
-31
@@ -10,37 +10,6 @@ function component(a, b) {
10
11
```
12
13
-## HIR
14
-
15
-```
16
-bb0:
17
- [1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive
18
- [2] If (read $7:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
19
-bb2:
20
- predecessor blocks: bb0
21
- [3] Const mutate m$8_@0:TObject = Object { }
22
- [4] Goto bb1
23
-bb1:
24
- predecessor blocks: bb2 bb0
25
- [5] Return
26
-```
27
-
28
-## Reactive Scopes
29
-
30
-```
31
-function component(
32
- a,
33
- b,
34
-) {
35
- [1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive
36
- if (read $7:TPrimitive) {
37
- [3] Const mutate m$8_@0:TObject = Object { }
38
- }
39
- return
40
-}
41
-
42
-```
43
-
13
## Code
14
15
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md
-37
@@ -12,43 +12,6 @@ function component() {
12
13
```
14
15
-## HIR
16
-
17
-```
18
-bb0:
19
- [1] Const mutate a$7_@0:TPrimitive = Call mutate some$1:TFunction()
20
- [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$3:TFunction()
21
- [3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive
22
- [4] If (read $9:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
23
-bb2:
24
- predecessor blocks: bb0
25
- [5] Const mutate m$10_@2:TObject = Object { }
26
- [6] Goto bb1
27
-bb1:
28
- predecessor blocks: bb2 bb0
29
- [7] Return
30
-```
31
-
32
-## Reactive Scopes
33
-
34
-```
35
-function component(
36
-) {
37
- scope @0 [1:2] deps=[] out=[a$7_@0] {
38
- [1] Const mutate a$7_@0:TPrimitive = Call mutate some$1:TFunction()
39
- }
40
- scope @1 [2:3] deps=[] out=[b$8_@1] {
41
- [2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$3:TFunction()
42
- }
43
- [3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive
44
- if (read $9:TPrimitive) {
45
- [5] Const mutate m$10_@2:TObject = Object { }
46
- }
47
- return
48
-}
49
-
50
-```
51
-
15
## Code
16
17
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md
-25
@@ -9,31 +9,6 @@ function component() {
9
10
```
11
12
-## HIR
13
-
14
-```
15
-bb0:
16
- [1] Const mutate $4:TPrimitive = 1
17
- [2] Const mutate x$5_@0:TObject = Object { t: read $4:TPrimitive }
18
- [3] Const mutate p$6 = read x$5_@0.t
19
- [4] Return
20
-```
21
-
22
-## Reactive Scopes
23
-
24
-```
25
-function component(
26
-) {
27
- [1] Const mutate $4:TPrimitive = 1
28
- scope @0 [2:3] deps=[] out=[x$5_@0] {
29
- [2] Const mutate x$5_@0:TObject = Object { t: read $4:TPrimitive }
30
- }
31
- [3] Const mutate p$6 = read x$5_@0.t
32
- return
33
-}
34
-
35
-```
36
-
12
## Code
13
14
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md
-44
@@ -15,50 +15,6 @@ function component() {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] Const mutate t0$10_@0 = Call mutate makeSomePrimitive$1:TFunction()
23
- [2] Const mutate t1$11_@1 = Call mutate makeSomePrimitive$1:TFunction()
24
- [3] Const mutate x$12_@2:TObject = Object { u: read t0$10_@0, v: read t1$11_@1 }
25
- [4] Const mutate u$13:TPrimitive = read x$12_@2.u
26
- [5] Const mutate v$14:TPrimitive = read x$12_@2.v
27
- [6] Const mutate $15:TPrimitive = Binary read u$13:TPrimitive > read v$14:TPrimitive
28
- [7] If (read $15:TPrimitive) then:bb1 else:bb1 fallthrough=bb1
29
-bb1:
30
- predecessor blocks: bb0
31
- [8] Const mutate y$16 = read x$12_@2.u
32
- [9] Const mutate z$17 = read x$12_@2.v
33
- [10] Return
34
-```
35
-
36
-## Reactive Scopes
37
-
38
-```
39
-function component(
40
-) {
41
- scope @0 [1:2] deps=[] out=[$10_@0] {
42
- [1] Const mutate $10_@0 = Call mutate makeSomePrimitive$1:TFunction()
43
- }
44
- scope @1 [2:3] deps=[] out=[$11_@1] {
45
- [2] Const mutate $11_@1 = Call mutate makeSomePrimitive$1:TFunction()
46
- }
47
- scope @2 [3:4] deps=[read $10_@0, read $11_@1] out=[x$12_@2] {
48
- [3] Const mutate x$12_@2:TObject = Object { u: read $10_@0, v: read $11_@1 }
49
- }
50
- [4] Const mutate u$13:TPrimitive = read x$12_@2.u
51
- [5] Const mutate v$14:TPrimitive = read x$12_@2.v
52
- [6] Const mutate $15:TPrimitive = Binary read u$13:TPrimitive > read v$14:TPrimitive
53
- if (read $15:TPrimitive) {
54
- }
55
- [8] Const mutate y$16 = read x$12_@2.u
56
- [9] Const mutate z$17 = read x$12_@2.v
57
- return
58
-}
59
-
60
-```
61
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md
-29
@@ -11,35 +11,6 @@ function component() {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] Const mutate x$4_@0:TObject[1:4] = Object { }
19
- [2] Const mutate q$5_@1:TObject = Object { }
20
- [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject
21
- [4] Const mutate z$6 = read x$4_@0.t
22
- [5] Return
23
-```
24
-
25
-## Reactive Scopes
26
-
27
-```
28
-function component(
29
-) {
30
- scope @0 [1:4] deps=[] out=[x$4_@0] {
31
- [1] Const mutate x$4_@0:TObject[1:4] = Object { }
32
- scope @1 [2:3] deps=[] out=[q$5_@1] {
33
- [2] Const mutate q$5_@1:TObject = Object { }
34
- }
35
- [3] Reassign store x$4_@0.t[1:4] = read q$5_@1:TObject
36
- }
37
- [4] Const mutate z$6 = read x$4_@0.t
38
- return
39
-}
40
-
41
-```
42
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md
-39
@@ -18,45 +18,6 @@ function component() {
18
19
```
20
21
-## HIR
22
-
23
-```
24
-bb0:
25
- [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$1:TFunction()
26
- [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive
27
- [3] Const mutate o$8_@1:TObject = Object { }
28
- [4] Const mutate x$9_@2:TObject[4:8] = Object { }
29
- [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive
30
- [6] Const mutate z$10_@2[4:8] = read x$9_@2.t
31
- [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject
32
- [8] Const mutate y$11 = read x$9_@2.t
33
- [9] Return
34
-```
35
-
36
-## Reactive Scopes
37
-
38
-```
39
-function component(
40
-) {
41
- scope @0 [1:2] deps=[] out=[p$7_@0] {
42
- [1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$1:TFunction()
43
- }
44
- [2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive
45
- scope @1 [3:4] deps=[] out=[o$8_@1] {
46
- [3] Const mutate o$8_@1:TObject = Object { }
47
- }
48
- scope @2 [4:8] deps=[read p$7_@0:TPrimitive, read o$8_@1:TObject] out=[x$9_@2] {
49
- [4] Const mutate x$9_@2:TObject[4:8] = Object { }
50
- [5] Reassign store x$9_@2.t[4:8] = read p$7_@0:TPrimitive
51
- [6] Const mutate z$10_@2[4:8] = read x$9_@2.t
52
- [7] Reassign store x$9_@2.t[4:8] = read o$8_@1:TObject
53
- }
54
- [8] Const mutate y$11 = read x$9_@2.t
55
- return
56
-}
57
-
58
-```
59
-
21
## Code
22
23
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md
-21
@@ -9,27 +9,6 @@ function component() {
9
10
```
11
12
-## HIR
13
-
14
-```
15
-bb0:
16
- [1] Const mutate x$3:TPrimitive = 1
17
- [2] Const mutate y$4:TPrimitive = 2
18
- [3] Return
19
-```
20
-
21
-## Reactive Scopes
22
-
23
-```
24
-function component(
25
-) {
26
- [1] Const mutate x$3:TPrimitive = 1
27
- [2] Const mutate y$4:TPrimitive = 2
28
- return
29
-}
30
-
31
-```
32
-
12
## Code
13
14
```javascript
compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md
-39
@@ -14,45 +14,6 @@ function component() {
14
15
```
16
17
-## HIR
18
-
19
-```
20
-bb0:
21
- [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$1:TFunction()
22
- [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$1:TFunction()
23
- [3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive
24
- [4] If (read $9:TPrimitive) then:bb2 else:bb1 fallthrough=bb1
25
-bb2:
26
- predecessor blocks: bb0
27
- [5] Const mutate z$10_@2:TObject = Object { }
28
- [6] Goto bb1
29
-bb1:
30
- predecessor blocks: bb2 bb0
31
- [7] Const mutate z$12_@3 = Call mutate foo$1:TFunction()
32
- [8] Return
33
-```
34
-
35
-## Reactive Scopes
36
-
37
-```
38
-function component(
39
-) {
40
- scope @0 [1:2] deps=[] out=[x$7_@0] {
41
- [1] Const mutate x$7_@0:TPrimitive = Call mutate foo$1:TFunction()
42
- }
43
- scope @1 [2:3] deps=[] out=[y$8_@1] {
44
- [2] Const mutate y$8_@1:TPrimitive = Call mutate foo$1:TFunction()
45
- }
46
- [3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive
47
- if (read $9:TPrimitive) {
48
- [5] Const mutate z$10_@2:TObject = Object { }
49
- }
50
- [7] Const mutate z$12_@3 = Call mutate foo$1:TFunction()
51
- return
52
-}
53
-
54
-```
55
-
17
## Code
18
19
```javascript
compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md
-30
@@ -11,36 +11,6 @@ function foo(a, b) {
11
12
```
13
14
-## HIR
15
-
16
-```
17
-bb0:
18
- [1] While test=bb1 loop=bb2 fallthrough=bb2
19
-bb1:
20
- predecessor blocks: bb0
21
- [2] If (read a$3) then:bb2 else:bb2 fallthrough=bb2
22
-bb2:
23
- predecessor blocks: bb1
24
- [3] Return read b$4
25
-```
26
-
27
-## Reactive Scopes
28
-
29
-```
30
-function foo(
31
- a,
32
- b,
33
-) {
34
- while (
35
- read a$3
36
- ) {
37
- break
38
- }
39
- return read b$4
40
-}
41
-
42
-```
43
-
14
## Code
15
16
```javascript
compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md
-47
@@ -15,53 +15,6 @@ function foo(a, b, c, d) {
15
16
```
17
18
-## HIR
19
-
20
-```
21
-bb0:
22
- [1] While test=bb1 loop=bb3 fallthrough=bb2
23
-bb1:
24
- predecessor blocks: bb0 bb5 bb4
25
- [2] If (read a$5) then:bb3 else:bb2 fallthrough=bb2
26
-bb3:
27
- predecessor blocks: bb1
28
- [3] If (read b$6) then:bb5 else:bb4 fallthrough=bb4
29
-bb5:
30
- predecessor blocks: bb3
31
- [4] Goto(Continue) bb1
32
-bb4:
33
- predecessor blocks: bb3
34
- [5] Call read c$7:TFunction()
35
- [6] Goto(Continue) bb1
36
-bb2:
37
- predecessor blocks: bb1
38
- [7] Call read d$8:TFunction()
39
- [8] Return
40
-```
41
-
42
-## Reactive Scopes
43
-
44
-```
45
-function foo(
46
- a,
47
- b,
48
- c,
49
- d,
50
-) {
51
- while (
52
- read a$5
53
- ) {
54
- if (read b$6) {
55
- continue
56
- }
57
- [5] Call read c$7:TFunction()
58
- }
59
- [7] Call read d$8:TFunction()
60
- return
61
-}
62
-
63
-```
64
-
18
## Code
19
20
```javascript
compiler/forget/src/__tests__/hir-test.ts
+3
-18
@@ -11,11 +11,9 @@ import generate from "@babel/generator";
11
import * as parser from "@babel/parser";
12
import traverse from "@babel/traverse";
13
import { wasmFolder } from "@hpcc-js/wasm";
14
-import invariant from "invariant";
14
import path from "path";
15
import prettier from "prettier";
16
import run from "../CompilerPipeline";
18
-import { printFunction } from "../HIR";
17
import { toggleLogging } from "../Utils/logger";
18
import generateTestsFromFixtures from "./test-utils/generateTestsFromFixtures";
19
@@ -101,16 +99,8 @@ ${wrapWithTripleBackticks(error.message)}
99
}
100
101
function formatOutput(items: Array<TestOutput>): Array<string> {
104
- return items.map(({ ir, js, scopes }) => {
102
+ return items.map(({ js }) => {
103
return `
106
-## HIR
107
-
108
-${wrapWithTripleBackticks(ir)}
109
-
110
-## Reactive Scopes
111
-
112
-${wrapWithTripleBackticks(scopes)}
113
-
104
## Code
105
106
${wrapWithTripleBackticks(js, "javascript")}
@@ -119,9 +109,7 @@ ${wrapWithTripleBackticks(js, "javascript")}
109
}
110
111
type TestOutput = {
122
- ir: string;
112
js: string;
124
- scopes: string;
113
};
114
115
function transform(text: string, file: string): Array<TestOutput> {
@@ -133,16 +121,13 @@ function transform(text: string, file: string): Array<TestOutput> {
121
traverse(ast, {
122
FunctionDeclaration: {
123
enter(nodePath) {
136
- const { ir, scopes, ast } = run(nodePath);
124
+ const { ast } = run(nodePath);
125
138
- const textHIR = printFunction(ir);
139
- invariant(ast, "Expected an ast");
140
- invariant(scopes, "Expected printed scope data");
126
const text = prettier.format(generate(ast).code.replace("\n\n", "\n"), {
127
semi: true,
128
parser: "babel-ts",
129
});
145
- items.push({ ir: textHIR, js: text, scopes });
130
+ items.push({ js: text });
131
},
132
},
133
});