Ensure non-conflicting names in output, wo suffixes by default
Joe Savona committed
Dec 22, 2022 at 10:23 UTC
4385a283e4dce84029b1da51ce615e832e89f95c
103 files changed
+2245
-2048
compiler/forget/src/CompilerPipeline.ts
+2
@@ -24,6 +24,7 @@ import {
24
propagateScopeDependencies,
25
pruneUnusedLabels,
26
pruneUnusedScopes,
27
+ renameVariables,
28
} from "./ReactiveScopes";
29
import { eliminateRedundantPhi, enterSSA, leaveSSA } from "./SSA";
30
import { logHIRFunction } from "./Utils/logger";
@@ -71,6 +72,7 @@ export default function (
72
flattenReactiveLoops(reactiveFunction);
73
propagateScopeDependencies(reactiveFunction);
74
pruneUnusedScopes(reactiveFunction);
75
+ renameVariables(reactiveFunction);
76
const scopes = printReactiveFunction(reactiveFunction);
77
const ast = codegenReactiveFunction(reactiveFunction);
78
compiler/forget/src/HIR/Codegen.ts
+1
-1
@@ -542,7 +542,7 @@ export function codegenPlace(temp: Temporaries, place: Place): t.Expression {
542
543
export function convertIdentifier(identifier: Identifier): t.Identifier {
544
if (identifier.name !== null) {
545
- return t.identifier(`${identifier.name}$${identifier.id}`);
545
+ return t.identifier(`${identifier.name}`);
546
}
547
return t.identifier(`t${identifier.id}`);
548
}
compiler/forget/src/ReactiveScopes/RenameVariables.ts
new
+194
@@ -0,0 +1,194 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+import {
9
+ Identifier,
10
+ IdentifierId,
11
+ ReactiveBlock,
12
+ ReactiveFunction,
13
+ ReactiveTerminal,
14
+ ReactiveValueBlock,
15
+} from "../HIR/HIR";
16
+import {
17
+ eachInstructionOperand,
18
+ eachInstructionValueOperand,
19
+} from "../HIR/visitors";
20
+import { invariant } from "../Utils/CompilerError";
21
+import { assertExhaustive } from "../Utils/utils";
22
+
23
+/**
24
+ * Ensures that each named variable in the given function has a unique name
25
+ * that does not conflict with any other variables in the same block scope.
26
+ * Note that the scoping is based on the final inferred blocks, not the
27
+ * block scopes that were present in the original source. Thus variables
28
+ * that shadowed in the original source may end up with unique names in the
29
+ * output, if Forget would merge those two blocks into a single scope.
30
+ */
31
+export function renameVariables(fn: ReactiveFunction): void {
32
+ const scopes = new Scopes();
33
+ scopes.enter(() => {
34
+ if (fn.id !== null) {
35
+ scopes.visit(fn.id);
36
+ }
37
+ for (const param of fn.params) {
38
+ scopes.visit(param.identifier);
39
+ }
40
+ visitBlock(scopes, fn.body);
41
+ });
42
+}
43
+
44
+function visitBlock(scopes: Scopes, block: ReactiveBlock): void {
45
+ scopes.enter(() => visitBlockInner(scopes, block));
46
+}
47
+
48
+function visitBlockInner(scopes: Scopes, block: ReactiveBlock): void {
49
+ for (const stmt of block) {
50
+ switch (stmt.kind) {
51
+ case "instruction": {
52
+ for (const operand of eachInstructionOperand(stmt.instruction)) {
53
+ scopes.visit(operand.identifier);
54
+ }
55
+ if (stmt.instruction.lvalue !== null) {
56
+ scopes.visit(stmt.instruction.lvalue.place.identifier);
57
+ }
58
+ break;
59
+ }
60
+ case "scope": {
61
+ // NOTE: we intentionally don't enter new block scope here,
62
+ // since the outputs of the scope will be in the outer block
63
+ visitBlockInner(scopes, stmt.instructions);
64
+ break;
65
+ }
66
+ case "terminal": {
67
+ visitTerminal(scopes, stmt.terminal);
68
+ break;
69
+ }
70
+ }
71
+ }
72
+}
73
+
74
+function visitValueBlock(scopes: Scopes, block: ReactiveValueBlock): void {
75
+ for (const stmt of block.instructions) {
76
+ invariant(
77
+ stmt.kind === "instruction",
78
+ "Value blocks may only contain instructions"
79
+ );
80
+ for (const operand of eachInstructionValueOperand(stmt.instruction.value)) {
81
+ scopes.visit(operand.identifier);
82
+ }
83
+ if (stmt.instruction.lvalue !== null) {
84
+ scopes.visit(stmt.instruction.lvalue.place.identifier);
85
+ }
86
+ }
87
+ if (block.value !== null) {
88
+ for (const operand of eachInstructionValueOperand(block.value)) {
89
+ scopes.visit(operand.identifier);
90
+ }
91
+ }
92
+}
93
+
94
+export function visitTerminal(
95
+ scopes: Scopes,
96
+ terminal: ReactiveTerminal
97
+): void {
98
+ switch (terminal.kind) {
99
+ case "return": {
100
+ if (terminal.value !== null) {
101
+ scopes.visit(terminal.value.identifier);
102
+ }
103
+ break;
104
+ }
105
+ case "throw": {
106
+ scopes.visit(terminal.value.identifier);
107
+ break;
108
+ }
109
+ case "break":
110
+ case "continue": {
111
+ break;
112
+ }
113
+ case "for": {
114
+ scopes.enter(() => {
115
+ visitValueBlock(scopes, terminal.init);
116
+ visitValueBlock(scopes, terminal.test);
117
+ visitValueBlock(scopes, terminal.update);
118
+ visitBlock(scopes, terminal.loop);
119
+ });
120
+ break;
121
+ }
122
+ case "while": {
123
+ visitValueBlock(scopes, terminal.test);
124
+ visitBlock(scopes, terminal.loop);
125
+ break;
126
+ }
127
+ case "if": {
128
+ scopes.visit(terminal.test.identifier);
129
+ visitBlock(scopes, terminal.consequent);
130
+ if (terminal.alternate !== null) {
131
+ visitBlock(scopes, terminal.alternate);
132
+ }
133
+ break;
134
+ }
135
+ case "switch": {
136
+ scopes.visit(terminal.test.identifier);
137
+ for (const case_ of terminal.cases) {
138
+ if (case_.test !== null) {
139
+ scopes.visit(case_.test.identifier);
140
+ }
141
+ if (case_.block !== undefined) {
142
+ visitBlock(scopes, case_.block);
143
+ }
144
+ }
145
+ break;
146
+ }
147
+ default: {
148
+ assertExhaustive(
149
+ terminal,
150
+ `Unexpected terminal kind '${(terminal as any).kind}'`
151
+ );
152
+ }
153
+ }
154
+}
155
+
156
+class Scopes {
157
+ #nextId: number = 0;
158
+ #seen: Set<IdentifierId> = new Set();
159
+ #stack: Array<Map<string, IdentifierId>> = [new Map()];
160
+
161
+ visit(identifier: Identifier): void {
162
+ if (identifier.name === null || this.#seen.has(identifier.id)) {
163
+ return;
164
+ }
165
+ this.#seen.add(identifier.id);
166
+ let name = identifier.name;
167
+ let previous = this.#lookup(name);
168
+ while (previous !== null) {
169
+ name = `${identifier.name}$${this.#nextId++}`;
170
+ previous = this.#lookup(name);
171
+ }
172
+ identifier.name = name;
173
+ this.#stack.at(-1)!.set(name, identifier.id);
174
+ }
175
+
176
+ #lookup(name: string): IdentifierId | null {
177
+ for (let i = this.#stack.length - 1; i >= 0; i--) {
178
+ const scope = this.#stack[i]!;
179
+ const entry = scope.get(name);
180
+ if (entry !== undefined) {
181
+ return entry;
182
+ }
183
+ }
184
+ return null;
185
+ }
186
+
187
+ enter(fn: () => void): void {
188
+ const next = new Map();
189
+ this.#stack.push(next);
190
+ fn();
191
+ const last = this.#stack.pop();
192
+ invariant(last === next, "Mismatch push/pop calls");
193
+ }
194
+}
compiler/forget/src/ReactiveScopes/index.ts
+1
@@ -14,3 +14,4 @@ export { printReactiveFunction } from "./PrintReactiveFunction";
14
export { propagateScopeDependencies } from "./PropagateScopeDependencies";
15
export { pruneUnusedLabels } from "./PruneUnusedLabels";
16
export { pruneUnusedScopes } from "./PruneUnusedScopes";
17
+export { renameVariables } from "./RenameVariables";
compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md
+7
-7
@@ -57,15 +57,15 @@ function Component(
57
## Code
58
59
```javascript
60
-function Component$0(props$3) {
61
- const a$4 = [];
62
- a$4.push(props$3.a);
63
- if (props$3.b) {
64
- a$4.push(props$3.d);
65
- return a$4;
60
+function Component(props) {
61
+ const a = [];
62
+ a.push(props.a);
63
+ if (props.b) {
64
+ a.push(props.d);
65
+ return a;
66
}
67
68
- a$4.push(props$3.c);
68
+ a.push(props.c);
69
}
70
71
```
compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md
+10
-10
@@ -16,9 +16,9 @@ function f() {
16
```
17
bb0:
18
[1] Const mutate x$4:TPrimitive = 1
19
- [2] Const mutate x$5:TPrimitive = 2
20
- [3] Const mutate $6:TPrimitive = Binary read x$5:TPrimitive + read x$5:TPrimitive
21
- [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$5:TPrimitive
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
@@ -28,9 +28,9 @@ bb0:
28
function f(
29
) {
30
[1] Const mutate x$4:TPrimitive = 1
31
- [2] Const mutate x$5:TPrimitive = 2
32
- [3] Const mutate $6:TPrimitive = Binary read x$5:TPrimitive + read x$5:TPrimitive
33
- [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$5:TPrimitive
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
@@ -39,10 +39,10 @@ function f(
39
## Code
40
41
```javascript
42
-function f$0() {
43
- const x$4 = 1;
44
- const x$5 = 2;
45
- return x$5 + x$5 + x$5;
42
+function f() {
43
+ const x = 1;
44
+ const x$0 = 2;
45
+ return x$0 + x$0 + x$0;
46
}
47
48
```
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md
+7
-7
@@ -45,13 +45,13 @@ function component(
45
## Code
46
47
```javascript
48
-function component$0() {
49
- const z$5 = [];
50
- const y$6 = {};
51
- y$6.z = z$5;
52
- const x$7 = {};
53
- x$7.y = y$6;
54
- mutate$4(x$7.y.z);
48
+function component() {
49
+ const z = [];
50
+ const y = {};
51
+ y.z = z;
52
+ const x = {};
53
+ x.y = y;
54
+ mutate(x.y.z);
55
}
56
57
```
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md
+20
-20
@@ -49,41 +49,41 @@ function component(
49
## Code
50
51
```javascript
52
-function component$0() {
52
+function component() {
53
const $ = React.useMemoCache();
54
- let z$4;
54
+ let z;
55
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
56
- z$4 = [];
57
- $[0] = z$4;
56
+ z = [];
57
+ $[0] = z;
58
} else {
59
- z$4 = $[0];
59
+ z = $[0];
60
}
61
62
- const c_1 = $[1] !== z$4;
63
- let y$5;
62
+ const c_1 = $[1] !== z;
63
+ let y;
64
65
if (c_1) {
66
- y$5 = {};
67
- y$5.z = z$4;
68
- $[1] = z$4;
69
- $[2] = y$5;
66
+ y = {};
67
+ y.z = z;
68
+ $[1] = z;
69
+ $[2] = y;
70
} else {
71
- y$5 = $[2];
71
+ y = $[2];
72
}
73
74
- const c_3 = $[3] !== y$5;
75
- let x$6;
74
+ const c_3 = $[3] !== y;
75
+ let x;
76
77
if (c_3) {
78
- x$6 = {};
79
- x$6.y = y$5;
80
- $[3] = y$5;
81
- $[4] = x$6;
78
+ x = {};
79
+ x.y = y;
80
+ $[3] = y;
81
+ $[4] = x;
82
} else {
83
- x$6 = $[4];
83
+ x = $[4];
84
}
85
86
- return x$6;
86
+ return x;
87
}
88
89
```
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
+27
-27
@@ -81,39 +81,39 @@ function foo(
81
## Code
82
83
```javascript
84
-function foo$0(cond$7) {
84
+function foo(cond) {
85
const $ = React.useMemoCache();
86
- const c_0 = $[0] !== cond$7;
87
- let a$8;
88
- let b$9;
89
- let c$10;
86
+ const c_0 = $[0] !== cond;
87
+ let a;
88
+ let b;
89
+ let c;
90
if (c_0) {
91
- a$8 = {};
92
- b$9 = {};
93
- c$10 = {};
94
-
95
- while (cond$7) {
96
- const z$13 = a$8;
97
- a$8 = b$9;
98
- b$9 = c$10;
99
- c$10 = z$13;
100
- mutate$6(a$8, b$9);
91
+ a = {};
92
+ b = {};
93
+ c = {};
94
+
95
+ while (cond) {
96
+ const z = a;
97
+ a = b;
98
+ b = c;
99
+ c = z;
100
+ mutate(a, b);
101
}
102
103
- $[0] = cond$7;
104
- $[1] = a$8;
105
- $[2] = b$9;
106
- $[3] = c$10;
103
+ $[0] = cond;
104
+ $[1] = a;
105
+ $[2] = b;
106
+ $[3] = c;
107
} else {
108
- a$8 = $[1];
109
- b$9 = $[2];
110
- c$10 = $[3];
108
+ a = $[1];
109
+ b = $[2];
110
+ c = $[3];
111
}
112
113
- a$8;
114
- b$9;
115
- c$10;
116
- return a$8;
113
+ a;
114
+ b;
115
+ c;
116
+ return a;
117
}
118
119
```
@@ -139,7 +139,7 @@ function mutate(
139
## Code
140
141
```javascript
142
-function mutate$0(x$3, y$4) {}
142
+function mutate(x, y) {}
143
144
```
145
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
+14
-14
@@ -22,11 +22,11 @@ function g(a) {
22
bb0:
23
[1] Const mutate x$5:TPrimitive = 1
24
[2] Const mutate $6:TPrimitive = 1
25
- [3] Const mutate x$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive
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$9:TPrimitive = Binary read x$7:TPrimitive + read $8:TPrimitive
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$11:TPrimitive = Binary read x$9:TPrimitive >>> read $10:TPrimitive
29
+ [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive
30
[8] Return
31
```
32
@@ -37,11 +37,11 @@ function f(
37
) {
38
[1] Const mutate x$5:TPrimitive = 1
39
[2] Const mutate $6:TPrimitive = 1
40
- [3] Const mutate x$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive
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$9:TPrimitive = Binary read x$7:TPrimitive + read $8:TPrimitive
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$11:TPrimitive = Binary read x$9:TPrimitive >>> read $10:TPrimitive
44
+ [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive
45
return
46
}
47
@@ -50,11 +50,11 @@ function f(
50
## Code
51
52
```javascript
53
-function f$0() {
54
- const x$5 = 1;
55
- const x$7 = x$5 + 1;
56
- const x$9 = x$7 + 1;
57
- const x$11 = x$9 >>> 1;
53
+function f() {
54
+ const x = 1;
55
+ const x$0 = x + 1;
56
+ const x$1 = x$0 + 1;
57
+ const x$2 = x$1 >>> 1;
58
}
59
60
```
@@ -89,9 +89,9 @@ function g(
89
## Code
90
91
```javascript
92
-function g$0(a$5) {
93
- a$5.c.b = a$5.b.c + 1;
94
- a$5.c.b = a$5.b.c * 2;
92
+function g(a) {
93
+ a.c.b = a.b.c + 1;
94
+ a.c.b = a.b.c * 2;
95
}
96
97
```
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+22
-22
@@ -35,7 +35,7 @@ function foo(
35
## Code
36
37
```javascript
38
-function foo$0() {}
38
+function foo() {}
39
40
```
41
## HIR
@@ -79,39 +79,39 @@ function Component(
79
## Code
80
81
```javascript
82
-function Component$0(props$9) {
82
+function Component(props) {
83
const $ = React.useMemoCache();
84
- let a$10;
85
- let b$11;
84
+ let a;
85
+ let b;
86
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
87
- a$10 = [];
88
- b$11 = {};
89
- foo$4(a$10, b$11);
87
+ a = [];
88
+ b = {};
89
+ foo(a, b);
90
91
- const _$13 = <div a={a$10}></div>;
91
+ const _ = <div a={a}></div>;
92
93
- foo$4(b$11);
94
- $[0] = a$10;
95
- $[1] = b$11;
93
+ foo(b);
94
+ $[0] = a;
95
+ $[1] = b;
96
} else {
97
- a$10 = $[0];
98
- b$11 = $[1];
97
+ a = $[0];
98
+ b = $[1];
99
}
100
101
- const c_2 = $[2] !== a$10;
102
- const c_3 = $[3] !== b$11;
103
- let t4$15;
101
+ const c_2 = $[2] !== a;
102
+ const c_3 = $[3] !== b;
103
+ let t4;
104
105
if (c_2 || c_3) {
106
- t4$15 = <div a={a$10} b={b$11}></div>;
107
- $[2] = a$10;
108
- $[3] = b$11;
109
- $[4] = t4$15;
106
+ t4 = <div a={a} b={b}></div>;
107
+ $[2] = a;
108
+ $[3] = b;
109
+ $[4] = t4;
110
} else {
111
- t4$15 = $[4];
111
+ t4 = $[4];
112
}
113
114
- return t4$15;
114
+ return t4;
115
}
116
117
```
compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md
+4
-4
@@ -61,10 +61,10 @@ function foo(
61
## Code
62
63
```javascript
64
-function foo$0(a$4, b$5, c$6) {
65
- if (a$4) {
66
- while (b$5) {
67
- if (c$6) {
64
+function foo(a, b, c) {
65
+ if (a) {
66
+ while (b) {
67
+ if (c) {
68
break;
69
}
70
}
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+45
-45
@@ -174,86 +174,86 @@ function Component(
174
## Code
175
176
```javascript
177
-function Component$0(props$29) {
177
+function Component(props) {
178
const $ = React.useMemoCache();
179
- const items$30 = props$29.items;
180
- const maxItems$31 = props$29.maxItems;
181
- const c_0 = $[0] !== maxItems$31;
182
- const c_1 = $[1] !== items$30.length;
183
- const c_2 = $[2] !== items$30;
184
- let renderedItems$32;
179
+ const items = props.items;
180
+ const maxItems = props.maxItems;
181
+ const c_0 = $[0] !== maxItems;
182
+ const c_1 = $[1] !== items.length;
183
+ const c_2 = $[2] !== items;
184
+ let renderedItems;
185
if (c_0 || c_1 || c_2) {
186
- renderedItems$32 = [];
187
- const seen$33 = new Set$5();
188
- const c_4 = $[4] !== maxItems$31;
189
- let max$35;
186
+ renderedItems = [];
187
+ const seen = new Set();
188
+ const c_4 = $[4] !== maxItems;
189
+ let max;
190
191
if (c_4) {
192
- max$35 = Math$7.max(0, maxItems$31);
193
- $[4] = maxItems$31;
194
- $[5] = max$35;
192
+ max = Math.max(0, maxItems);
193
+ $[4] = maxItems;
194
+ $[5] = max;
195
} else {
196
- max$35 = $[5];
196
+ max = $[5];
197
}
198
199
- for (let i$36 = 0; i$36 < items$30.length; i$36 = i$36 + 1, i$36) {
200
- const item$40 = items$30.at(i$36);
199
+ for (let i = 0; i < items.length; i = i + 1, i) {
200
+ const item = items.at(i);
201
202
- if (item$40 == null) {
202
+ if (item == null) {
203
} else {
204
}
205
206
- if (seen$33.has(item$40)) {
206
+ if (seen.has(item)) {
207
continue;
208
}
209
210
- seen$33.add(item$40);
211
- renderedItems$32.push(<div>{item$40}</div>);
210
+ seen.add(item);
211
+ renderedItems.push(<div>{item}</div>);
212
213
- if (renderedItems$32.length >= max$35) {
213
+ if (renderedItems.length >= max) {
214
break;
215
}
216
}
217
218
- $[0] = maxItems$31;
219
- $[1] = items$30.length;
220
- $[2] = items$30;
221
- $[3] = renderedItems$32;
218
+ $[0] = maxItems;
219
+ $[1] = items.length;
220
+ $[2] = items;
221
+ $[3] = renderedItems;
222
} else {
223
- renderedItems$32 = $[3];
223
+ renderedItems = $[3];
224
}
225
226
- const count$66 = renderedItems$32.length;
227
- const c_6 = $[6] !== count$66;
228
- let t7$71;
226
+ const count = renderedItems.length;
227
+ const c_6 = $[6] !== count;
228
+ let t7;
229
230
if (c_6) {
231
- t7$71 = <h1>{count$66} Items</h1>;
232
- $[6] = count$66;
233
- $[7] = t7$71;
231
+ t7 = <h1>{count} Items</h1>;
232
+ $[6] = count;
233
+ $[7] = t7;
234
} else {
235
- t7$71 = $[7];
235
+ t7 = $[7];
236
}
237
238
- const c_8 = $[8] !== t7$71;
239
- const c_9 = $[9] !== renderedItems$32;
240
- let t10$74;
238
+ const c_8 = $[8] !== t7;
239
+ const c_9 = $[9] !== renderedItems;
240
+ let t10;
241
242
if (c_8 || c_9) {
243
- t10$74 = (
243
+ t10 = (
244
<div>
245
- {t7$71}
246
- {renderedItems$32}
245
+ {t7}
246
+ {renderedItems}
247
</div>
248
);
249
- $[8] = t7$71;
250
- $[9] = renderedItems$32;
251
- $[10] = t10$74;
249
+ $[8] = t7;
250
+ $[9] = renderedItems;
251
+ $[10] = t10;
252
} else {
253
- t10$74 = $[10];
253
+ t10 = $[10];
254
}
255
256
- return t10$74;
256
+ return t10;
257
}
258
259
```
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+77
-77
@@ -114,30 +114,30 @@ function Component(
114
## Code
115
116
```javascript
117
-function Component$0(props$4) {
117
+function Component(props) {
118
const $ = React.useMemoCache();
119
- const c_0 = $[0] !== props$4.a;
120
- const c_1 = $[1] !== props$4.b;
121
- const c_2 = $[2] !== props$4.d;
122
- let a_DEBUG$5;
119
+ const c_0 = $[0] !== props.a;
120
+ const c_1 = $[1] !== props.b;
121
+ const c_2 = $[2] !== props.d;
122
+ let a_DEBUG;
123
if (c_0 || c_1 || c_2) {
124
- a_DEBUG$5 = [];
125
- a_DEBUG$5.push(props$4.a);
124
+ a_DEBUG = [];
125
+ a_DEBUG.push(props.a);
126
127
- if (props$4.b) {
127
+ if (props.b) {
128
return null;
129
}
130
131
- a_DEBUG$5.push(props$4.d);
132
- $[0] = props$4.a;
133
- $[1] = props$4.b;
134
- $[2] = props$4.d;
135
- $[3] = a_DEBUG$5;
131
+ a_DEBUG.push(props.d);
132
+ $[0] = props.a;
133
+ $[1] = props.b;
134
+ $[2] = props.d;
135
+ $[3] = a_DEBUG;
136
} else {
137
- a_DEBUG$5 = $[3];
137
+ a_DEBUG = $[3];
138
}
139
140
- return a_DEBUG$5;
140
+ return a_DEBUG;
141
}
142
143
```
@@ -180,32 +180,32 @@ function Component(
180
## Code
181
182
```javascript
183
-function Component$0(props$3) {
183
+function Component(props) {
184
const $ = React.useMemoCache();
185
- const c_0 = $[0] !== props$3.a;
186
- const c_1 = $[1] !== props$3.b;
187
- const c_2 = $[2] !== props$3.c;
188
- const c_3 = $[3] !== props$3.d;
189
- let a$4;
185
+ const c_0 = $[0] !== props.a;
186
+ const c_1 = $[1] !== props.b;
187
+ const c_2 = $[2] !== props.c;
188
+ const c_3 = $[3] !== props.d;
189
+ let a;
190
if (c_0 || c_1 || c_2 || c_3) {
191
- a$4 = [];
192
- a$4.push(props$3.a);
191
+ a = [];
192
+ a.push(props.a);
193
194
- if (props$3.b) {
195
- a$4.push(props$3.c);
194
+ if (props.b) {
195
+ a.push(props.c);
196
}
197
198
- a$4.push(props$3.d);
199
- $[0] = props$3.a;
200
- $[1] = props$3.b;
201
- $[2] = props$3.c;
202
- $[3] = props$3.d;
203
- $[4] = a$4;
198
+ a.push(props.d);
199
+ $[0] = props.a;
200
+ $[1] = props.b;
201
+ $[2] = props.c;
202
+ $[3] = props.d;
203
+ $[4] = a;
204
} else {
205
- a$4 = $[4];
205
+ a = $[4];
206
}
207
208
- return a$4;
208
+ return a;
209
}
210
211
```
@@ -251,33 +251,33 @@ function Component(
251
## Code
252
253
```javascript
254
-function Component$0(props$4) {
254
+function Component(props) {
255
const $ = React.useMemoCache();
256
- const c_0 = $[0] !== props$4.a;
257
- const c_1 = $[1] !== props$4.b;
258
- const c_2 = $[2] !== props$4.c;
259
- const c_3 = $[3] !== props$4.d;
260
- let a$5;
256
+ const c_0 = $[0] !== props.a;
257
+ const c_1 = $[1] !== props.b;
258
+ const c_2 = $[2] !== props.c;
259
+ const c_3 = $[3] !== props.d;
260
+ let a;
261
if (c_0 || c_1 || c_2 || c_3) {
262
- a$5 = [];
263
- a$5.push(props$4.a);
262
+ a = [];
263
+ a.push(props.a);
264
265
- if (props$4.b) {
266
- a$5.push(props$4.c);
265
+ if (props.b) {
266
+ a.push(props.c);
267
return null;
268
}
269
270
- a$5.push(props$4.d);
271
- $[0] = props$4.a;
272
- $[1] = props$4.b;
273
- $[2] = props$4.c;
274
- $[3] = props$4.d;
275
- $[4] = a$5;
270
+ a.push(props.d);
271
+ $[0] = props.a;
272
+ $[1] = props.b;
273
+ $[2] = props.c;
274
+ $[3] = props.d;
275
+ $[4] = a;
276
} else {
277
- a$5 = $[4];
277
+ a = $[4];
278
}
279
280
- return a$5;
280
+ return a;
281
}
282
283
```
@@ -321,33 +321,33 @@ function Component(
321
## Code
322
323
```javascript
324
-function Component$0(props$3) {
324
+function Component(props) {
325
const $ = React.useMemoCache();
326
- const c_0 = $[0] !== props$3.a;
327
- const c_1 = $[1] !== props$3.b;
328
- const c_2 = $[2] !== props$3.c;
329
- const c_3 = $[3] !== props$3.d;
330
- let a$4;
326
+ const c_0 = $[0] !== props.a;
327
+ const c_1 = $[1] !== props.b;
328
+ const c_2 = $[2] !== props.c;
329
+ const c_3 = $[3] !== props.d;
330
+ let a;
331
if (c_0 || c_1 || c_2 || c_3) {
332
- a$4 = [];
333
- a$4.push(props$3.a);
332
+ a = [];
333
+ a.push(props.a);
334
335
- if (props$3.b) {
336
- a$4.push(props$3.c);
337
- return a$4;
335
+ if (props.b) {
336
+ a.push(props.c);
337
+ return a;
338
}
339
340
- a$4.push(props$3.d);
341
- $[0] = props$3.a;
342
- $[1] = props$3.b;
343
- $[2] = props$3.c;
344
- $[3] = props$3.d;
345
- $[4] = a$4;
340
+ a.push(props.d);
341
+ $[0] = props.a;
342
+ $[1] = props.b;
343
+ $[2] = props.c;
344
+ $[3] = props.d;
345
+ $[4] = a;
346
} else {
347
- a$4 = $[4];
347
+ a = $[4];
348
}
349
350
- return a$4;
350
+ return a;
351
}
352
353
```
@@ -388,15 +388,15 @@ function Component(
388
## Code
389
390
```javascript
391
-function Component$0(props$3) {
392
- const a$4 = [];
393
- a$4.push(props$3.a);
394
- if (props$3.b) {
395
- a$4.push(props$3.d);
396
- return a$4;
391
+function Component(props) {
392
+ const a = [];
393
+ a.push(props.a);
394
+ if (props.b) {
395
+ a.push(props.d);
396
+ return a;
397
}
398
399
- a$4.push(props$3.c);
399
+ a.push(props.c);
400
}
401
402
```
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+52
-52
@@ -82,46 +82,46 @@ function Component(
82
## Code
83
84
```javascript
85
-function Component$0(props$6) {
85
+function Component(props) {
86
const $ = React.useMemoCache();
87
- const c_0 = $[0] !== props$6.p0;
88
- const c_1 = $[1] !== props$6.p1;
89
- const c_2 = $[2] !== props$6.p2;
90
- let a$7;
87
+ const c_0 = $[0] !== props.p0;
88
+ const c_1 = $[1] !== props.p1;
89
+ const c_2 = $[2] !== props.p2;
90
+ let a;
91
if (c_0 || c_1 || c_2) {
92
- a$7 = [];
93
- const b$8 = [];
92
+ a = [];
93
+ const b = [];
94
95
- if (b$8) {
96
- a$7.push(props$6.p0);
95
+ if (b) {
96
+ a.push(props.p0);
97
}
98
99
- if (props$6.p1) {
100
- b$8.push(props$6.p2);
99
+ if (props.p1) {
100
+ b.push(props.p2);
101
}
102
103
- $[0] = props$6.p0;
104
- $[1] = props$6.p1;
105
- $[2] = props$6.p2;
106
- $[3] = a$7;
103
+ $[0] = props.p0;
104
+ $[1] = props.p1;
105
+ $[2] = props.p2;
106
+ $[3] = a;
107
} else {
108
- a$7 = $[3];
108
+ a = $[3];
109
}
110
111
- const c_4 = $[4] !== a$7;
112
- const c_5 = $[5] !== b$8;
113
- let t6$16;
111
+ const c_4 = $[4] !== a;
112
+ const c_5 = $[5] !== b;
113
+ let t6;
114
115
if (c_4 || c_5) {
116
- t6$16 = <Foo$4 a={a$7} b={b$8}></Foo$4>;
117
- $[4] = a$7;
118
- $[5] = b$8;
119
- $[6] = t6$16;
116
+ t6 = <Foo a={a} b={b}></Foo>;
117
+ $[4] = a;
118
+ $[5] = b;
119
+ $[6] = t6;
120
} else {
121
- t6$16 = $[6];
121
+ t6 = $[6];
122
}
123
124
- return t6$16;
124
+ return t6;
125
}
126
127
```
@@ -178,46 +178,46 @@ function Component(
178
## Code
179
180
```javascript
181
-function Component$0(props$8) {
181
+function Component(props) {
182
const $ = React.useMemoCache();
183
- const c_0 = $[0] !== props$8.p0;
184
- const c_1 = $[1] !== props$8.p1;
185
- const c_2 = $[2] !== props$8.p2;
186
- let a$9;
183
+ const c_0 = $[0] !== props.p0;
184
+ const c_1 = $[1] !== props.p1;
185
+ const c_2 = $[2] !== props.p2;
186
+ let a;
187
if (c_0 || c_1 || c_2) {
188
- a$9 = [];
189
- const b$10 = [];
188
+ a = [];
189
+ const b = [];
190
191
- if (mayMutate$4(b$10)) {
192
- a$9.push(props$8.p0);
191
+ if (mayMutate(b)) {
192
+ a.push(props.p0);
193
}
194
195
- if (props$8.p1) {
196
- b$10.push(props$8.p2);
195
+ if (props.p1) {
196
+ b.push(props.p2);
197
}
198
199
- $[0] = props$8.p0;
200
- $[1] = props$8.p1;
201
- $[2] = props$8.p2;
202
- $[3] = a$9;
199
+ $[0] = props.p0;
200
+ $[1] = props.p1;
201
+ $[2] = props.p2;
202
+ $[3] = a;
203
} else {
204
- a$9 = $[3];
204
+ a = $[3];
205
}
206
207
- const c_4 = $[4] !== a$9;
208
- const c_5 = $[5] !== b$10;
209
- let t6$19;
207
+ const c_4 = $[4] !== a;
208
+ const c_5 = $[5] !== b;
209
+ let t6;
210
211
if (c_4 || c_5) {
212
- t6$19 = <Foo$6 a={a$9} b={b$10}></Foo$6>;
213
- $[4] = a$9;
214
- $[5] = b$10;
215
- $[6] = t6$19;
212
+ t6 = <Foo a={a} b={b}></Foo>;
213
+ $[4] = a;
214
+ $[5] = b;
215
+ $[6] = t6;
216
} else {
217
- t6$19 = $[6];
217
+ t6 = $[6];
218
}
219
220
- return t6$19;
220
+ return t6;
221
}
222
223
```
@@ -241,7 +241,7 @@ function Foo(
241
## Code
242
243
```javascript
244
-function Foo$0() {}
244
+function Foo() {}
245
246
```
247
## HIR
@@ -264,7 +264,7 @@ function mayMutate(
264
## Code
265
266
```javascript
267
-function mayMutate$0() {}
267
+function mayMutate() {}
268
269
```
270
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+22
-22
@@ -35,7 +35,7 @@ function Foo(
35
## Code
36
37
```javascript
38
-function Foo$0() {}
38
+function Foo() {}
39
40
```
41
## HIR
@@ -79,39 +79,39 @@ function Component(
79
## Code
80
81
```javascript
82
-function Component$0(props$9) {
82
+function Component(props) {
83
const $ = React.useMemoCache();
84
- let a$10;
85
- let b$11;
84
+ let a;
85
+ let b;
86
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
87
- a$10 = [];
88
- b$11 = {};
89
- new Foo$4(a$10, b$11);
87
+ a = [];
88
+ b = {};
89
+ new Foo(a, b);
90
91
- const _$13 = <div a={a$10}></div>;
91
+ const _ = <div a={a}></div>;
92
93
- new Foo$4(b$11);
94
- $[0] = a$10;
95
- $[1] = b$11;
93
+ new Foo(b);
94
+ $[0] = a;
95
+ $[1] = b;
96
} else {
97
- a$10 = $[0];
98
- b$11 = $[1];
97
+ a = $[0];
98
+ b = $[1];
99
}
100
101
- const c_2 = $[2] !== a$10;
102
- const c_3 = $[3] !== b$11;
103
- let t4$15;
101
+ const c_2 = $[2] !== a;
102
+ const c_3 = $[3] !== b;
103
+ let t4;
104
105
if (c_2 || c_3) {
106
- t4$15 = <div a={a$10} b={b$11}></div>;
107
- $[2] = a$10;
108
- $[3] = b$11;
109
- $[4] = t4$15;
106
+ t4 = <div a={a} b={b}></div>;
107
+ $[2] = a;
108
+ $[3] = b;
109
+ $[4] = t4;
110
} else {
111
- t4$15 = $[4];
111
+ t4 = $[4];
112
}
113
114
- return t4$15;
114
+ return t4;
115
}
116
117
```
compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md
+14
-14
@@ -72,28 +72,28 @@ function foo(
72
## Code
73
74
```javascript
75
-function foo$0(a$6, b$7) {
75
+function foo(a, b) {
76
const $ = React.useMemoCache();
77
- const c_0 = $[0] !== a$6;
78
- let x$8;
77
+ const c_0 = $[0] !== a;
78
+ let x;
79
if (c_0) {
80
- x$8 = [];
81
- x$8.push(a$6);
82
- $[0] = a$6;
83
- $[1] = x$8;
80
+ x = [];
81
+ x.push(a);
82
+ $[0] = a;
83
+ $[1] = x;
84
} else {
85
- x$8 = $[1];
85
+ x = $[1];
86
}
87
88
- <div>{x$8}</div>;
89
- const y$10 = [];
88
+ <div>{x}</div>;
89
+ const y = [];
90
91
- if (x$8.length) {
92
- y$10.push(x$8);
91
+ if (x.length) {
92
+ y.push(x);
93
}
94
95
- if (b$7) {
96
- y$10.push(b$7);
95
+ if (b) {
96
+ y.push(b);
97
}
98
}
99
compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md
+16
-16
@@ -71,32 +71,32 @@ function foo(
71
## Code
72
73
```javascript
74
-function foo$0(x$6, y$7, z$8) {
74
+function foo(x, y, z) {
75
const $ = React.useMemoCache();
76
- const items$9 = [z$8];
77
- items$9.push(x$6);
78
- const c_0 = $[0] !== x$6;
79
- const c_1 = $[1] !== y$7;
80
- let items2$10;
76
+ const items = [z];
77
+ items.push(x);
78
+ const c_0 = $[0] !== x;
79
+ const c_1 = $[1] !== y;
80
+ let items2;
81
if (c_0 || c_1) {
82
- items2$10 = [];
82
+ items2 = [];
83
84
- if (x$6) {
85
- items2$10.push(y$7);
84
+ if (x) {
85
+ items2.push(y);
86
}
87
88
- $[0] = x$6;
89
- $[1] = y$7;
90
- $[2] = items2$10;
88
+ $[0] = x;
89
+ $[1] = y;
90
+ $[2] = items2;
91
} else {
92
- items2$10 = $[2];
92
+ items2 = $[2];
93
}
94
95
- if (y$7) {
96
- items$9.push(x$6);
95
+ if (y) {
96
+ items.push(x);
97
}
98
99
- return items2$10;
99
+ return items2;
100
}
101
102
```
compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md
+8
-8
@@ -77,18 +77,18 @@ function foo(
77
## Code
78
79
```javascript
80
-function foo$0(a$7, b$8, c$9) {
81
- const x$10 = [];
82
- if (a$7) {
83
- if (b$8) {
84
- if (c$9) {
85
- x$10.push(0);
80
+function foo(a, b, c) {
81
+ const x = [];
82
+ if (a) {
83
+ if (b) {
84
+ if (c) {
85
+ x.push(0);
86
}
87
}
88
}
89
90
- if (a$7.length) {
91
- return a$7;
90
+ if (a.length) {
91
+ return a;
92
}
93
94
return null;
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+10
-10
@@ -44,19 +44,19 @@ function Component(
44
## Code
45
46
```javascript
47
-function Component$0() {
47
+function Component() {
48
const $ = React.useMemoCache();
49
- let a$5;
49
+ let a;
50
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
51
- a$5 = [];
52
- $[0] = a$5;
51
+ a = [];
52
+ $[0] = a;
53
} else {
54
- a$5 = $[0];
54
+ a = $[0];
55
}
56
57
- const b$6 = a$5;
58
- useFreeze$3(a$5);
59
- foo$4(b$6);
57
+ const b = a;
58
+ useFreeze(a);
59
+ foo(b);
60
}
61
62
```
@@ -80,7 +80,7 @@ function useFreeze(
80
## Code
81
82
```javascript
83
-function useFreeze$0() {}
83
+function useFreeze() {}
84
85
```
86
## HIR
@@ -104,7 +104,7 @@ function foo(
104
## Code
105
106
```javascript
107
-function foo$0(x$2) {}
107
+function foo(x) {}
108
109
```
110
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
+27
-27
@@ -39,7 +39,7 @@ function useFreeze(
39
## Code
40
41
```javascript
42
-function useFreeze$0() {}
42
+function useFreeze() {}
43
44
```
45
## HIR
@@ -62,7 +62,7 @@ function foo(
62
## Code
63
64
```javascript
65
-function foo$0() {}
65
+function foo() {}
66
67
```
68
## HIR
@@ -106,47 +106,47 @@ function Component(
106
## Code
107
108
```javascript
109
-function Component$0(props$10) {
109
+function Component(props) {
110
const $ = React.useMemoCache();
111
- let x$11;
111
+ let x;
112
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
113
- x$11 = [];
114
- $[0] = x$11;
113
+ x = [];
114
+ $[0] = x;
115
} else {
116
- x$11 = $[0];
116
+ x = $[0];
117
}
118
119
- const c_1 = $[1] !== x$11;
120
- let y$12;
119
+ const c_1 = $[1] !== x;
120
+ let y;
121
122
if (c_1) {
123
- y$12 = useFreeze$3(x$11);
124
- $[1] = x$11;
125
- $[2] = y$12;
123
+ y = useFreeze(x);
124
+ $[1] = x;
125
+ $[2] = y;
126
} else {
127
- y$12 = $[2];
127
+ y = $[2];
128
}
129
130
- foo$5(y$12, x$11);
131
- const c_3 = $[3] !== x$11;
132
- const c_4 = $[4] !== y$12;
133
- let t5$16;
130
+ foo(y, x);
131
+ const c_3 = $[3] !== x;
132
+ const c_4 = $[4] !== y;
133
+ let t5;
134
135
if (c_3 || c_4) {
136
- t5$16 = (
137
- <Component$0>
138
- {x$11}
139
- {y$12}
140
- </Component$0>
136
+ t5 = (
137
+ <Component>
138
+ {x}
139
+ {y}
140
+ </Component>
141
);
142
- $[3] = x$11;
143
- $[4] = y$12;
144
- $[5] = t5$16;
142
+ $[3] = x;
143
+ $[4] = y;
144
+ $[5] = t5;
145
} else {
146
- t5$16 = $[5];
146
+ t5 = $[5];
147
}
148
149
- return t5$16;
149
+ return t5;
150
}
151
152
```
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
+11
-11
@@ -45,20 +45,20 @@ function Component(
45
## Code
46
47
```javascript
48
-function Component$0() {
48
+function Component() {
49
const $ = React.useMemoCache();
50
- let a$4;
50
+ let a;
51
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
52
- a$4 = [];
53
- $[0] = a$4;
52
+ a = [];
53
+ $[0] = a;
54
} else {
55
- a$4 = $[0];
55
+ a = $[0];
56
}
57
58
- useFreeze$2(a$4);
59
- useFreeze$2(a$4);
60
- call$3(a$4);
61
- return a$4;
58
+ useFreeze(a);
59
+ useFreeze(a);
60
+ call(a);
61
+ return a;
62
}
63
64
```
@@ -83,7 +83,7 @@ function useFreeze(
83
## Code
84
85
```javascript
86
-function useFreeze$0(x$2) {}
86
+function useFreeze(x) {}
87
88
```
89
## HIR
@@ -107,7 +107,7 @@ function call(
107
## Code
108
109
```javascript
110
-function call$0(x$2) {}
110
+function call(x) {}
111
112
```
113
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+46
-46
@@ -29,24 +29,24 @@ 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$14_@0[4:9] = 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$11 = read x$9
37
- [6] Reassign mutate a$14_@0[4:9] = read a$11
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$12_@1 = Array []
42
- [8] Reassign mutate a$14_@0[4:9] = read a$12_@1
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$14_@0)
47
- [10] Call read useFreeze$5:TFunction(read a$14_@0)
48
- [11] Call mutate call$6:TFunction(read a$14_@0)
49
- [12] Return read a$14_@0
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
@@ -58,22 +58,22 @@ function Component(
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$14_@0] {
62
- [4] Let mutate a$14_@0[4:9] = 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$11 = read x$9
65
- [6] Reassign mutate a$14_@0[4:9] = read a$11
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$12_@1] {
68
- [7] Const mutate a$12_@1 = Array []
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$14_@0[4:9] = read a$12_@1
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$14_@0)
74
- [10] Call read useFreeze$5:TFunction(read a$14_@0)
75
- [11] Call mutate call$6:TFunction(read a$14_@0)
76
- return read a$14_@0
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
```
@@ -81,44 +81,44 @@ function Component(
81
## Code
82
83
```javascript
84
-function Component$0(props$7) {
84
+function Component(props) {
85
const $ = React.useMemoCache();
86
- const cond$8 = props$7.cond;
87
- const x$9 = props$7.x;
88
- const a$10 = undefined;
89
- const c_0 = $[0] !== cond$8;
90
- const c_1 = $[1] !== x$9;
91
- let a$14;
86
+ const cond = props.cond;
87
+ const x = props.x;
88
+ const a = undefined;
89
+ const c_0 = $[0] !== cond;
90
+ const c_1 = $[1] !== x;
91
+ let a$0;
92
if (c_0 || c_1) {
93
- a$14 = undefined;
93
+ a$0 = undefined;
94
95
- if (cond$8) {
96
- const a$11 = x$9;
97
- a$14 = a$11;
95
+ if (cond) {
96
+ const a$1 = x;
97
+ a$0 = a$1;
98
} else {
99
- let a$12;
99
+ let a$2;
100
101
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
102
- a$12 = [];
103
- $[3] = a$12;
102
+ a$2 = [];
103
+ $[3] = a$2;
104
} else {
105
- a$12 = $[3];
105
+ a$2 = $[3];
106
}
107
108
- a$14 = a$12;
108
+ a$0 = a$2;
109
}
110
111
- $[0] = cond$8;
112
- $[1] = x$9;
113
- $[2] = a$14;
111
+ $[0] = cond;
112
+ $[1] = x;
113
+ $[2] = a$0;
114
} else {
115
- a$14 = $[2];
115
+ a$0 = $[2];
116
}
117
118
- useFreeze$5(a$14);
119
- useFreeze$5(a$14);
120
- call$6(a$14);
121
- return a$14;
118
+ useFreeze(a$0);
119
+ useFreeze(a$0);
120
+ call(a$0);
121
+ return a$0;
122
}
123
124
```
@@ -143,7 +143,7 @@ function useFreeze(
143
## Code
144
145
```javascript
146
-function useFreeze$0(x$2) {}
146
+function useFreeze(x) {}
147
148
```
149
## HIR
@@ -167,7 +167,7 @@ function call(
167
## Code
168
169
```javascript
170
-function call$0(x$2) {}
170
+function call(x) {}
171
172
```
173
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+28
-28
@@ -53,7 +53,7 @@ function compute(
53
## Code
54
55
```javascript
56
-function compute$0() {}
56
+function compute() {}
57
58
```
59
## HIR
@@ -76,7 +76,7 @@ function mutate(
76
## Code
77
78
```javascript
79
-function mutate$0() {}
79
+function mutate() {}
80
81
```
82
## HIR
@@ -99,7 +99,7 @@ function foo(
99
## Code
100
101
```javascript
102
-function foo$0() {}
102
+function foo() {}
103
104
```
105
## HIR
@@ -122,7 +122,7 @@ function Foo(
122
## Code
123
124
```javascript
125
-function Foo$0() {}
125
+function Foo() {}
126
127
```
128
## HIR
@@ -168,43 +168,43 @@ function Component(
168
## Code
169
170
```javascript
171
-function Component$0(props$8) {
171
+function Component(props) {
172
const $ = React.useMemoCache();
173
- const c_0 = $[0] !== props$8.a;
174
- const c_1 = $[1] !== props$8.b;
175
- const c_2 = $[2] !== props$8.c;
176
- let a$9;
173
+ const c_0 = $[0] !== props.a;
174
+ const c_1 = $[1] !== props.b;
175
+ const c_2 = $[2] !== props.c;
176
+ let a;
177
if (c_0 || c_1 || c_2) {
178
- a$9 = compute$2(props$8.a);
179
- const b$10 = compute$2(props$8.b);
178
+ a = compute(props.a);
179
+ const b = compute(props.b);
180
181
- if (props$8.c) {
182
- mutate$5(a$9);
183
- mutate$5(b$10);
181
+ if (props.c) {
182
+ mutate(a);
183
+ mutate(b);
184
}
185
186
- $[0] = props$8.a;
187
- $[1] = props$8.b;
188
- $[2] = props$8.c;
189
- $[3] = a$9;
186
+ $[0] = props.a;
187
+ $[1] = props.b;
188
+ $[2] = props.c;
189
+ $[3] = a;
190
} else {
191
- a$9 = $[3];
191
+ a = $[3];
192
}
193
194
- const c_4 = $[4] !== a$9;
195
- const c_5 = $[5] !== b$10;
196
- let t6$14;
194
+ const c_4 = $[4] !== a;
195
+ const c_5 = $[5] !== b;
196
+ let t6;
197
198
if (c_4 || c_5) {
199
- t6$14 = <Foo$6 a={a$9} b={b$10}></Foo$6>;
200
- $[4] = a$9;
201
- $[5] = b$10;
202
- $[6] = t6$14;
199
+ t6 = <Foo a={a} b={b}></Foo>;
200
+ $[4] = a;
201
+ $[5] = b;
202
+ $[6] = t6;
203
} else {
204
- t6$14 = $[6];
204
+ t6 = $[6];
205
}
206
207
- return t6$14;
207
+ return t6;
208
}
209
210
```
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+25
-25
@@ -57,43 +57,43 @@ function Component(
57
## Code
58
59
```javascript
60
-function Component$0(props$7) {
60
+function Component(props) {
61
const $ = React.useMemoCache();
62
- const c_0 = $[0] !== props$7.a;
63
- let a$8;
62
+ const c_0 = $[0] !== props.a;
63
+ let a;
64
if (c_0) {
65
- a$8 = compute$2(props$7.a);
66
- $[0] = props$7.a;
67
- $[1] = a$8;
65
+ a = compute(props.a);
66
+ $[0] = props.a;
67
+ $[1] = a;
68
} else {
69
- a$8 = $[1];
69
+ a = $[1];
70
}
71
72
- const c_2 = $[2] !== props$7.b;
73
- let b$9;
72
+ const c_2 = $[2] !== props.b;
73
+ let b;
74
75
if (c_2) {
76
- b$9 = compute$2(props$7.b);
77
- $[2] = props$7.b;
78
- $[3] = b$9;
76
+ b = compute(props.b);
77
+ $[2] = props.b;
78
+ $[3] = b;
79
} else {
80
- b$9 = $[3];
80
+ b = $[3];
81
}
82
83
- const c_4 = $[4] !== a$8;
84
- const c_5 = $[5] !== b$9;
85
- let t6$10;
83
+ const c_4 = $[4] !== a;
84
+ const c_5 = $[5] !== b;
85
+ let t6;
86
87
if (c_4 || c_5) {
88
- t6$10 = <Foo$5 a={a$8} b={b$9}></Foo$5>;
89
- $[4] = a$8;
90
- $[5] = b$9;
91
- $[6] = t6$10;
88
+ t6 = <Foo a={a} b={b}></Foo>;
89
+ $[4] = a;
90
+ $[5] = b;
91
+ $[6] = t6;
92
} else {
93
- t6$10 = $[6];
93
+ t6 = $[6];
94
}
95
96
- return t6$10;
96
+ return t6;
97
}
98
99
```
@@ -117,7 +117,7 @@ function compute(
117
## Code
118
119
```javascript
120
-function compute$0() {}
120
+function compute() {}
121
122
```
123
## HIR
@@ -140,7 +140,7 @@ function foo(
140
## Code
141
142
```javascript
143
-function foo$0() {}
143
+function foo() {}
144
145
```
146
## HIR
@@ -163,7 +163,7 @@ function Foo(
163
## Code
164
165
```javascript
166
-function Foo$0() {}
166
+function Foo() {}
167
168
```
169
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md
+22
-22
@@ -45,39 +45,39 @@ function foo(
45
## Code
46
47
```javascript
48
-function foo$0(a$6, b$7, c$8) {
48
+function foo(a, b, c) {
49
const $ = React.useMemoCache();
50
- const c_0 = $[0] !== a$6;
51
- const c_1 = $[1] !== b$7;
52
- const c_2 = $[2] !== c$8;
53
- let x$9;
50
+ const c_0 = $[0] !== a;
51
+ const c_1 = $[1] !== b;
52
+ const c_2 = $[2] !== c;
53
+ let x;
54
if (c_0 || c_1 || c_2) {
55
- x$9 = {
56
- a: a$6,
55
+ x = {
56
+ a: a,
57
};
58
- const c_4 = $[4] !== b$7;
59
- const c_5 = $[5] !== c$8;
60
- let t6$10;
58
+ const c_4 = $[4] !== b;
59
+ const c_5 = $[5] !== c;
60
+ let t6;
61
62
if (c_4 || c_5) {
63
- t6$10 = [b$7, c$8];
64
- $[4] = b$7;
65
- $[5] = c$8;
66
- $[6] = t6$10;
63
+ t6 = [b, c];
64
+ $[4] = b;
65
+ $[5] = c;
66
+ $[6] = t6;
67
} else {
68
- t6$10 = $[6];
68
+ t6 = $[6];
69
}
70
71
- x$9.y = t6$10;
72
- $[0] = a$6;
73
- $[1] = b$7;
74
- $[2] = c$8;
75
- $[3] = x$9;
71
+ x.y = t6;
72
+ $[0] = a;
73
+ $[1] = b;
74
+ $[2] = c;
75
+ $[3] = x;
76
} else {
77
- x$9 = $[3];
77
+ x = $[3];
78
}
79
80
- return x$9;
80
+ return x;
81
}
82
83
```
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+29
-29
@@ -47,7 +47,7 @@ function compute(
47
## Code
48
49
```javascript
50
-function compute$0() {}
50
+function compute() {}
51
52
```
53
## HIR
@@ -70,7 +70,7 @@ function foo(
70
## Code
71
72
```javascript
73
-function foo$0() {}
73
+function foo() {}
74
75
```
76
## HIR
@@ -93,7 +93,7 @@ function Foo(
93
## Code
94
95
```javascript
96
-function Foo$0() {}
96
+function Foo() {}
97
98
```
99
## HIR
@@ -137,45 +137,45 @@ function Component(
137
## Code
138
139
```javascript
140
-function Component$0(props$8) {
140
+function Component(props) {
141
const $ = React.useMemoCache();
142
- const c_0 = $[0] !== props$8.a;
143
- const c_1 = $[1] !== props$8.b;
144
- const c_2 = $[2] !== props$8.c;
145
- let a$9;
146
- let b$10;
142
+ const c_0 = $[0] !== props.a;
143
+ const c_1 = $[1] !== props.b;
144
+ const c_2 = $[2] !== props.c;
145
+ let a;
146
+ let b;
147
if (c_0 || c_1 || c_2) {
148
- a$9 = compute$2(props$8.a);
149
- b$10 = compute$2(props$8.b);
148
+ a = compute(props.a);
149
+ b = compute(props.b);
150
151
- if (props$8.c) {
152
- foo$5(a$9, b$10);
151
+ if (props.c) {
152
+ foo(a, b);
153
}
154
155
- $[0] = props$8.a;
156
- $[1] = props$8.b;
157
- $[2] = props$8.c;
158
- $[3] = a$9;
159
- $[4] = b$10;
155
+ $[0] = props.a;
156
+ $[1] = props.b;
157
+ $[2] = props.c;
158
+ $[3] = a;
159
+ $[4] = b;
160
} else {
161
- a$9 = $[3];
162
- b$10 = $[4];
161
+ a = $[3];
162
+ b = $[4];
163
}
164
165
- const c_5 = $[5] !== a$9;
166
- const c_6 = $[6] !== b$10;
167
- let t7$14;
165
+ const c_5 = $[5] !== a;
166
+ const c_6 = $[6] !== b;
167
+ let t7;
168
169
if (c_5 || c_6) {
170
- t7$14 = <Foo$6 a={a$9} b={b$10}></Foo$6>;
171
- $[5] = a$9;
172
- $[6] = b$10;
173
- $[7] = t7$14;
170
+ t7 = <Foo a={a} b={b}></Foo>;
171
+ $[5] = a;
172
+ $[6] = b;
173
+ $[7] = t7;
174
} else {
175
- t7$14 = $[7];
175
+ t7 = $[7];
176
}
177
178
- return t7$14;
178
+ return t7;
179
}
180
181
```
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+26
-26
@@ -57,39 +57,39 @@ function Component(
57
## Code
58
59
```javascript
60
-function Component$0(props$8) {
60
+function Component(props) {
61
const $ = React.useMemoCache();
62
- const c_0 = $[0] !== props$8.a;
63
- const c_1 = $[1] !== props$8.b;
64
- let a$9;
65
- let b$10;
62
+ const c_0 = $[0] !== props.a;
63
+ const c_1 = $[1] !== props.b;
64
+ let a;
65
+ let b;
66
if (c_0 || c_1) {
67
- a$9 = compute$2(props$8.a);
68
- b$10 = compute$2(props$8.b);
69
- foo$5(a$9, b$10);
70
- $[0] = props$8.a;
71
- $[1] = props$8.b;
72
- $[2] = a$9;
73
- $[3] = b$10;
67
+ a = compute(props.a);
68
+ b = compute(props.b);
69
+ foo(a, b);
70
+ $[0] = props.a;
71
+ $[1] = props.b;
72
+ $[2] = a;
73
+ $[3] = b;
74
} else {
75
- a$9 = $[2];
76
- b$10 = $[3];
75
+ a = $[2];
76
+ b = $[3];
77
}
78
79
- const c_4 = $[4] !== a$9;
80
- const c_5 = $[5] !== b$10;
81
- let t6$11;
79
+ const c_4 = $[4] !== a;
80
+ const c_5 = $[5] !== b;
81
+ let t6;
82
83
if (c_4 || c_5) {
84
- t6$11 = <Foo$6 a={a$9} b={b$10}></Foo$6>;
85
- $[4] = a$9;
86
- $[5] = b$10;
87
- $[6] = t6$11;
84
+ t6 = <Foo a={a} b={b}></Foo>;
85
+ $[4] = a;
86
+ $[5] = b;
87
+ $[6] = t6;
88
} else {
89
- t6$11 = $[6];
89
+ t6 = $[6];
90
}
91
92
- return t6$11;
92
+ return t6;
93
}
94
95
```
@@ -113,7 +113,7 @@ function compute(
113
## Code
114
115
```javascript
116
-function compute$0() {}
116
+function compute() {}
117
118
```
119
## HIR
@@ -136,7 +136,7 @@ function foo(
136
## Code
137
138
```javascript
139
-function foo$0() {}
139
+function foo() {}
140
141
```
142
## HIR
@@ -159,7 +159,7 @@ function Foo(
159
## Code
160
161
```javascript
162
-function Foo$0() {}
162
+function Foo() {}
163
164
```
165
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md
+5
-5
@@ -54,11 +54,11 @@ function foo(
54
## Code
55
56
```javascript
57
-function foo$0(a$5, b$6, c$7) {
58
- const y$8 = [];
59
- if (a$5) {
60
- if (b$6) {
61
- y$8.push(c$7);
57
+function foo(a, b, c) {
58
+ const y = [];
59
+ if (a) {
60
+ if (b) {
61
+ y.push(c);
62
}
63
}
64
}
compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md
+11
-11
@@ -42,23 +42,23 @@ function Component(
42
## Code
43
44
```javascript
45
-function Component$0(c$6) {
45
+function Component(c) {
46
const $ = React.useMemoCache();
47
- const c_0 = $[0] !== c$6;
48
- let x$7;
47
+ const c_0 = $[0] !== c;
48
+ let x;
49
if (c_0) {
50
- x$7 = {
51
- c: c$6,
50
+ x = {
51
+ c: c,
52
};
53
- mutate$3(x$7);
54
- $[0] = c$6;
55
- $[1] = x$7;
53
+ mutate(x);
54
+ $[0] = c;
55
+ $[1] = x;
56
} else {
57
- x$7 = $[1];
57
+ x = $[1];
58
}
59
60
- const a$8 = x$7;
61
- const b$9 = a$8;
60
+ const a = x;
61
+ const b = a;
62
}
63
64
```
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
+22
-22
@@ -64,46 +64,46 @@ function Foo(
64
## Code
65
66
```javascript
67
-function Foo$0(props$13) {
67
+function Foo(props) {
68
const $ = React.useMemoCache();
69
- let t0$20;
69
+ let t0;
70
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
71
- t0$20 = <>Text</>;
72
- $[0] = t0$20;
71
+ t0 = <>Text</>;
72
+ $[0] = t0;
73
} else {
74
- t0$20 = $[0];
74
+ t0 = $[0];
75
}
76
77
- const c_1 = $[1] !== t0$20;
78
- let t2$22;
77
+ const c_1 = $[1] !== t0;
78
+ let t2;
79
80
if (c_1) {
81
- t2$22 = <div>{t0$20}</div>;
82
- $[1] = t0$20;
83
- $[2] = t2$22;
81
+ t2 = <div>{t0}</div>;
82
+ $[1] = t0;
83
+ $[2] = t2;
84
} else {
85
- t2$22 = $[2];
85
+ t2 = $[2];
86
}
87
88
- const c_3 = $[3] !== props$13.greeting;
89
- const c_4 = $[4] !== t2$22;
90
- let t5$24;
88
+ const c_3 = $[3] !== props.greeting;
89
+ const c_4 = $[4] !== t2;
90
+ let t5;
91
92
if (c_3 || c_4) {
93
- t5$24 = (
93
+ t5 = (
94
<>
95
- Hello {props$13.greeting}
96
- {t2$22}
95
+ Hello {props.greeting}
96
+ {t2}
97
</>
98
);
99
- $[3] = props$13.greeting;
100
- $[4] = t2$22;
101
- $[5] = t5$24;
99
+ $[3] = props.greeting;
100
+ $[4] = t2;
101
+ $[5] = t5;
102
} else {
103
- t5$24 = $[5];
103
+ t5 = $[5];
104
}
105
106
- return t5$24;
106
+ return t5;
107
}
108
109
```
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
+59
-59
@@ -69,44 +69,44 @@ function And(
69
## Code
70
71
```javascript
72
-function And$0() {
72
+function And() {
73
const $ = React.useMemoCache();
74
- let t0$5;
74
+ let t0;
75
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
76
- t0$5 = f$1();
77
- $[0] = t0$5;
76
+ t0 = f();
77
+ $[0] = t0;
78
} else {
79
- t0$5 = $[0];
79
+ t0 = $[0];
80
}
81
82
- const c_1 = $[1] !== t0$5;
83
- let t2$8;
82
+ const c_1 = $[1] !== t0;
83
+ let t2;
84
85
if (c_1) {
86
- t2$8 = undefined;
86
+ t2 = undefined;
87
88
- if (t0$5) {
89
- let t3$6;
88
+ if (t0) {
89
+ let t3;
90
91
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
92
- t3$6 = g$4();
93
- $[3] = t3$6;
92
+ t3 = g();
93
+ $[3] = t3;
94
} else {
95
- t3$6 = $[3];
95
+ t3 = $[3];
96
}
97
98
- t2$8 = t3$6;
98
+ t2 = t3;
99
} else {
100
- t2$8 = t0$5;
100
+ t2 = t0;
101
}
102
103
- $[1] = t0$5;
104
- $[2] = t2$8;
103
+ $[1] = t0;
104
+ $[2] = t2;
105
} else {
106
- t2$8 = $[2];
106
+ t2 = $[2];
107
}
108
109
- return t2$8;
109
+ return t2;
110
}
111
112
```
@@ -160,44 +160,44 @@ function Or(
160
## Code
161
162
```javascript
163
-function Or$0() {
163
+function Or() {
164
const $ = React.useMemoCache();
165
- let t0$5;
165
+ let t0;
166
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
167
- t0$5 = f$1();
168
- $[0] = t0$5;
167
+ t0 = f();
168
+ $[0] = t0;
169
} else {
170
- t0$5 = $[0];
170
+ t0 = $[0];
171
}
172
173
- const c_1 = $[1] !== t0$5;
174
- let t2$8;
173
+ const c_1 = $[1] !== t0;
174
+ let t2;
175
176
if (c_1) {
177
- t2$8 = undefined;
177
+ t2 = undefined;
178
179
- if (t0$5) {
180
- t2$8 = t0$5;
179
+ if (t0) {
180
+ t2 = t0;
181
} else {
182
- let t3$7;
182
+ let t3;
183
184
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
185
- t3$7 = g$4();
186
- $[3] = t3$7;
185
+ t3 = g();
186
+ $[3] = t3;
187
} else {
188
- t3$7 = $[3];
188
+ t3 = $[3];
189
}
190
191
- t2$8 = t3$7;
191
+ t2 = t3;
192
}
193
194
- $[1] = t0$5;
195
- $[2] = t2$8;
194
+ $[1] = t0;
195
+ $[2] = t2;
196
} else {
197
- t2$8 = $[2];
197
+ t2 = $[2];
198
}
199
200
- return t2$8;
200
+ return t2;
201
}
202
203
```
@@ -256,44 +256,44 @@ function QuestionQuestion(
256
## Code
257
258
```javascript
259
-function QuestionQuestion$0(props$8) {
259
+function QuestionQuestion(props) {
260
const $ = React.useMemoCache();
261
- let t0$9;
261
+ let t0;
262
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
263
- t0$9 = f$2();
264
- $[0] = t0$9;
263
+ t0 = f();
264
+ $[0] = t0;
265
} else {
266
- t0$9 = $[0];
266
+ t0 = $[0];
267
}
268
269
- const c_1 = $[1] !== t0$9;
270
- let t2$14;
269
+ const c_1 = $[1] !== t0;
270
+ let t2;
271
272
if (c_1) {
273
- t2$14 = undefined;
273
+ t2 = undefined;
274
275
- if (t0$9 != null) {
276
- t2$14 = t0$9;
275
+ if (t0 != null) {
276
+ t2 = t0;
277
} else {
278
- let t3$13;
278
+ let t3;
279
280
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
281
- t3$13 = g$7();
282
- $[3] = t3$13;
281
+ t3 = g();
282
+ $[3] = t3;
283
} else {
284
- t3$13 = $[3];
284
+ t3 = $[3];
285
}
286
287
- t2$14 = t3$13;
287
+ t2 = t3;
288
}
289
290
- $[1] = t0$9;
291
- $[2] = t2$14;
290
+ $[1] = t0;
291
+ $[2] = t2;
292
} else {
293
- t2$14 = $[2];
293
+ t2 = $[2];
294
}
295
296
- return t2$14;
296
+ return t2;
297
}
298
299
```
@@ -317,7 +317,7 @@ function f(
317
## Code
318
319
```javascript
320
-function f$0() {}
320
+function f() {}
321
322
```
323
## HIR
@@ -340,7 +340,7 @@ function g(
340
## Code
341
342
```javascript
343
-function g$0() {}
343
+function g() {}
344
345
```
346
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+54
-54
@@ -61,7 +61,7 @@ function mutate(
61
## Code
62
63
```javascript
64
-function mutate$0(x$3, y$4) {}
64
+function mutate(x, y) {}
65
66
```
67
## HIR
@@ -85,7 +85,7 @@ function cond(
85
## Code
86
87
```javascript
88
-function cond$0(x$2) {}
88
+function cond(x) {}
89
90
```
91
## HIR
@@ -96,10 +96,10 @@ bb0:
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$30_@0[1:23] = read a$13_@0:TObject
100
- [5] Let mutate b$31_@0[1:23] = read b$14_@0:TObject
101
- [5] Let mutate c$32_@0[1:23] = read c$15_@0:TObject
102
- [5] Let mutate d$33_@0[1:23] = read d$16_@0:TObject
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
@@ -114,30 +114,30 @@ bb3:
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$30_@0[1:23] = read a$13_@0:TObject
118
- [15] Reassign mutate b$31_@0[1:23] = read b$14_@0:TObject
119
- [15] Reassign mutate c$32_@0[1:23] = read c$15_@0:TObject
120
- [15] Reassign mutate d$33_@0[1:23] = read d$16_@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$30_@0) then:bb7 else:bb7 fallthrough=bb7
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$31_@0) then:bb9 else:bb9 fallthrough=bb9
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$32_@0) then:bb11 else:bb11 fallthrough=bb11
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$33_@0) then:bb13 else:bb13 fallthrough=bb13
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$33_@0, read $34:TPrimitive)
140
+ [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive)
141
[23] Return
142
```
143
@@ -151,10 +151,10 @@ function Component(
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$30_@0[1:23] = read a$13_@0:TObject
155
- [5] Let mutate b$31_@0[1:23] = read b$14_@0:TObject
156
- [5] Let mutate c$32_@0[1:23] = read c$15_@0:TObject
157
- [5] Let mutate d$33_@0[1:23] = read d$16_@0:TObject
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
@@ -166,24 +166,24 @@ function Component(
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$30_@0[1:23] = read a$13_@0:TObject
170
- [15] Reassign mutate b$31_@0[1:23] = read b$14_@0:TObject
171
- [15] Reassign mutate c$32_@0[1:23] = read c$15_@0:TObject
172
- [15] Reassign mutate d$33_@0[1:23] = read d$16_@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$30_@0) {
177
+ if (read a$0$30_@0) {
178
}
179
- if (read b$31_@0) {
179
+ if (read b$1$31_@0) {
180
}
181
- if (read c$32_@0) {
181
+ if (read c$2$32_@0) {
182
}
183
- if (read d$33_@0) {
183
+ if (read d$3$33_@0) {
184
}
185
[21] Const mutate $34:TPrimitive = null
186
- [22] Call mutate mutate$7:TFunction(mutate d$33_@0, read $34:TPrimitive)
186
+ [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive)
187
return
188
}
189
@@ -192,45 +192,45 @@ function Component(
192
## Code
193
194
```javascript
195
-function Component$0(props$12) {
196
- let a$13 = {};
197
- let b$14 = {};
198
- let c$15 = {};
199
- let d$16 = {};
200
- let a$30 = a$13;
201
- let b$31 = b$14;
202
- let c$32 = c$15;
203
- let d$33 = d$16;
195
+function Component(props) {
196
+ let a = {};
197
+ let b = {};
198
+ let c = {};
199
+ let d = {};
200
+ let a$0 = a;
201
+ let b$1 = b;
202
+ let c$2 = c;
203
+ let d$3 = d;
204
while (true) {
205
- const z$19 = a$13;
206
- a$13 = b$14;
207
- b$14 = c$15;
208
- c$15 = d$16;
209
- d$16 = z$19;
210
- mutate$7(a$13, b$14);
211
- a$30 = a$13;
212
- b$31 = b$14;
213
- c$32 = c$15;
214
- d$33 = d$16;
215
-
216
- if (cond$8(a$13)) {
205
+ const z = a;
206
+ a = b;
207
+ b = c;
208
+ c = d;
209
+ d = z;
210
+ mutate(a, b);
211
+ a$0 = a;
212
+ b$1 = b;
213
+ c$2 = c;
214
+ d$3 = d;
215
+
216
+ if (cond(a)) {
217
break;
218
}
219
}
220
221
- if (a$30) {
221
+ if (a$0) {
222
}
223
224
- if (b$31) {
224
+ if (b$1) {
225
}
226
227
- if (c$32) {
227
+ if (c$2) {
228
}
229
230
- if (d$33) {
230
+ if (d$3) {
231
}
232
233
- mutate$7(d$33, null);
233
+ mutate(d$3, null);
234
}
235
236
```
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+22
-22
@@ -57,7 +57,7 @@ function mutate(
57
## Code
58
59
```javascript
60
-function mutate$0(x$3, y$4) {}
60
+function mutate(x, y) {}
61
62
```
63
## HIR
@@ -128,49 +128,49 @@ function Component(
128
## Code
129
130
```javascript
131
-function Component$0(props$10) {
131
+function Component(props) {
132
const $ = React.useMemoCache();
133
- let a$11;
133
+ let a;
134
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
135
- a$11 = {};
136
- $[0] = a$11;
135
+ a = {};
136
+ $[0] = a;
137
} else {
138
- a$11 = $[0];
138
+ a = $[0];
139
}
140
141
- const b$12 = [a$11];
142
- let c$13;
141
+ const b = [a];
142
+ let c;
143
144
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
145
- c$13 = {};
146
- $[1] = c$13;
145
+ c = {};
146
+ $[1] = c;
147
} else {
148
- c$13 = $[1];
148
+ c = $[1];
149
}
150
151
- const d$14 = {
152
- c: c$13,
151
+ const d = {
152
+ c: c,
153
};
154
- const x$15 = {};
155
- x$15.b = b$12;
156
- const y$16 = mutate$7(x$15, d$14);
154
+ const x = {};
155
+ x.b = b;
156
+ const y = mutate(x, d);
157
158
- if (a$11) {
158
+ if (a) {
159
}
160
161
- if (b$12) {
161
+ if (b) {
162
}
163
164
- if (c$13) {
164
+ if (c) {
165
}
166
167
- if (d$14) {
167
+ if (d) {
168
}
169
170
- if (y$16) {
170
+ if (y) {
171
}
172
173
- mutate$7(x$15, null);
173
+ mutate(x, null);
174
}
175
176
```
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
+17
-17
@@ -54,7 +54,7 @@ function mutate(
54
## Code
55
56
```javascript
57
-function mutate$0() {}
57
+function mutate() {}
58
59
```
60
## HIR
@@ -77,7 +77,7 @@ function cond(
77
## Code
78
79
```javascript
80
-function cond$0() {}
80
+function cond() {}
81
82
```
83
## HIR
@@ -160,41 +160,41 @@ function Component(
160
## Code
161
162
```javascript
163
-function Component$0(props$11) {
163
+function Component(props) {
164
const $ = React.useMemoCache();
165
- const a$12 = {};
166
- const b$13 = {};
167
- let c$14;
165
+ const a = {};
166
+ const b = {};
167
+ let c;
168
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
169
- c$14 = {};
170
- $[0] = c$14;
169
+ c = {};
170
+ $[0] = c;
171
} else {
172
- c$14 = $[0];
172
+ c = $[0];
173
}
174
175
- const d$15 = {};
175
+ const d = {};
176
177
while (true) {
178
- mutate$6(a$12, b$13);
178
+ mutate(a, b);
179
180
- if (cond$7(a$12)) {
180
+ if (cond(a)) {
181
break;
182
}
183
}
184
185
- if (a$12) {
185
+ if (a) {
186
}
187
188
- if (b$13) {
188
+ if (b) {
189
}
190
191
- if (c$14) {
191
+ if (c) {
192
}
193
194
- if (d$15) {
194
+ if (d) {
195
}
196
197
- mutate$6(d$15, null);
197
+ mutate(d, null);
198
}
199
200
```
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md
+6
-6
@@ -51,14 +51,14 @@ function foo(
51
## Code
52
53
```javascript
54
-function foo$0(a$6, b$7, c$8) {
55
- const x$9 = [];
56
- const y$10 = [];
57
- if (x$9) {
54
+function foo(a, b, c) {
55
+ const x = [];
56
+ const y = [];
57
+ if (x) {
58
}
59
60
- y$10.push(a$6);
61
- x$9.push(b$7);
60
+ y.push(a);
61
+ x.push(b);
62
}
63
64
```
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md
+5
-5
@@ -41,11 +41,11 @@ function foo(
41
## Code
42
43
```javascript
44
-function foo$0(a$5, b$6) {
45
- const x$7 = [];
46
- const y$8 = [];
47
- x$7.push(a$5);
48
- y$8.push(b$6);
44
+function foo(a, b) {
45
+ const x = [];
46
+ const y = [];
47
+ x.push(a);
48
+ y.push(b);
49
}
50
51
```
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md
+5
-5
@@ -41,11 +41,11 @@ function foo(
41
## Code
42
43
```javascript
44
-function foo$0(a$5, b$6) {
45
- const x$7 = [];
46
- const y$8 = [];
47
- y$8.push(b$6);
48
- x$7.push(a$5);
44
+function foo(a, b) {
45
+ const x = [];
46
+ const y = [];
47
+ y.push(b);
48
+ x.push(a);
49
}
50
51
```
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md
+30
-30
@@ -74,57 +74,57 @@ function foo(
74
## Code
75
76
```javascript
77
-function foo$0(a$8, b$9, c$10) {
77
+function foo(a, b, c) {
78
const $ = React.useMemoCache();
79
- const c_0 = $[0] !== a$8;
80
- const c_1 = $[1] !== b$9;
81
- const c_2 = $[2] !== c$10;
82
- let x$11;
79
+ const c_0 = $[0] !== a;
80
+ const c_1 = $[1] !== b;
81
+ const c_2 = $[2] !== c;
82
+ let x;
83
if (c_0 || c_1 || c_2) {
84
- x$11 = [];
84
+ x = [];
85
86
- if (a$8) {
87
- const c_4 = $[4] !== b$9;
88
- const c_5 = $[5] !== c$10;
89
- let y$12;
86
+ if (a) {
87
+ const c_4 = $[4] !== b;
88
+ const c_5 = $[5] !== c;
89
+ let y;
90
91
if (c_4 || c_5) {
92
- y$12 = [];
92
+ y = [];
93
94
- if (b$9) {
95
- y$12.push(c$10);
94
+ if (b) {
95
+ y.push(c);
96
}
97
98
- $[4] = b$9;
99
- $[5] = c$10;
100
- $[6] = y$12;
98
+ $[4] = b;
99
+ $[5] = c;
100
+ $[6] = y;
101
} else {
102
- y$12 = $[6];
102
+ y = $[6];
103
}
104
105
- const c_7 = $[7] !== y$12;
106
- let t8$15;
105
+ const c_7 = $[7] !== y;
106
+ let t8;
107
108
if (c_7) {
109
- t8$15 = <div>{y$12}</div>;
110
- $[7] = y$12;
111
- $[8] = t8$15;
109
+ t8 = <div>{y}</div>;
110
+ $[7] = y;
111
+ $[8] = t8;
112
} else {
113
- t8$15 = $[8];
113
+ t8 = $[8];
114
}
115
116
- x$11.push(t8$15);
116
+ x.push(t8);
117
}
118
119
- $[0] = a$8;
120
- $[1] = b$9;
121
- $[2] = c$10;
122
- $[3] = x$11;
119
+ $[0] = a;
120
+ $[1] = b;
121
+ $[2] = c;
122
+ $[3] = x;
123
} else {
124
- x$11 = $[3];
124
+ x = $[3];
125
}
126
127
- return x$11;
127
+ return x;
128
}
129
130
```
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md
+6
-6
@@ -57,12 +57,12 @@ function foo(
57
## Code
58
59
```javascript
60
-function foo$0(a$6, b$7, c$8) {
61
- const x$9 = [];
62
- const y$10 = [];
63
- while (c$8) {
64
- y$10.push(b$7);
65
- x$9.push(a$6);
60
+function foo(a, b, c) {
61
+ const x = [];
62
+ const y = [];
63
+ while (c) {
64
+ y.push(b);
65
+ x.push(a);
66
}
67
}
68
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md
+17
-17
@@ -66,34 +66,34 @@ function foo(
66
## Code
67
68
```javascript
69
-function foo$0(a$6, b$7, c$8) {
69
+function foo(a, b, c) {
70
const $ = React.useMemoCache();
71
- const c_0 = $[0] !== a$6;
72
- const c_1 = $[1] !== b$7;
73
- const c_2 = $[2] !== c$8;
74
- let x$9;
71
+ const c_0 = $[0] !== a;
72
+ const c_1 = $[1] !== b;
73
+ const c_2 = $[2] !== c;
74
+ let x;
75
if (c_0 || c_1 || c_2) {
76
- x$9 = [];
76
+ x = [];
77
78
- if (a$6) {
79
- const y$10 = [];
78
+ if (a) {
79
+ const y = [];
80
81
- if (b$7) {
82
- y$10.push(c$8);
81
+ if (b) {
82
+ y.push(c);
83
}
84
85
- x$9.push(y$10);
85
+ x.push(y);
86
}
87
88
- $[0] = a$6;
89
- $[1] = b$7;
90
- $[2] = c$8;
91
- $[3] = x$9;
88
+ $[0] = a;
89
+ $[1] = b;
90
+ $[2] = c;
91
+ $[3] = x;
92
} else {
93
- x$9 = $[3];
93
+ x = $[3];
94
}
95
96
- return x$9;
96
+ return x;
97
}
98
99
```
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+23
-23
@@ -50,39 +50,39 @@ function Component(
50
## Code
51
52
```javascript
53
-function Component$0(props$6) {
53
+function Component(props) {
54
const $ = React.useMemoCache();
55
- const c_0 = $[0] !== props$6.p0;
56
- let x$7;
57
- let child$9;
55
+ const c_0 = $[0] !== props.p0;
56
+ let x;
57
+ let child;
58
if (c_0) {
59
- x$7 = {};
60
- const y$8 = [];
61
- x$7.y = y$8;
62
- child$9 = <Component$0 data={y$8}></Component$0>;
63
- x$7.y.push(props$6.p0);
64
- $[0] = props$6.p0;
65
- $[1] = x$7;
66
- $[2] = child$9;
59
+ x = {};
60
+ const y = [];
61
+ x.y = y;
62
+ child = <Component data={y}></Component>;
63
+ x.y.push(props.p0);
64
+ $[0] = props.p0;
65
+ $[1] = x;
66
+ $[2] = child;
67
} else {
68
- x$7 = $[1];
69
- child$9 = $[2];
68
+ x = $[1];
69
+ child = $[2];
70
}
71
72
- const c_3 = $[3] !== x$7;
73
- const c_4 = $[4] !== child$9;
74
- let t5$10;
72
+ const c_3 = $[3] !== x;
73
+ const c_4 = $[4] !== child;
74
+ let t5;
75
76
if (c_3 || c_4) {
77
- t5$10 = <Component$0 data={x$7}>{child$9}</Component$0>;
78
- $[3] = x$7;
79
- $[4] = child$9;
80
- $[5] = t5$10;
77
+ t5 = <Component data={x}>{child}</Component>;
78
+ $[3] = x;
79
+ $[4] = child;
80
+ $[5] = t5;
81
} else {
82
- t5$10 = $[5];
82
+ t5 = $[5];
83
}
84
85
- return t5$10;
85
+ return t5;
86
}
87
88
```
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
+13
-13
@@ -48,29 +48,29 @@ function foo(
48
## Code
49
50
```javascript
51
-function foo$0() {
51
+function foo() {
52
const $ = React.useMemoCache();
53
- let x$4;
53
+ let x;
54
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
55
- x$4 = {};
56
- let y$5;
55
+ x = {};
56
+ let y;
57
58
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
59
- y$5 = [];
60
- const z$6 = {};
61
- y$5.push(z$6);
62
- $[1] = y$5;
59
+ y = [];
60
+ const z = {};
61
+ y.push(z);
62
+ $[1] = y;
63
} else {
64
- y$5 = $[1];
64
+ y = $[1];
65
}
66
67
- x$4.y = y$5;
68
- $[0] = x$4;
67
+ x.y = y;
68
+ $[0] = x;
69
} else {
70
- x$4 = $[0];
70
+ x = $[0];
71
}
72
73
- return x$4;
73
+ return x;
74
}
75
76
```
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md
+28
-28
@@ -71,53 +71,53 @@ function foo(
71
## Code
72
73
```javascript
74
-function foo$0(a$8, b$9, c$10) {
74
+function foo(a, b, c) {
75
const $ = React.useMemoCache();
76
- const c_0 = $[0] !== a$8;
77
- const c_1 = $[1] !== b$9;
78
- const c_2 = $[2] !== c$10;
79
- let x$11;
76
+ const c_0 = $[0] !== a;
77
+ const c_1 = $[1] !== b;
78
+ const c_2 = $[2] !== c;
79
+ let x;
80
if (c_0 || c_1 || c_2) {
81
- x$11 = [];
81
+ x = [];
82
83
- if (a$8) {
84
- const c_4 = $[4] !== b$9;
85
- let y$12;
83
+ if (a) {
84
+ const c_4 = $[4] !== b;
85
+ let y;
86
87
if (c_4) {
88
- y$12 = [];
89
- y$12.push(b$9);
90
- $[4] = b$9;
91
- $[5] = y$12;
88
+ y = [];
89
+ y.push(b);
90
+ $[4] = b;
91
+ $[5] = y;
92
} else {
93
- y$12 = $[5];
93
+ y = $[5];
94
}
95
96
- const c_6 = $[6] !== y$12;
97
- let t7$14;
96
+ const c_6 = $[6] !== y;
97
+ let t7;
98
99
if (c_6) {
100
- t7$14 = <div>{y$12}</div>;
101
- $[6] = y$12;
102
- $[7] = t7$14;
100
+ t7 = <div>{y}</div>;
101
+ $[6] = y;
102
+ $[7] = t7;
103
} else {
104
- t7$14 = $[7];
104
+ t7 = $[7];
105
}
106
107
- x$11.push(t7$14);
107
+ x.push(t7);
108
} else {
109
- x$11.push(c$10);
109
+ x.push(c);
110
}
111
112
- $[0] = a$8;
113
- $[1] = b$9;
114
- $[2] = c$10;
115
- $[3] = x$11;
112
+ $[0] = a;
113
+ $[1] = b;
114
+ $[2] = c;
115
+ $[3] = x;
116
} else {
117
- x$11 = $[3];
117
+ x = $[3];
118
}
119
120
- return x$11;
120
+ return x;
121
}
122
123
```
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
+19
-19
@@ -66,39 +66,39 @@ function f(
66
## Code
67
68
```javascript
69
-function f$0(a$8, b$9) {
69
+function f(a, b) {
70
const $ = React.useMemoCache();
71
- const c_0 = $[0] !== a$8.length;
72
- const c_1 = $[1] !== b$9;
73
- let x$10;
71
+ const c_0 = $[0] !== a.length;
72
+ const c_1 = $[1] !== b;
73
+ let x;
74
if (c_0 || c_1) {
75
- x$10 = [];
75
+ x = [];
76
77
- if (a$8.length === 1) {
78
- if (b$9) {
79
- x$10.push(b$9);
77
+ if (a.length === 1) {
78
+ if (b) {
79
+ x.push(b);
80
}
81
}
82
83
- $[0] = a$8.length;
84
- $[1] = b$9;
85
- $[2] = x$10;
83
+ $[0] = a.length;
84
+ $[1] = b;
85
+ $[2] = x;
86
} else {
87
- x$10 = $[2];
87
+ x = $[2];
88
}
89
90
- const c_3 = $[3] !== x$10;
91
- let t4$15;
90
+ const c_3 = $[3] !== x;
91
+ let t4;
92
93
if (c_3) {
94
- t4$15 = <div>{x$10}</div>;
95
- $[3] = x$10;
96
- $[4] = t4$15;
94
+ t4 = <div>{x}</div>;
95
+ $[3] = x;
96
+ $[4] = t4;
97
} else {
98
- t4$15 = $[4];
98
+ t4 = $[4];
99
}
100
101
- return t4$15;
101
+ return t4;
102
}
103
104
```
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+45
-45
@@ -26,18 +26,18 @@ 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$11_@1[1:7] = 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$9_@2 = Array []
34
- [6] Reassign mutate x$11_@1[1:7] = read x$9_@2
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$11_@1} ></read Component$0>
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$11_@1} y={read y$8} ></read Component$0>
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
@@ -52,19 +52,19 @@ function Component(
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$11_@1] {
56
- [4] Let mutate x$11_@1[1:7] = 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$9_@2] {
59
- [5] Const mutate x$9_@2 = Array []
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$11_@1[1:7] = read x$9_@2
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$11_@1} ></read Component$0>
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$11_@1, read y$8] out=[$15_@4] {
67
- [9] Const mutate $15_@4 = JSX <read Component$0 x={read x$11_@1} y={read y$8} ></read Component$0>
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
}
@@ -74,62 +74,62 @@ function Component(
74
## Code
75
76
```javascript
77
-function Component$0(props$6) {
77
+function Component(props) {
78
const $ = React.useMemoCache();
79
- const c_0 = $[0] !== props$6.p0;
80
- let x$7;
79
+ const c_0 = $[0] !== props.p0;
80
+ let x;
81
if (c_0) {
82
- x$7 = [];
83
- x$7.push(props$6.p0);
84
- $[0] = props$6.p0;
85
- $[1] = x$7;
82
+ x = [];
83
+ x.push(props.p0);
84
+ $[0] = props.p0;
85
+ $[1] = x;
86
} else {
87
- x$7 = $[1];
87
+ x = $[1];
88
}
89
90
- const y$8 = x$7;
91
- const c_2 = $[2] !== props$6.p1;
92
- let x$11;
90
+ const y = x;
91
+ const c_2 = $[2] !== props.p1;
92
+ let x$0;
93
94
if (c_2) {
95
- x$11 = x$7;
95
+ x$0 = x;
96
97
- if (props$6.p1) {
98
- let x$9;
97
+ if (props.p1) {
98
+ let x$1;
99
100
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
101
- x$9 = [];
102
- $[4] = x$9;
101
+ x$1 = [];
102
+ $[4] = x$1;
103
} else {
104
- x$9 = $[4];
104
+ x$1 = $[4];
105
}
106
107
- x$11 = x$9;
107
+ x$0 = x$1;
108
}
109
110
- $[2] = props$6.p1;
111
- $[3] = x$11;
110
+ $[2] = props.p1;
111
+ $[3] = x$0;
112
} else {
113
- x$11 = $[3];
113
+ x$0 = $[3];
114
}
115
116
- const _$12 = <Component$0 x={x$11}></Component$0>;
116
+ const _ = <Component x={x$0}></Component>;
117
118
- y$8.push(props$6.p2);
119
- const c_5 = $[5] !== x$11;
120
- const c_6 = $[6] !== y$8;
121
- let t7$15;
118
+ y.push(props.p2);
119
+ const c_5 = $[5] !== x$0;
120
+ const c_6 = $[6] !== y;
121
+ let t7;
122
123
if (c_5 || c_6) {
124
- t7$15 = <Component$0 x={x$11} y={y$8}></Component$0>;
125
- $[5] = x$11;
126
- $[6] = y$8;
127
- $[7] = t7$15;
124
+ t7 = <Component x={x$0} y={y}></Component>;
125
+ $[5] = x$0;
126
+ $[6] = y;
127
+ $[7] = t7;
128
} else {
129
- t7$15 = $[7];
129
+ t7 = $[7];
130
}
131
132
- return t7$15;
132
+ return t7;
133
}
134
135
```
compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md
+71
-71
@@ -45,22 +45,22 @@ bb1:
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$30_@2[8:15] = undefined
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$22_@3[9:11] = Array []
56
- [10] Call mutate x$22_@3.push(read b$14)
57
- [11] Reassign mutate x$30_@2[8:15] = read x$22_@3
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$23_@4[12:14] = Array []
62
- [13] Call mutate x$23_@4.push(read c$15)
63
- [14] Reassign mutate x$30_@2[8:15] = read x$23_@4
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
@@ -68,7 +68,7 @@ bb3:
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$30_@2}{read $28:TPrimitive}</read $25:TPrimitive>
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
@@ -91,23 +91,23 @@ function foo(
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$30_@2] {
95
- [8] Let mutate x$30_@2[8:15] = undefined
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$22_@3] {
99
- [9] Const mutate x$22_@3[9:11] = Array []
100
- [10] Call mutate x$22_@3.push(read b$14)
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$30_@2[8:15] = read x$22_@3
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$23_@4] {
107
- [12] Const mutate x$23_@4[12:14] = Array []
108
- [13] Call mutate x$23_@4.push(read c$15)
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$30_@2[8:15] = read x$23_@4
110
+ [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4
111
}
112
}
113
}
@@ -115,8 +115,8 @@ function foo(
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$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$30_@2}{read $28:TPrimitive}</read $25:TPrimitive>
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
}
@@ -126,102 +126,102 @@ function foo(
126
## Code
127
128
```javascript
129
-function foo$0(a$13, b$14, c$15) {
129
+function foo(a, b, c) {
130
const $ = React.useMemoCache();
131
- const c_0 = $[0] !== a$13;
132
- let x$16;
131
+ const c_0 = $[0] !== a;
132
+ let x;
133
if (c_0) {
134
- x$16 = [];
134
+ x = [];
135
136
- if (a$13) {
137
- x$16.push(a$13);
136
+ if (a) {
137
+ x.push(a);
138
}
139
140
- $[0] = a$13;
141
- $[1] = x$16;
140
+ $[0] = a;
141
+ $[1] = x;
142
} else {
143
- x$16 = $[1];
143
+ x = $[1];
144
}
145
146
- const c_2 = $[2] !== x$16;
147
- let y$19;
146
+ const c_2 = $[2] !== x;
147
+ let y;
148
149
if (c_2) {
150
- y$19 = <div>{x$16}</div>;
151
- $[2] = x$16;
152
- $[3] = y$19;
150
+ y = <div>{x}</div>;
151
+ $[2] = x;
152
+ $[3] = y;
153
} else {
154
- y$19 = $[3];
154
+ y = $[3];
155
}
156
157
- const c_4 = $[4] !== b$14;
158
- const c_5 = $[5] !== c$15;
159
- let x$30;
157
+ const c_4 = $[4] !== b;
158
+ const c_5 = $[5] !== c;
159
+ let x$0;
160
161
if (c_4 || c_5) {
162
- x$30 = undefined;
162
+ x$0 = undefined;
163
164
- bb3: switch (b$14) {
164
+ bb3: switch (b) {
165
case 0: {
166
- const c_7 = $[7] !== b$14;
167
- let x$22;
166
+ const c_7 = $[7] !== b;
167
+ let x$1;
168
169
if (c_7) {
170
- x$22 = [];
171
- x$22.push(b$14);
172
- $[7] = b$14;
173
- $[8] = x$22;
170
+ x$1 = [];
171
+ x$1.push(b);
172
+ $[7] = b;
173
+ $[8] = x$1;
174
} else {
175
- x$22 = $[8];
175
+ x$1 = $[8];
176
}
177
178
- x$30 = x$22;
178
+ x$0 = x$1;
179
break bb3;
180
}
181
182
default: {
183
- const c_9 = $[9] !== c$15;
184
- let x$23;
183
+ const c_9 = $[9] !== c;
184
+ let x$2;
185
186
if (c_9) {
187
- x$23 = [];
188
- x$23.push(c$15);
189
- $[9] = c$15;
190
- $[10] = x$23;
187
+ x$2 = [];
188
+ x$2.push(c);
189
+ $[9] = c;
190
+ $[10] = x$2;
191
} else {
192
- x$23 = $[10];
192
+ x$2 = $[10];
193
}
194
195
- x$30 = x$23;
195
+ x$0 = x$2;
196
}
197
}
198
199
- $[4] = b$14;
200
- $[5] = c$15;
201
- $[6] = x$30;
199
+ $[4] = b;
200
+ $[5] = c;
201
+ $[6] = x$0;
202
} else {
203
- x$30 = $[6];
203
+ x$0 = $[6];
204
}
205
206
- const c_11 = $[11] !== y$19;
207
- const c_12 = $[12] !== x$30;
208
- let t13$31;
206
+ const c_11 = $[11] !== y;
207
+ const c_12 = $[12] !== x$0;
208
+ let t13;
209
210
if (c_11 || c_12) {
211
- t13$31 = (
211
+ t13 = (
212
<div>
213
- {y$19}
214
- {x$30}
213
+ {y}
214
+ {x$0}
215
</div>
216
);
217
- $[11] = y$19;
218
- $[12] = x$30;
219
- $[13] = t13$31;
217
+ $[11] = y;
218
+ $[12] = x$0;
219
+ $[13] = t13;
220
} else {
221
- t13$31 = $[13];
221
+ t13 = $[13];
222
}
223
224
- return t13$31;
224
+ return t13;
225
}
226
227
```
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+34
-34
@@ -24,10 +24,10 @@ 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$9_@1 = Array []
28
- [5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$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$9_@1} y={freeze y$8_@0} ></read Component$0>
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
@@ -41,14 +41,14 @@ function Component(
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$9_@1] {
45
- [4] Const mutate x$9_@1 = Array []
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$9_@1} ></read Component$0>
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$9_@1, freeze y$8_@0] out=[$11_@3] {
51
- [7] Const mutate $11_@3 = JSX <read Component$0 x={read x$9_@1} y={freeze y$8_@0} ></read Component$0>
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
}
@@ -58,48 +58,48 @@ function Component(
58
## Code
59
60
```javascript
61
-function Component$0(props$6) {
61
+function Component(props) {
62
const $ = React.useMemoCache();
63
- const c_0 = $[0] !== props$6.p0;
64
- const c_1 = $[1] !== props$6.p1;
65
- let y$8;
63
+ const c_0 = $[0] !== props.p0;
64
+ const c_1 = $[1] !== props.p1;
65
+ let y;
66
if (c_0 || c_1) {
67
- const x$7 = [];
68
- x$7.push(props$6.p0);
69
- y$8 = x$7;
70
- let x$9;
67
+ const x = [];
68
+ x.push(props.p0);
69
+ y = x;
70
+ let x$0;
71
72
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
73
- x$9 = [];
74
- $[3] = x$9;
73
+ x$0 = [];
74
+ $[3] = x$0;
75
} else {
76
- x$9 = $[3];
76
+ x$0 = $[3];
77
}
78
79
- const _$10 = <Component$0 x={x$9}></Component$0>;
79
+ const _ = <Component x={x$0}></Component>;
80
81
- y$8.push(props$6.p1);
82
- $[0] = props$6.p0;
83
- $[1] = props$6.p1;
84
- $[2] = y$8;
81
+ y.push(props.p1);
82
+ $[0] = props.p0;
83
+ $[1] = props.p1;
84
+ $[2] = y;
85
} else {
86
- y$8 = $[2];
86
+ y = $[2];
87
}
88
89
- const c_4 = $[4] !== x$9;
90
- const c_5 = $[5] !== y$8;
91
- let t6$11;
89
+ const c_4 = $[4] !== x$0;
90
+ const c_5 = $[5] !== y;
91
+ let t6;
92
93
if (c_4 || c_5) {
94
- t6$11 = <Component$0 x={x$9} y={y$8}></Component$0>;
95
- $[4] = x$9;
96
- $[5] = y$8;
97
- $[6] = t6$11;
94
+ t6 = <Component x={x$0} y={y}></Component>;
95
+ $[4] = x$0;
96
+ $[5] = y;
97
+ $[6] = t6;
98
} else {
99
- t6$11 = $[6];
99
+ t6 = $[6];
100
}
101
102
- return t6$11;
102
+ return t6;
103
}
104
105
```
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+61
-61
@@ -37,7 +37,7 @@ function Component(props) {
37
```
38
bb0:
39
[1] Const mutate x$7:TPrimitive = undefined
40
- [2] Let mutate x$16_@0[2:18] = 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
@@ -52,35 +52,35 @@ bb2:
52
Fallthrough: bb1
53
bb8:
54
predecessor blocks: bb2
55
- [7] Const mutate x$11 = read props$6.v0
56
- [8] Reassign mutate x$16_@0[2:18] = read x$11
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$12 = read props$6.v1
61
- [10] Reassign mutate x$16_@0[2:18] = read x$12
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$13 = read props$6.v2
66
- [12] Reassign mutate x$16_@0[2:18] = read x$13
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$14 = read props$6.b
74
- [15] Reassign mutate x$16_@0[2:18] = read x$14
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$15 = read props$6.c
79
- [17] Reassign mutate x$16_@0[2:18] = read x$15
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$16_@0
83
+ [18] read x$0$16_@0
84
[19] Return
85
```
86
@@ -91,41 +91,41 @@ 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$16_@0] {
95
- [2] Let mutate x$16_@0[2:18] = 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$11 = read props$6.v0
103
- [8] Reassign mutate x$16_@0[2:18] = read x$11
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$12 = read props$6.v1
108
- [10] Reassign mutate x$16_@0[2:18] = read x$12
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$13 = read props$6.v2
115
- [12] Reassign mutate x$16_@0[2:18] = read x$13
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$14 = read props$6.b
121
- [15] Reassign mutate x$16_@0[2:18] = read x$14
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$15 = read props$6.c
124
- [17] Reassign mutate x$16_@0[2:18] = read x$15
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$16_@0
128
+ [18] read x$0$16_@0
129
return
130
}
131
@@ -134,32 +134,32 @@ function Component(
134
## Code
135
136
```javascript
137
-function Component$0(props$6) {
137
+function Component(props) {
138
const $ = React.useMemoCache();
139
- const x$7 = undefined;
140
- const c_0 = $[0] !== props$6.cond;
141
- const c_1 = $[1] !== props$6.test;
142
- const c_2 = $[2] !== props$6.v0;
143
- const c_3 = $[3] !== props$6.v1;
144
- const c_4 = $[4] !== props$6.v2;
145
- const c_5 = $[5] !== props$6.cond2;
146
- const c_6 = $[6] !== props$6.b;
147
- const c_7 = $[7] !== props$6.c;
148
- let x$16;
139
+ const x = undefined;
140
+ const c_0 = $[0] !== props.cond;
141
+ const c_1 = $[1] !== props.test;
142
+ const c_2 = $[2] !== props.v0;
143
+ const c_3 = $[3] !== props.v1;
144
+ const c_4 = $[4] !== props.v2;
145
+ const c_5 = $[5] !== props.cond2;
146
+ const c_6 = $[6] !== props.b;
147
+ const c_7 = $[7] !== props.c;
148
+ let x$0;
149
if (c_0 || c_1 || c_2 || c_3 || c_4 || c_5 || c_6 || c_7) {
150
- x$16 = undefined;
150
+ x$0 = undefined;
151
152
- bb1: if (props$6.cond) {
153
- switch (props$6.test) {
152
+ bb1: if (props.cond) {
153
+ switch (props.test) {
154
case 0: {
155
- const x$11 = props$6.v0;
156
- x$16 = x$11;
155
+ const x$1 = props.v0;
156
+ x$0 = x$1;
157
break bb1;
158
}
159
160
case 1: {
161
- const x$12 = props$6.v1;
162
- x$16 = x$12;
161
+ const x$2 = props.v1;
162
+ x$0 = x$2;
163
break bb1;
164
}
165
@@ -167,34 +167,34 @@ function Component$0(props$6) {
167
}
168
169
default: {
170
- const x$13 = props$6.v2;
171
- x$16 = x$13;
170
+ const x$3 = props.v2;
171
+ x$0 = x$3;
172
}
173
}
174
} else {
175
- if (props$6.cond2) {
176
- const x$14 = props$6.b;
177
- x$16 = x$14;
175
+ if (props.cond2) {
176
+ const x$4 = props.b;
177
+ x$0 = x$4;
178
} else {
179
- const x$15 = props$6.c;
180
- x$16 = x$15;
179
+ const x$5 = props.c;
180
+ x$0 = x$5;
181
}
182
}
183
184
- $[0] = props$6.cond;
185
- $[1] = props$6.test;
186
- $[2] = props$6.v0;
187
- $[3] = props$6.v1;
188
- $[4] = props$6.v2;
189
- $[5] = props$6.cond2;
190
- $[6] = props$6.b;
191
- $[7] = props$6.c;
192
- $[8] = x$16;
184
+ $[0] = props.cond;
185
+ $[1] = props.test;
186
+ $[2] = props.v0;
187
+ $[3] = props.v1;
188
+ $[4] = props.v2;
189
+ $[5] = props.cond2;
190
+ $[6] = props.b;
191
+ $[7] = props.c;
192
+ $[8] = x$0;
193
} else {
194
- x$16 = $[8];
194
+ x$0 = $[8];
195
}
196
197
- x$16;
197
+ x$0;
198
}
199
200
```
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
+24
-24
@@ -36,7 +36,7 @@ function mutate(
36
## Code
37
38
```javascript
39
-function mutate$0() {}
39
+function mutate() {}
40
41
```
42
## HIR
@@ -46,11 +46,11 @@ 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$8_@1:TObject[2:8] = read b$6_@1:TObject
50
- [5] Const mutate b$9_@1:TObject[2:8] = read c$7_@1:TObject
51
- [6] Const mutate c$10_@1:TObject[2:8] = read a$8_@1:TObject
52
- [7] Call mutate mutate$4:TFunction(mutate a$8_@1:TObject, mutate b$9_@1:TObject)
53
- [8] Return freeze c$10_@1:TObject
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
@@ -59,15 +59,15 @@ bb0:
59
function foo(
60
) {
61
[1] Const mutate a$5_@0:TObject = Object { }
62
- scope @1 [2:8] deps=[] out=[c$10_@1] {
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$8_@1:TObject[2:8] = read b$6_@1:TObject
66
- [5] Const mutate b$9_@1:TObject[2:8] = read c$7_@1:TObject
67
- [6] Const mutate c$10_@1:TObject[2:8] = read a$8_@1:TObject
68
- [7] Call mutate mutate$4:TFunction(mutate a$8_@1:TObject, mutate b$9_@1:TObject)
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$10_@1:TObject
70
+ return freeze c$2$10_@1:TObject
71
}
72
73
```
@@ -75,23 +75,23 @@ function foo(
75
## Code
76
77
```javascript
78
-function foo$0() {
78
+function foo() {
79
const $ = React.useMemoCache();
80
- const a$5 = {};
81
- let c$10;
80
+ const a = {};
81
+ let c$2;
82
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
83
- const b$6 = {};
84
- const c$7 = {};
85
- const a$8 = b$6;
86
- const b$9 = c$7;
87
- c$10 = a$8;
88
- mutate$4(a$8, b$9);
89
- $[0] = c$10;
83
+ const b = {};
84
+ const c = {};
85
+ const a$0 = b;
86
+ const b$1 = c;
87
+ c$2 = a$0;
88
+ mutate(a$0, b$1);
89
+ $[0] = c$2;
90
} else {
91
- c$10 = $[0];
91
+ c$2 = $[0];
92
}
93
94
- return c$10;
94
+ return c$2;
95
}
96
97
```
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
+14
-14
@@ -56,33 +56,33 @@ function foo(
56
## Code
57
58
```javascript
59
-function foo$0(x$8, y$9) {
59
+function foo(x, y) {
60
const $ = React.useMemoCache();
61
- if (x$8) {
62
- const c_0 = $[0] !== y$9;
63
- let t1$11;
61
+ if (x) {
62
+ const c_0 = $[0] !== y;
63
+ let t1;
64
65
if (c_0) {
66
- t1$11 = foo$0(false, y$9);
67
- $[0] = y$9;
68
- $[1] = t1$11;
66
+ t1 = foo(false, y);
67
+ $[0] = y;
68
+ $[1] = t1;
69
} else {
70
- t1$11 = $[1];
70
+ t1 = $[1];
71
}
72
73
- return t1$11;
73
+ return t1;
74
}
75
76
- let t2$14;
76
+ let t2;
77
78
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
79
- t2$14 = [y$9 * 10];
80
- $[2] = t2$14;
79
+ t2 = [y * 10];
80
+ $[2] = t2;
81
} else {
82
- t2$14 = $[2];
82
+ t2 = $[2];
83
}
84
85
- return t2$14;
85
+ return t2;
86
}
87
88
```
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
+8
-8
@@ -40,19 +40,19 @@ function Component(
40
## Code
41
42
```javascript
43
-function Component$0(props$5) {
43
+function Component(props) {
44
const $ = React.useMemoCache();
45
- const a$6 = 1;
46
- const b$7 = 2;
47
- let x$8;
45
+ const a = 1;
46
+ const b = 2;
47
+ let x;
48
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
49
- x$8 = [a$6, b$7];
50
- $[0] = x$8;
49
+ x = [a, b];
50
+ $[0] = x;
51
} else {
52
- x$8 = $[0];
52
+ x = $[0];
53
}
54
55
- return x$8;
55
+ return x;
56
}
57
58
```
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
+27
-27
@@ -38,7 +38,7 @@ function foo(
38
## Code
39
40
```javascript
41
-function foo$0() {}
41
+function foo() {}
42
43
```
44
## HIR
@@ -94,49 +94,49 @@ function Component(
94
## Code
95
96
```javascript
97
-function Component$0(props$10) {
97
+function Component(props) {
98
const $ = React.useMemoCache();
99
- let a$11;
100
- let b$12;
99
+ let a;
100
+ let b;
101
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
102
- a$11 = [];
103
- b$12 = {};
104
- foo$4(a$11, b$12);
105
- let t2$13;
102
+ a = [];
103
+ b = {};
104
+ foo(a, b);
105
+ let t2;
106
107
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
108
- t2$13 = foo$4();
109
- $[2] = t2$13;
108
+ t2 = foo();
109
+ $[2] = t2;
110
} else {
111
- t2$13 = $[2];
111
+ t2 = $[2];
112
}
113
114
- if (t2$13) {
115
- const _$15 = <div a={a$11}></div>;
114
+ if (t2) {
115
+ const _ = <div a={a}></div>;
116
}
117
118
- foo$4(a$11, b$12);
119
- $[0] = a$11;
120
- $[1] = b$12;
118
+ foo(a, b);
119
+ $[0] = a;
120
+ $[1] = b;
121
} else {
122
- a$11 = $[0];
123
- b$12 = $[1];
122
+ a = $[0];
123
+ b = $[1];
124
}
125
126
- const c_3 = $[3] !== a$11;
127
- const c_4 = $[4] !== b$12;
128
- let t5$20;
126
+ const c_3 = $[3] !== a;
127
+ const c_4 = $[4] !== b;
128
+ let t5;
129
130
if (c_3 || c_4) {
131
- t5$20 = <div a={a$11} b={b$12}></div>;
132
- $[3] = a$11;
133
- $[4] = b$12;
134
- $[5] = t5$20;
131
+ t5 = <div a={a} b={b}></div>;
132
+ $[3] = a;
133
+ $[4] = b;
134
+ $[5] = t5;
135
} else {
136
- t5$20 = $[5];
136
+ t5 = $[5];
137
}
138
139
- return t5$20;
139
+ return t5;
140
}
141
142
```
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
+22
-22
@@ -35,7 +35,7 @@ function foo(
35
## Code
36
37
```javascript
38
-function foo$0() {}
38
+function foo() {}
39
40
```
41
## HIR
@@ -79,39 +79,39 @@ function Component(
79
## Code
80
81
```javascript
82
-function Component$0(props$9) {
82
+function Component(props) {
83
const $ = React.useMemoCache();
84
- let a$10;
85
- let b$11;
84
+ let a;
85
+ let b;
86
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
87
- a$10 = [];
88
- b$11 = {};
89
- foo$4(a$10, b$11);
87
+ a = [];
88
+ b = {};
89
+ foo(a, b);
90
91
- const _$13 = <div a={a$10}></div>;
91
+ const _ = <div a={a}></div>;
92
93
- foo$4(a$10, b$11);
94
- $[0] = a$10;
95
- $[1] = b$11;
93
+ foo(a, b);
94
+ $[0] = a;
95
+ $[1] = b;
96
} else {
97
- a$10 = $[0];
98
- b$11 = $[1];
97
+ a = $[0];
98
+ b = $[1];
99
}
100
101
- const c_2 = $[2] !== a$10;
102
- const c_3 = $[3] !== b$11;
103
- let t4$15;
101
+ const c_2 = $[2] !== a;
102
+ const c_3 = $[3] !== b;
103
+ let t4;
104
105
if (c_2 || c_3) {
106
- t4$15 = <div a={a$10} b={b$11}></div>;
107
- $[2] = a$10;
108
- $[3] = b$11;
109
- $[4] = t4$15;
106
+ t4 = <div a={a} b={b}></div>;
107
+ $[2] = a;
108
+ $[3] = b;
109
+ $[4] = t4;
110
} else {
111
- t4$15 = $[4];
111
+ t4 = $[4];
112
}
113
114
- return t4$15;
114
+ return t4;
115
}
116
117
```
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
+34
-34
@@ -25,27 +25,27 @@ bb0:
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$17_@0[1:8] = read x$7: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$11:TPrimitive = 3
33
- [7] Reassign mutate x$17_@0[1:8] = read x$11:TPrimitive
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$16_@1[1:13] = read x$17_@0
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$15:TPrimitive = 5
44
- [12] Reassign mutate x$16_@1[1:13] = read x$15:TPrimitive
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$18 = read x$16_@1
48
+ [13] Const mutate y$4$18 = read x$2$16_@1
49
[14] Return
50
```
51
@@ -58,23 +58,23 @@ function foo(
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$17_@0] {
62
- [5] Let mutate x$17_@0[1:8] = read x$7: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$11:TPrimitive = 3
65
- [7] Reassign mutate x$17_@0[1:8] = read x$11: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$16_@1] {
71
- [10] Let mutate x$16_@1[1:13] = read x$17_@0
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$15:TPrimitive = 5
74
- [12] Reassign mutate x$16_@1[1:13] = read x$15: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$18 = read x$16_@1
77
+ [13] Const mutate y$4$18 = read x$2$16_@1
78
return
79
}
80
@@ -83,40 +83,40 @@ function foo(
83
## Code
84
85
```javascript
86
-function foo$0() {
86
+function foo() {
87
const $ = React.useMemoCache();
88
- const x$7 = 1;
89
- const y$8 = 2;
90
- let x$17;
88
+ const x = 1;
89
+ const y = 2;
90
+ let x$0;
91
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
92
- x$17 = x$7;
92
+ x$0 = x;
93
94
- if (y$8 === 2) {
95
- const x$11 = 3;
96
- x$17 = x$11;
94
+ if (y === 2) {
95
+ const x$1 = 3;
96
+ x$0 = x$1;
97
}
98
99
- $[0] = x$17;
99
+ $[0] = x$0;
100
} else {
101
- x$17 = $[0];
101
+ x$0 = $[0];
102
}
103
104
- let x$16;
104
+ let x$2;
105
106
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
107
- x$16 = x$17;
107
+ x$2 = x$0;
108
109
- if (y$8 === 3) {
110
- const x$15 = 5;
111
- x$16 = x$15;
109
+ if (y === 3) {
110
+ const x$3 = 5;
111
+ x$2 = x$3;
112
}
113
114
- $[1] = x$16;
114
+ $[1] = x$2;
115
} else {
116
- x$16 = $[1];
116
+ x$2 = $[1];
117
}
118
119
- const y$18 = x$16;
119
+ const y$4 = x$2;
120
}
121
122
```
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
+20
-20
@@ -22,16 +22,16 @@ bb0:
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$10_@0[1:8] = read x$5: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$9:TPrimitive = 3
30
- [7] Reassign mutate x$10_@0[1:8] = read x$9:TPrimitive
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$11 = read x$10_@0
34
+ [8] Const mutate y$2$11 = read x$0$10_@0
35
[9] Return
36
```
37
@@ -44,14 +44,14 @@ function foo(
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$10_@0] {
48
- [5] Let mutate x$10_@0[1:8] = read x$5: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$9:TPrimitive = 3
51
- [7] Reassign mutate x$10_@0[1:8] = read x$9: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$11 = read x$10_@0
54
+ [8] Const mutate y$2$11 = read x$0$10_@0
55
return
56
}
57
@@ -60,25 +60,25 @@ function foo(
60
## Code
61
62
```javascript
63
-function foo$0() {
63
+function foo() {
64
const $ = React.useMemoCache();
65
- const x$5 = 1;
66
- const y$6 = 2;
67
- let x$10;
65
+ const x = 1;
66
+ const y = 2;
67
+ let x$0;
68
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
69
- x$10 = x$5;
69
+ x$0 = x;
70
71
- if (y$6 === 2) {
72
- const x$9 = 3;
73
- x$10 = x$9;
71
+ if (y === 2) {
72
+ const x$1 = 3;
73
+ x$0 = x$1;
74
}
75
76
- $[0] = x$10;
76
+ $[0] = x$0;
77
} else {
78
- x$10 = $[0];
78
+ x$0 = $[0];
79
}
80
81
- const y$11 = x$10;
81
+ const y$2 = x$0;
82
}
83
84
```
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
+2
-2
@@ -54,8 +54,8 @@ function foo(
54
## Code
55
56
```javascript
57
-function foo$0(cond$4) {
58
- const items$5 = [];
57
+function foo(cond) {
58
+ const items = [];
59
}
60
61
```
compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md
+8
-8
@@ -69,22 +69,22 @@ function foo(
69
## Code
70
71
```javascript
72
-function foo$0() {
72
+function foo() {
73
const $ = React.useMemoCache();
74
- let x$6;
74
+ let x;
75
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
76
- x$6 = 1;
76
+ x = 1;
77
78
- for (const i$7 = 0; i$7 < 10; i$7) {
79
- x$6 = x$6 + 1;
78
+ for (const i = 0; i < 10; i) {
79
+ x = x + 1;
80
}
81
82
- $[0] = x$6;
82
+ $[0] = x;
83
} else {
84
- x$6 = $[0];
84
+ x = $[0];
85
}
86
87
- return x$6;
87
+ return x;
88
}
89
90
```
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
+8
-8
@@ -73,22 +73,22 @@ function foo(
73
## Code
74
75
```javascript
76
-function foo$0() {
76
+function foo() {
77
const $ = React.useMemoCache();
78
- let x$7;
78
+ let x;
79
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
80
- x$7 = 1;
80
+ x = 1;
81
82
- for (let i$8 = 0; i$8 < 10; i$8 = i$8 + 1, i$8) {
83
- x$7 = x$7 + 1;
82
+ for (let i = 0; i < 10; i = i + 1, i) {
83
+ x = x + 1;
84
}
85
86
- $[0] = x$7;
86
+ $[0] = x;
87
} else {
88
- x$7 = $[0];
88
+ x = $[0];
89
}
90
91
- return x$7;
91
+ return x;
92
}
93
94
```
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
+6
-6
@@ -55,13 +55,13 @@ function foo(
55
## Code
56
57
```javascript
58
-function foo$0() {
59
- const x$5 = 1;
60
- const y$6 = 2;
61
- if (y$6) {
62
- const z$7 = x$5 + y$6;
58
+function foo() {
59
+ const x = 1;
60
+ const y = 2;
61
+ if (y) {
62
+ const z = x + y;
63
} else {
64
- const z$8 = x$5;
64
+ const z = x;
65
}
66
}
67
compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md
+56
-56
@@ -30,7 +30,7 @@ function foo(a, b, c, d) {
30
bb0:
31
[1] Const mutate x$13:TPrimitive = 0
32
[2] Const mutate $14:TPrimitive = true
33
- [3] Let mutate x$23_@0[3:20] = undefined
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
@@ -38,18 +38,18 @@ bb2:
38
[5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3
39
bb4:
40
predecessor blocks: bb2
41
- [6] Const mutate x$16 = read a$9
42
- [7] Reassign mutate x$23_@0[3:20] = read x$16
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$17 = read b$10
47
- [9] Reassign mutate x$23_@0[3:20] = read x$17
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$18
52
- [11] Reassign mutate x$23_@0[3:20] = read x$18
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
@@ -57,22 +57,22 @@ bb6:
57
[13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7
58
bb8:
59
predecessor blocks: bb6
60
- [14] Const mutate x$20 = read c$11
61
- [15] Reassign mutate x$23_@0[3:20] = read x$20
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$21 = read d$12
66
- [17] Reassign mutate x$23_@0[3:20] = read x$21
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$22
71
- [19] Reassign mutate x$23_@0[3:20] = read x$22
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$23_@0
75
+ [20] Return read x$0$23_@0
76
```
77
78
## Reactive Scopes
@@ -86,33 +86,33 @@ function foo(
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$23_@0] {
90
- [3] Let mutate x$23_@0[3:20] = undefined
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$16 = read a$9
95
- [7] Reassign mutate x$23_@0[3:20] = read x$16
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$17 = read b$10
98
- [9] Reassign mutate x$23_@0[3:20] = read x$17
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$18
101
- [11] Reassign mutate x$23_@0[3:20] = read x$18
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$20 = read c$11
106
- [15] Reassign mutate x$23_@0[3:20] = read x$20
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$21 = read d$12
109
- [17] Reassign mutate x$23_@0[3:20] = read x$21
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$22
112
- [19] Reassign mutate x$23_@0[3:20] = read x$22
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$23_@0
115
+ return read x$0$23_@0
116
}
117
118
```
@@ -120,51 +120,51 @@ function foo(
120
## Code
121
122
```javascript
123
-function foo$0(a$9, b$10, c$11, d$12) {
123
+function foo(a, b, c, d) {
124
const $ = React.useMemoCache();
125
- const x$13 = 0;
126
- const c_0 = $[0] !== a$9;
127
- const c_1 = $[1] !== b$10;
128
- const c_2 = $[2] !== c$11;
129
- const c_3 = $[3] !== d$12;
130
- let x$23;
125
+ const x = 0;
126
+ const c_0 = $[0] !== a;
127
+ const c_1 = $[1] !== b;
128
+ const c_2 = $[2] !== c;
129
+ const c_3 = $[3] !== d;
130
+ let x$0;
131
if (c_0 || c_1 || c_2 || c_3) {
132
- x$23 = undefined;
132
+ x$0 = undefined;
133
134
if (true) {
135
if (true) {
136
- const x$16 = a$9;
137
- x$23 = x$16;
136
+ const x$1 = a;
137
+ x$0 = x$1;
138
} else {
139
- const x$17 = b$10;
140
- x$23 = x$17;
139
+ const x$2 = b;
140
+ x$0 = x$2;
141
}
142
143
- x$18;
144
- x$23 = x$18;
143
+ x$3;
144
+ x$0 = x$3;
145
} else {
146
if (true) {
147
- const x$20 = c$11;
148
- x$23 = x$20;
147
+ const x$4 = c;
148
+ x$0 = x$4;
149
} else {
150
- const x$21 = d$12;
151
- x$23 = x$21;
150
+ const x$5 = d;
151
+ x$0 = x$5;
152
}
153
154
- x$22;
155
- x$23 = x$22;
154
+ x$6;
155
+ x$0 = x$6;
156
}
157
158
- $[0] = a$9;
159
- $[1] = b$10;
160
- $[2] = c$11;
161
- $[3] = d$12;
162
- $[4] = x$23;
158
+ $[0] = a;
159
+ $[1] = b;
160
+ $[2] = c;
161
+ $[3] = d;
162
+ $[4] = x$0;
163
} else {
164
- x$23 = $[4];
164
+ x$0 = $[4];
165
}
166
167
- return x$23;
167
+ return x$0;
168
}
169
170
```
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md
+7
-7
@@ -85,17 +85,17 @@ function foo(
85
## Code
86
87
```javascript
88
-function foo$0(a$6, b$7, c$8) {
89
- const x$9 = 0;
90
- while (a$6) {
91
- while (b$7) {
92
- while (c$8) {
93
- x$9 + 1;
88
+function foo(a, b, c) {
89
+ const x = 0;
90
+ while (a) {
91
+ while (b) {
92
+ while (c) {
93
+ x + 1;
94
}
95
}
96
}
97
98
- return x$9;
98
+ return x;
99
}
100
101
```
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md
+22
-22
@@ -22,16 +22,16 @@ bb0:
22
[2] If (read b$6) then:bb2 else:bb1 fallthrough=bb1
23
bb2:
24
predecessor blocks: bb0
25
- [3] Let mutate x$10_@0[1:6] = read x$8
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$9 = read c$7
30
- [5] Reassign mutate x$10_@0[1:6] = read x$9
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$10_@0
34
+ [6] read x$0$10_@0
35
[7] Goto bb1
36
bb1:
37
predecessor blocks: bb3 bb0
@@ -48,14 +48,14 @@ function foo(
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$10_@0] {
52
- [3] Let mutate x$10_@0[1:6] = read x$8
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$9 = read c$7
55
- [5] Reassign mutate x$10_@0[1:6] = read x$9
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$10_@0
58
+ [6] read x$0$10_@0
59
}
60
return
61
}
@@ -65,28 +65,28 @@ function foo(
65
## Code
66
67
```javascript
68
-function foo$0(a$5, b$6, c$7) {
68
+function foo(a, b, c) {
69
const $ = React.useMemoCache();
70
- const x$8 = a$5;
71
- if (b$6) {
72
- const c_0 = $[0] !== c$7;
73
- let x$10;
70
+ const x = a;
71
+ if (b) {
72
+ const c_0 = $[0] !== c;
73
+ let x$0;
74
75
if (c_0) {
76
- x$10 = x$8;
76
+ x$0 = x;
77
78
- if (c$7) {
79
- const x$9 = c$7;
80
- x$10 = x$9;
78
+ if (c) {
79
+ const x$1 = c;
80
+ x$0 = x$1;
81
}
82
83
- $[0] = c$7;
84
- $[1] = x$10;
83
+ $[0] = c;
84
+ $[1] = x$0;
85
} else {
86
- x$10 = $[1];
86
+ x$0 = $[1];
87
}
88
89
- x$10;
89
+ x$0;
90
}
91
}
92
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md
+34
-34
@@ -21,24 +21,24 @@ function foo(a, b, c, d, e) {
21
```
22
bb0:
23
[1] Const mutate x$12:TPrimitive = null
24
- [2] Let mutate x$15_@0[1:8] = read x$12:TPrimitive
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$13 = read b$8
29
- [4] Reassign mutate x$15_@0[1:8] = read x$13
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$14 = read d$10
37
- [7] Reassign mutate x$15_@0[1:8] = read x$14
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$15_@0
41
+ [8] Return read x$0$15_@0
42
```
43
44
## Reactive Scopes
@@ -52,19 +52,19 @@ function foo(
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$15_@0] {
56
- [2] Let mutate x$15_@0[1:8] = read x$12:TPrimitive
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$13 = read b$8
59
- [4] Reassign mutate x$15_@0[1:8] = read x$13
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$14 = read d$10
63
- [7] Reassign mutate x$15_@0[1:8] = read x$14
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$15_@0
67
+ return read x$0$15_@0
68
}
69
70
```
@@ -72,37 +72,37 @@ function foo(
72
## Code
73
74
```javascript
75
-function foo$0(a$7, b$8, c$9, d$10, e$11) {
75
+function foo(a, b, c, d, e) {
76
const $ = React.useMemoCache();
77
- const x$12 = null;
78
- const c_0 = $[0] !== a$7;
79
- const c_1 = $[1] !== b$8;
80
- const c_2 = $[2] !== c$9;
81
- const c_3 = $[3] !== d$10;
82
- let x$15;
77
+ const x = null;
78
+ const c_0 = $[0] !== a;
79
+ const c_1 = $[1] !== b;
80
+ const c_2 = $[2] !== c;
81
+ const c_3 = $[3] !== d;
82
+ let x$0;
83
if (c_0 || c_1 || c_2 || c_3) {
84
- x$15 = x$12;
84
+ x$0 = x;
85
86
- if (a$7) {
87
- const x$13 = b$8;
88
- x$15 = x$13;
86
+ if (a) {
87
+ const x$1 = b;
88
+ x$0 = x$1;
89
} else {
90
- if (c$9) {
91
- const x$14 = d$10;
92
- x$15 = x$14;
90
+ if (c) {
91
+ const x$2 = d;
92
+ x$0 = x$2;
93
}
94
}
95
96
- $[0] = a$7;
97
- $[1] = b$8;
98
- $[2] = c$9;
99
- $[3] = d$10;
100
- $[4] = x$15;
96
+ $[0] = a;
97
+ $[1] = b;
98
+ $[2] = c;
99
+ $[3] = d;
100
+ $[4] = x$0;
101
} else {
102
- x$15 = $[4];
102
+ x$0 = $[4];
103
}
104
105
- return x$15;
105
+ return x$0;
106
}
107
108
```
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
+9
-9
@@ -33,7 +33,7 @@ function Foo(
33
## Code
34
35
```javascript
36
-function Foo$0() {}
36
+function Foo() {}
37
38
```
39
## HIR
@@ -65,19 +65,19 @@ function Component(
65
## Code
66
67
```javascript
68
-function Component$0(props$6) {
68
+function Component(props) {
69
const $ = React.useMemoCache();
70
- let c$9;
70
+ let c;
71
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
72
- const a$7 = [];
73
- const b$8 = {};
74
- c$9 = new Foo$4(a$7, b$8);
75
- $[0] = c$9;
72
+ const a = [];
73
+ const b = {};
74
+ c = new Foo(a, b);
75
+ $[0] = c;
76
} else {
77
- c$9 = $[0];
77
+ c = $[0];
78
}
79
80
- return c$9;
80
+ return c;
81
}
82
83
```
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
+40
-40
@@ -26,22 +26,22 @@ bb0:
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$12_@0[1:10] = read x$6:TPrimitive
30
- [5] Let mutate y$13_@0[1:10] = read y$7: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$10:TPrimitive = 2
35
- [7] Reassign mutate x$12_@0[1:10] = read x$10:TPrimitive
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$11:TPrimitive = 3
40
- [9] Reassign mutate y$13_@0[1:10] = read y$11:TPrimitive
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$12_@0, y: read y$13_@0 }
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
@@ -54,19 +54,19 @@ function foo(
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$12_@0] {
58
- [5] Let mutate x$12_@0[1:10] = read x$6:TPrimitive
59
- [5] Let mutate y$13_@0[1:10] = read y$7: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$10:TPrimitive = 2
62
- [7] Reassign mutate x$12_@0[1:10] = read x$10: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$11:TPrimitive = 3
65
- [9] Reassign mutate y$13_@0[1:10] = read y$11:TPrimitive
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$12_@0, read y$13_@0] out=[t$14_@2] {
69
- [10] Const mutate t$14_@2:TObject = Object { x: read x$12_@0, y: read y$13_@0 }
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
}
@@ -76,45 +76,45 @@ function foo(
76
## Code
77
78
```javascript
79
-function foo$0() {
79
+function foo() {
80
const $ = React.useMemoCache();
81
- const x$6 = 1;
82
- const y$7 = 2;
83
- let x$12;
81
+ const x = 1;
82
+ const y = 2;
83
+ let x$0;
84
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
85
- x$12 = x$6;
86
- let y$13 = y$7;
85
+ x$0 = x;
86
+ let y$1 = y;
87
88
- if (x$6 > 1) {
89
- const x$10 = 2;
90
- x$12 = x$10;
88
+ if (x > 1) {
89
+ const x$2 = 2;
90
+ x$0 = x$2;
91
} else {
92
- const y$11 = 3;
93
- y$13 = y$11;
92
+ const y$3 = 3;
93
+ y$1 = y$3;
94
}
95
96
- $[0] = x$12;
96
+ $[0] = x$0;
97
} else {
98
- x$12 = $[0];
98
+ x$0 = $[0];
99
}
100
101
- const c_1 = $[1] !== x$12;
102
- const c_2 = $[2] !== y$13;
103
- let t$14;
101
+ const c_1 = $[1] !== x$0;
102
+ const c_2 = $[2] !== y$1;
103
+ let t;
104
105
if (c_1 || c_2) {
106
- t$14 = {
107
- x: x$12,
108
- y: y$13,
106
+ t = {
107
+ x: x$0,
108
+ y: y$1,
109
};
110
- $[1] = x$12;
111
- $[2] = y$13;
112
- $[3] = t$14;
110
+ $[1] = x$0;
111
+ $[2] = y$1;
112
+ $[3] = t;
113
} else {
114
- t$14 = $[3];
114
+ t = $[3];
115
}
116
117
- return t$14;
117
+ return t;
118
}
119
120
```
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
+10
-10
@@ -40,22 +40,22 @@ function Component(
40
## Code
41
42
```javascript
43
-function Component$0(props$5) {
43
+function Component(props) {
44
const $ = React.useMemoCache();
45
- const a$6 = 1;
46
- const b$7 = 2;
47
- let x$8;
45
+ const a = 1;
46
+ const b = 2;
47
+ let x;
48
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
49
- x$8 = {
50
- a: a$6,
51
- b: b$7,
49
+ x = {
50
+ a: a,
51
+ b: b,
52
};
53
- $[0] = x$8;
53
+ $[0] = x;
54
} else {
55
- x$8 = $[0];
55
+ x = $[0];
56
}
57
58
- return x$8;
58
+ return x;
59
}
60
61
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md
+15
-15
@@ -67,30 +67,30 @@ function foo(
67
## Code
68
69
```javascript
70
-function foo$0(a$7) {
70
+function foo(a) {
71
const $ = React.useMemoCache();
72
- const c_0 = $[0] !== a$7;
73
- let x$9;
72
+ const c_0 = $[0] !== a;
73
+ let x;
74
if (c_0) {
75
- const b$8 = {};
76
- x$9 = b$8;
75
+ const b = {};
76
+ x = b;
77
78
- if (a$7) {
79
- const y$10 = {};
80
- x$9.y = y$10;
78
+ if (a) {
79
+ const y = {};
80
+ x.y = y;
81
} else {
82
- const z$11 = {};
83
- x$9.z = z$11;
82
+ const z = {};
83
+ x.z = z;
84
}
85
86
- mutate$6(b$8);
87
- $[0] = a$7;
88
- $[1] = x$9;
86
+ mutate(b);
87
+ $[0] = a;
88
+ $[1] = x;
89
} else {
90
- x$9 = $[1];
90
+ x = $[1];
91
}
92
93
- return x$9;
93
+ return x;
94
}
95
96
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md
+19
-19
@@ -65,44 +65,44 @@ function foo(
65
## Code
66
67
```javascript
68
-function foo$0(a$5) {
68
+function foo(a) {
69
const $ = React.useMemoCache();
70
- const c_0 = $[0] !== a$5;
71
- let x$6;
70
+ const c_0 = $[0] !== a;
71
+ let x;
72
if (c_0) {
73
- x$6 = {};
73
+ x = {};
74
75
- if (a$5) {
76
- let y$7;
75
+ if (a) {
76
+ let y;
77
78
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
79
- y$7 = {};
80
- $[2] = y$7;
79
+ y = {};
80
+ $[2] = y;
81
} else {
82
- y$7 = $[2];
82
+ y = $[2];
83
}
84
85
- x$6.y = y$7;
85
+ x.y = y;
86
} else {
87
- let z$8;
87
+ let z;
88
89
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
90
- z$8 = {};
91
- $[3] = z$8;
90
+ z = {};
91
+ $[3] = z;
92
} else {
93
- z$8 = $[3];
93
+ z = $[3];
94
}
95
96
- x$6.z = z$8;
96
+ x.z = z;
97
}
98
99
- $[0] = a$5;
100
- $[1] = x$6;
99
+ $[0] = a;
100
+ $[1] = x;
101
} else {
102
- x$6 = $[1];
102
+ x = $[1];
103
}
104
105
- return x$6;
105
+ return x;
106
}
107
108
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md
+14
-14
@@ -64,29 +64,29 @@ function foo(
64
## Code
65
66
```javascript
67
-function foo$0(a$6) {
67
+function foo(a) {
68
const $ = React.useMemoCache();
69
- const c_0 = $[0] !== a$6;
70
- let x$7;
69
+ const c_0 = $[0] !== a;
70
+ let x;
71
if (c_0) {
72
- x$7 = {};
72
+ x = {};
73
74
- if (a$6) {
75
- const y$8 = {};
76
- x$7.y = y$8;
74
+ if (a) {
75
+ const y = {};
76
+ x.y = y;
77
} else {
78
- const z$9 = {};
79
- x$7.z = z$9;
78
+ const z = {};
79
+ x.z = z;
80
}
81
82
- mutate$5(x$7);
83
- $[0] = a$6;
84
- $[1] = x$7;
82
+ mutate(x);
83
+ $[0] = a;
84
+ $[1] = x;
85
} else {
86
- x$7 = $[1];
86
+ x = $[1];
87
}
88
89
- return x$7;
89
+ return x;
90
}
91
92
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md
+17
-17
@@ -66,37 +66,37 @@ function foo(
66
## Code
67
68
```javascript
69
-function foo$0(a$6) {
69
+function foo(a) {
70
const $ = React.useMemoCache();
71
- const c_0 = $[0] !== a$6;
72
- let x$7;
71
+ const c_0 = $[0] !== a;
72
+ let x;
73
if (c_0) {
74
- x$7 = {};
74
+ x = {};
75
76
- if (a$6) {
77
- const y$8 = {};
78
- x$7.y = y$8;
79
- mutate$4(y$8);
76
+ if (a) {
77
+ const y = {};
78
+ x.y = y;
79
+ mutate(y);
80
} else {
81
- let z$9;
81
+ let z;
82
83
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
84
- z$9 = {};
85
- $[2] = z$9;
84
+ z = {};
85
+ $[2] = z;
86
} else {
87
- z$9 = $[2];
87
+ z = $[2];
88
}
89
90
- x$7.z = z$9;
90
+ x.z = z;
91
}
92
93
- $[0] = a$6;
94
- $[1] = x$7;
93
+ $[0] = a;
94
+ $[1] = x;
95
} else {
96
- x$7 = $[1];
96
+ x = $[1];
97
}
98
99
- return x$7;
99
+ return x;
100
}
101
102
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md
+10
-10
@@ -47,21 +47,21 @@ function foo(
47
## Code
48
49
```javascript
50
-function foo$0() {
50
+function foo() {
51
const $ = React.useMemoCache();
52
- let y$7;
52
+ let y;
53
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
54
- const a$5 = {};
55
- const x$6 = a$5;
56
- y$7 = {};
57
- y$7.x = x$6;
58
- mutate$4(a$5);
59
- $[0] = y$7;
54
+ const a = {};
55
+ const x = a;
56
+ y = {};
57
+ y.x = x;
58
+ mutate(a);
59
+ $[0] = y;
60
} else {
61
- y$7 = $[0];
61
+ y = $[0];
62
}
63
64
- return y$7;
64
+ return y;
65
}
66
67
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
+14
-14
@@ -43,31 +43,31 @@ function foo(
43
## Code
44
45
```javascript
46
-function foo$0() {
46
+function foo() {
47
const $ = React.useMemoCache();
48
- let x$4;
48
+ let x;
49
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
50
- x$4 = [];
51
- $[0] = x$4;
50
+ x = [];
51
+ $[0] = x;
52
} else {
53
- x$4 = $[0];
53
+ x = $[0];
54
}
55
56
- const c_1 = $[1] !== x$4;
57
- let y$5;
56
+ const c_1 = $[1] !== x;
57
+ let y;
58
59
if (c_1) {
60
- y$5 = {
61
- x: x$4,
60
+ y = {
61
+ x: x,
62
};
63
- y$5.x.push([]);
64
- $[1] = x$4;
65
- $[2] = y$5;
63
+ y.x.push([]);
64
+ $[1] = x;
65
+ $[2] = y;
66
} else {
67
- y$5 = $[2];
67
+ y = $[2];
68
}
69
70
- return y$5;
70
+ return y;
71
}
72
73
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md
+9
-9
@@ -42,20 +42,20 @@ function foo(
42
## Code
43
44
```javascript
45
-function foo$0() {
45
+function foo() {
46
const $ = React.useMemoCache();
47
- let y$5;
47
+ let y;
48
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
49
- const x$4 = [];
50
- y$5 = {};
51
- y$5.x = x$4;
52
- mutate$3(x$4);
53
- $[0] = y$5;
49
+ const x = [];
50
+ y = {};
51
+ y.x = x;
52
+ mutate(x);
53
+ $[0] = y;
54
} else {
55
- y$5 = $[0];
55
+ y = $[0];
56
}
57
58
- return y$5;
58
+ return y;
59
}
60
61
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md
+10
-10
@@ -47,21 +47,21 @@ function foo(
47
## Code
48
49
```javascript
50
-function foo$0() {
50
+function foo() {
51
const $ = React.useMemoCache();
52
- let y$6;
52
+ let y;
53
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
54
- const a$5 = {};
55
- y$6 = a$5;
56
- const x$7 = [];
57
- y$6.x = x$7;
58
- mutate$4(a$5);
59
- $[0] = y$6;
54
+ const a = {};
55
+ y = a;
56
+ const x = [];
57
+ y.x = x;
58
+ mutate(a);
59
+ $[0] = y;
60
} else {
61
- y$6 = $[0];
61
+ y = $[0];
62
}
63
64
- return y$6;
64
+ return y;
65
}
66
67
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md
+9
-9
@@ -42,20 +42,20 @@ function foo(
42
## Code
43
44
```javascript
45
-function foo$0() {
45
+function foo() {
46
const $ = React.useMemoCache();
47
- let y$5;
47
+ let y;
48
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
49
- const x$4 = [];
50
- y$5 = {};
51
- y$5.x = x$4;
52
- mutate$3(y$5);
53
- $[0] = y$5;
49
+ const x = [];
50
+ y = {};
51
+ y.x = x;
52
+ mutate(y);
53
+ $[0] = y;
54
} else {
55
- y$5 = $[0];
55
+ y = $[0];
56
}
57
58
- return y$5;
58
+ return y;
59
}
60
61
```
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
+13
-13
@@ -41,29 +41,29 @@ function foo(
41
## Code
42
43
```javascript
44
-function foo$0() {
44
+function foo() {
45
const $ = React.useMemoCache();
46
- let x$3;
46
+ let x;
47
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48
- x$3 = [];
49
- $[0] = x$3;
48
+ x = [];
49
+ $[0] = x;
50
} else {
51
- x$3 = $[0];
51
+ x = $[0];
52
}
53
54
- const c_1 = $[1] !== x$3;
55
- let y$4;
54
+ const c_1 = $[1] !== x;
55
+ let y;
56
57
if (c_1) {
58
- y$4 = {};
59
- y$4.x = x$3;
60
- $[1] = x$3;
61
- $[2] = y$4;
58
+ y = {};
59
+ y.x = x;
60
+ $[1] = x;
61
+ $[2] = y;
62
} else {
63
- y$4 = $[2];
63
+ y = $[2];
64
}
65
66
- return y$4;
66
+ return y;
67
}
68
69
```
compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md
+14
-14
@@ -17,10 +17,10 @@ function foo(a, b, c) {
17
```
18
bb0:
19
[1] Const mutate x$8:TPrimitive = 0
20
- [2] Const mutate x$9 = read a$5
21
- [3] Const mutate x$10 = read b$6
22
- [4] Const mutate x$11 = read c$7
23
- [5] Return read x$11
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
@@ -32,10 +32,10 @@ function foo(
32
c,
33
) {
34
[1] Const mutate x$8:TPrimitive = 0
35
- [2] Const mutate x$9 = read a$5
36
- [3] Const mutate x$10 = read b$6
37
- [4] Const mutate x$11 = read c$7
38
- return read x$11
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
```
@@ -43,12 +43,12 @@ function foo(
43
## Code
44
45
```javascript
46
-function foo$0(a$5, b$6, c$7) {
47
- const x$8 = 0;
48
- const x$9 = a$5;
49
- const x$10 = b$6;
50
- const x$11 = c$7;
51
- return x$11;
46
+function foo(a, b, c) {
47
+ const x = 0;
48
+ const x$0 = a;
49
+ const x$1 = b;
50
+ const x$2 = c;
51
+ return x$2;
52
}
53
54
```
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
+19
-19
@@ -20,16 +20,16 @@ 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$8_@0[1:7] = read x$4: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$7:TPrimitive = 2
28
- [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive
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$8_@0
32
+ [7] Return read x$0$8_@0
33
```
34
35
## Reactive Scopes
@@ -40,14 +40,14 @@ function foo(
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$8_@0] {
44
- [4] Let mutate x$8_@0[1:7] = read x$4: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$7:TPrimitive = 2
47
- [6] Reassign mutate x$8_@0[1:7] = read x$7: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$8_@0
50
+ return read x$0$8_@0
51
}
52
53
```
@@ -55,24 +55,24 @@ function foo(
55
## Code
56
57
```javascript
58
-function foo$0() {
58
+function foo() {
59
const $ = React.useMemoCache();
60
- const x$4 = 1;
61
- let x$8;
60
+ const x = 1;
61
+ let x$0;
62
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
63
- x$8 = x$4;
63
+ x$0 = x;
64
65
- if (x$4 === 1) {
66
- const x$7 = 2;
67
- x$8 = x$7;
65
+ if (x === 1) {
66
+ const x$1 = 2;
67
+ x$0 = x$1;
68
}
69
70
- $[0] = x$8;
70
+ $[0] = x$0;
71
} else {
72
- x$8 = $[0];
72
+ x$0 = $[0];
73
}
74
75
- return x$8;
75
+ return x$0;
76
}
77
78
```
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
+28
-28
@@ -37,7 +37,7 @@ function log(
37
## Code
38
39
```javascript
40
-function log$0() {}
40
+function log() {}
41
42
```
43
## HIR
@@ -45,21 +45,21 @@ function log$0() {}
45
```
46
bb0:
47
[1] Const mutate str$6:TPrimitive = ""
48
- [2] Let mutate str$10_@0[1:8] = read 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$7:TPrimitive = "other test"
53
- [4] Call mutate log$4:TFunction(read str$7:TPrimitive)
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$8:TPrimitive = "fallthrough test"
58
- [7] Reassign mutate str$10_@0[1:8] = read str$8:TPrimitive
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$10_@0)
62
+ [8] Call mutate log$4:TFunction(read str$0$10_@0)
63
[9] Return
64
```
65
@@ -70,17 +70,17 @@ function Foo(
70
cond,
71
) {
72
[1] Const mutate str$6:TPrimitive = ""
73
- scope @0 [1:8] deps=[read cond$5] out=[str$10_@0] {
74
- [2] Let mutate str$10_@0[1:8] = read 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$7:TPrimitive = "other test"
77
- [4] Call mutate log$4:TFunction(read str$7:TPrimitive)
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$8:TPrimitive = "fallthrough test"
80
- [7] Reassign mutate str$10_@0[1:8] = read str$8:TPrimitive
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$10_@0)
83
+ [8] Call mutate log$4:TFunction(read str$0$10_@0)
84
return
85
}
86
@@ -89,29 +89,29 @@ function Foo(
89
## Code
90
91
```javascript
92
-function Foo$0(cond$5) {
92
+function Foo(cond) {
93
const $ = React.useMemoCache();
94
- const str$6 = "";
95
- const c_0 = $[0] !== cond$5;
96
- let str$10;
94
+ const str = "";
95
+ const c_0 = $[0] !== cond;
96
+ let str$0;
97
if (c_0) {
98
- str$10 = str$6;
98
+ str$0 = str;
99
100
- if (cond$5) {
101
- const str$7 = "other test";
102
- log$4(str$7);
100
+ if (cond) {
101
+ const str$1 = "other test";
102
+ log(str$1);
103
} else {
104
- const str$8 = "fallthrough test";
105
- str$10 = str$8;
104
+ const str$2 = "fallthrough test";
105
+ str$0 = str$2;
106
}
107
108
- $[0] = cond$5;
109
- $[1] = str$10;
108
+ $[0] = cond;
109
+ $[1] = str$0;
110
} else {
111
- str$10 = $[1];
111
+ str$0 = $[1];
112
}
113
114
- log$4(str$10);
114
+ log(str$0);
115
}
116
117
```
compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md
+54
-54
@@ -34,40 +34,40 @@ bb0:
34
bb2:
35
predecessor blocks: bb0
36
[4] Const mutate $15:TPrimitive = true
37
- [5] Let mutate x$18_@0[5:10] = undefined
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$16 = read a$9
42
- [7] Reassign mutate x$18_@0[5:10] = read x$16
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$17 = read b$10
47
- [9] Reassign mutate x$18_@0[5:10] = read x$17
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$18_@0
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$22_@1[13:18] = undefined
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$20 = read c$11
61
- [15] Reassign mutate x$22_@1[13:18] = read x$20
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$21 = read d$12
66
- [17] Reassign mutate x$22_@1[13:18] = read x$21
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$22_@1
70
+ [18] read x$3$22_@1
71
[19] Goto bb1
72
bb1:
73
predecessor blocks: bb3 bb7
@@ -87,30 +87,30 @@ function foo(
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$18_@0] {
91
- [5] Let mutate x$18_@0[5:10] = undefined
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$16 = read a$9
94
- [7] Reassign mutate x$18_@0[5:10] = read x$16
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$17 = read b$10
97
- [9] Reassign mutate x$18_@0[5:10] = read x$17
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$18_@0
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$22_@1] {
104
- [13] Let mutate x$22_@1[13:18] = undefined
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$20 = read c$11
107
- [15] Reassign mutate x$22_@1[13:18] = read x$20
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$21 = read d$12
110
- [17] Reassign mutate x$22_@1[13:18] = read x$21
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$22_@1
113
+ [18] read x$3$22_@1
114
}
115
return
116
}
@@ -120,57 +120,57 @@ function foo(
120
## Code
121
122
```javascript
123
-function foo$0(a$9, b$10, c$11, d$12) {
123
+function foo(a, b, c, d) {
124
const $ = React.useMemoCache();
125
- const x$13 = 0;
125
+ const x = 0;
126
if (true) {
127
- const c_0 = $[0] !== a$9;
128
- const c_1 = $[1] !== b$10;
129
- let x$18;
127
+ const c_0 = $[0] !== a;
128
+ const c_1 = $[1] !== b;
129
+ let x$0;
130
131
if (c_0 || c_1) {
132
- x$18 = undefined;
132
+ x$0 = undefined;
133
134
if (true) {
135
- const x$16 = a$9;
136
- x$18 = x$16;
135
+ const x$1 = a;
136
+ x$0 = x$1;
137
} else {
138
- const x$17 = b$10;
139
- x$18 = x$17;
138
+ const x$2 = b;
139
+ x$0 = x$2;
140
}
141
142
- $[0] = a$9;
143
- $[1] = b$10;
144
- $[2] = x$18;
142
+ $[0] = a;
143
+ $[1] = b;
144
+ $[2] = x$0;
145
} else {
146
- x$18 = $[2];
146
+ x$0 = $[2];
147
}
148
149
- x$18;
149
+ x$0;
150
} else {
151
- const c_3 = $[3] !== c$11;
152
- const c_4 = $[4] !== d$12;
153
- let x$22;
151
+ const c_3 = $[3] !== c;
152
+ const c_4 = $[4] !== d;
153
+ let x$3;
154
155
if (c_3 || c_4) {
156
- x$22 = undefined;
156
+ x$3 = undefined;
157
158
if (true) {
159
- const x$20 = c$11;
160
- x$22 = x$20;
159
+ const x$4 = c;
160
+ x$3 = x$4;
161
} else {
162
- const x$21 = d$12;
163
- x$22 = x$21;
162
+ const x$5 = d;
163
+ x$3 = x$5;
164
}
165
166
- $[3] = c$11;
167
- $[4] = d$12;
168
- $[5] = x$22;
166
+ $[3] = c;
167
+ $[4] = d;
168
+ $[5] = x$3;
169
} else {
170
- x$22 = $[5];
170
+ x$3 = $[5];
171
}
172
173
- x$22;
173
+ x$3;
174
}
175
}
176
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
+25
-25
@@ -23,21 +23,21 @@ 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$10_@0[4:9] = undefined
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$8:TPrimitive = 1
31
- [6] Reassign mutate y$10_@0[4:9] = read y$8:TPrimitive
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$9:TPrimitive = 2
36
- [8] Reassign mutate y$10_@0[4:9] = read y$9:TPrimitive
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$10_@0
40
+ [9] Const mutate x$11 = read y$0$10_@0
41
[10] Return
42
```
43
@@ -49,17 +49,17 @@ function foo(
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$10_@0] {
53
- [4] Let mutate y$10_@0[4:9] = undefined
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$8:TPrimitive = 1
56
- [6] Reassign mutate y$10_@0[4:9] = read y$8: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$9:TPrimitive = 2
59
- [8] Reassign mutate y$10_@0[4:9] = read y$9:TPrimitive
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$10_@0
62
+ [9] Const mutate x$11 = read y$0$10_@0
63
return
64
}
65
@@ -68,27 +68,27 @@ function foo(
68
## Code
69
70
```javascript
71
-function foo$0() {
71
+function foo() {
72
const $ = React.useMemoCache();
73
- const y$5 = 2;
74
- let y$10;
73
+ const y = 2;
74
+ let y$0;
75
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
76
- y$10 = undefined;
76
+ y$0 = undefined;
77
78
- if (y$5 > 1) {
79
- const y$8 = 1;
80
- y$10 = y$8;
78
+ if (y > 1) {
79
+ const y$1 = 1;
80
+ y$0 = y$1;
81
} else {
82
- const y$9 = 2;
83
- y$10 = y$9;
82
+ const y$2 = 2;
83
+ y$0 = y$2;
84
}
85
86
- $[0] = y$10;
86
+ $[0] = y$0;
87
} else {
88
- y$10 = $[0];
88
+ y$0 = $[0];
89
}
90
91
- const x$11 = y$10;
91
+ const x = y$0;
92
}
93
94
```
compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md
+3
-3
@@ -33,9 +33,9 @@ function foo(
33
## Code
34
35
```javascript
36
-function foo$0() {
37
- const x$3 = 1;
38
- const y$4 = 2;
36
+function foo() {
37
+ const x = 1;
38
+ const y = 2;
39
}
40
41
```
compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md
+5
-5
@@ -47,11 +47,11 @@ function foo(
47
## Code
48
49
```javascript
50
-function foo$0() {
51
- const x$4 = 1;
52
- const y$5 = 2;
53
- if (y$5) {
54
- const z$6 = x$4 + y$5;
50
+function foo() {
51
+ const x = 1;
52
+ const y = 2;
53
+ if (y) {
54
+ const z = x + y;
55
}
56
}
57
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
+33
-33
@@ -33,7 +33,7 @@ bb0:
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$21_@0[6:16] = undefined
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
@@ -42,24 +42,24 @@ bb0:
42
bb5:
43
predecessor blocks: bb0
44
[7] Const mutate $15:TPrimitive = 1
45
- [8] Const mutate x$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive
46
- [9] Reassign mutate x$21_@0[6:16] = read x$16:TPrimitive
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$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive
52
- [12] Reassign mutate x$21_@0[6:16] = read x$18:TPrimitive
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$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive
58
- [15] Reassign mutate x$21_@0[6:16] = read x$20:TPrimitive
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$21_@0
62
+ [16] Const mutate y$22 = read x$0$21_@0
63
[17] Return
64
```
65
@@ -73,29 +73,29 @@ function foo(
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$21_@0] {
77
- [6] Let mutate x$21_@0[6:16] = undefined
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$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive
82
- [9] Reassign mutate x$21_@0[6:16] = read x$16:TPrimitive
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$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive
88
- [12] Reassign mutate x$21_@0[6:16] = read x$18:TPrimitive
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$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive
94
- [15] Reassign mutate x$21_@0[6:16] = read x$20:TPrimitive
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$21_@0
98
+ [16] Const mutate y$22 = read x$0$21_@0
99
return
100
}
101
@@ -104,38 +104,38 @@ function foo(
104
## Code
105
106
```javascript
107
-function foo$0() {
107
+function foo() {
108
const $ = React.useMemoCache();
109
- const x$10 = 1;
110
- let x$21;
109
+ const x = 1;
110
+ let x$0;
111
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
112
- x$21 = undefined;
112
+ x$0 = undefined;
113
114
- bb1: switch (x$10) {
115
- case x$10 === 1: {
116
- const x$16 = x$10 + 1;
117
- x$21 = x$16;
114
+ bb1: switch (x) {
115
+ case x === 1: {
116
+ const x$1 = x + 1;
117
+ x$0 = x$1;
118
break bb1;
119
}
120
121
- case x$10 === 2: {
122
- const x$18 = x$10 + 2;
123
- x$21 = x$18;
121
+ case x === 2: {
122
+ const x$2 = x + 2;
123
+ x$0 = x$2;
124
break bb1;
125
}
126
127
default: {
128
- const x$20 = x$10 + 3;
129
- x$21 = x$20;
128
+ const x$3 = x + 3;
129
+ x$0 = x$3;
130
}
131
}
132
133
- $[0] = x$21;
133
+ $[0] = x$0;
134
} else {
135
- x$21 = $[0];
135
+ x$0 = $[0];
136
}
137
138
- const y$22 = x$21;
138
+ const y = x$0;
139
}
140
141
```
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
+19
-19
@@ -19,16 +19,16 @@ 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$8_@0[1:7] = read x$4: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$7:TPrimitive = 2
27
- [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive
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$8_@0
31
+ [7] Throw read x$0$8_@0
32
```
33
34
## Reactive Scopes
@@ -39,14 +39,14 @@ function foo(
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$8_@0] {
43
- [4] Let mutate x$8_@0[1:7] = read x$4: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$7:TPrimitive = 2
46
- [6] Reassign mutate x$8_@0[1:7] = read x$7: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$8_@0
49
+ throw read x$0$8_@0
50
}
51
52
```
@@ -54,24 +54,24 @@ function foo(
54
## Code
55
56
```javascript
57
-function foo$0() {
57
+function foo() {
58
const $ = React.useMemoCache();
59
- const x$4 = 1;
60
- let x$8;
59
+ const x = 1;
60
+ let x$0;
61
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
62
- x$8 = x$4;
62
+ x$0 = x;
63
64
- if (x$4 === 1) {
65
- const x$7 = 2;
66
- x$8 = x$7;
64
+ if (x === 1) {
65
+ const x$1 = 2;
66
+ x$0 = x$1;
67
}
68
69
- $[0] = x$8;
69
+ $[0] = x$0;
70
} else {
71
- x$8 = $[0];
71
+ x$0 = $[0];
72
}
73
74
- throw x$8;
74
+ throw x$0;
75
}
76
77
```
compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md
+5
-5
@@ -56,13 +56,13 @@ function foo(
56
## Code
57
58
```javascript
59
-function foo$0() {
60
- const x$5 = 1;
61
- while (x$5 < 10) {
62
- x$5 + 1;
59
+function foo() {
60
+ const x = 1;
61
+ while (x < 10) {
62
+ x + 1;
63
}
64
65
- return x$5;
65
+ return x;
66
}
67
68
```
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
+8
-8
@@ -58,22 +58,22 @@ function foo(
58
## Code
59
60
```javascript
61
-function foo$0() {
61
+function foo() {
62
const $ = React.useMemoCache();
63
- let x$5;
63
+ let x;
64
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
65
- x$5 = 1;
65
+ x = 1;
66
67
- while (x$5 < 10) {
68
- x$5 = x$5 + 1;
67
+ while (x < 10) {
68
+ x = x + 1;
69
}
70
71
- $[0] = x$5;
71
+ $[0] = x;
72
} else {
73
- x$5 = $[0];
73
+ x = $[0];
74
}
75
76
- return x$5;
76
+ return x;
77
}
78
79
```
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+52
-52
@@ -37,7 +37,7 @@ bb0:
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$20_@1[1:12] = read y$11:TPrimitive
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
@@ -47,19 +47,19 @@ bb0:
47
bb6:
48
predecessor blocks: bb0
49
[7] Call mutate x$10_@1.push(read props$9.p2)
50
- [8] Const mutate y$15_@2 = Array []
51
- [9] Reassign mutate y$20_@1[1:12] = read y$15_@2
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$16 = read x$10_@1
56
- [11] Reassign mutate y$20_@1[1:12] = read y$16
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$20_@1.push(read props$9.p4)
62
- [14] Const mutate t8$22_@4 = JSX <read Component$0 data={freeze y$20_@1} >{read child$19_@3}</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
@@ -75,34 +75,34 @@ function Component(
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$20_@1[1:12] = read y$11:TPrimitive
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$15_@2] {
86
- [8] Const mutate y$15_@2 = Array []
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$20_@1[1:12] = read y$15_@2
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$16 = read x$10_@1
96
- [11] Reassign mutate y$20_@1[1:12] = read y$16
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$20_@1.push(read props$9.p4)
104
- scope @4 [14:15] deps=[freeze y$20_@1, read child$19_@3] out=[$22_@4] {
105
- [14] Const mutate $22_@4 = JSX <read Component$0 data={freeze y$20_@1} >{read child$19_@3}</read Component$0>
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
}
@@ -112,33 +112,33 @@ function Component(
112
## Code
113
114
```javascript
115
-function Component$0(props$9) {
115
+function Component(props) {
116
const $ = React.useMemoCache();
117
- const c_0 = $[0] !== props$9.p0;
118
- const c_1 = $[1] !== props$9.p2;
119
- let x$10;
117
+ const c_0 = $[0] !== props.p0;
118
+ const c_1 = $[1] !== props.p2;
119
+ let x;
120
if (c_0 || c_1) {
121
- x$10 = [];
122
- const y$11 = undefined;
123
- let y$20 = y$11;
121
+ x = [];
122
+ const y = undefined;
123
+ let y$0 = y;
124
125
- bb1: switch (props$9.p0) {
125
+ bb1: switch (props.p0) {
126
case 1: {
127
break bb1;
128
}
129
130
case true: {
131
- x$10.push(props$9.p2);
132
- let y$15;
131
+ x.push(props.p2);
132
+ let y$1;
133
134
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
135
- y$15 = [];
136
- $[3] = y$15;
135
+ y$1 = [];
136
+ $[3] = y$1;
137
} else {
138
- y$15 = $[3];
138
+ y$1 = $[3];
139
}
140
141
- y$20 = y$15;
141
+ y$0 = y$1;
142
break bb1;
143
}
144
@@ -147,44 +147,44 @@ function Component$0(props$9) {
147
}
148
149
case false: {
150
- const y$16 = x$10;
151
- y$20 = y$16;
150
+ const y$2 = x;
151
+ y$0 = y$2;
152
}
153
}
154
155
- $[0] = props$9.p0;
156
- $[1] = props$9.p2;
157
- $[2] = x$10;
155
+ $[0] = props.p0;
156
+ $[1] = props.p2;
157
+ $[2] = x;
158
} else {
159
- x$10 = $[2];
159
+ x = $[2];
160
}
161
162
- const c_4 = $[4] !== x$10;
163
- let child$19;
162
+ const c_4 = $[4] !== x;
163
+ let child;
164
165
if (c_4) {
166
- child$19 = <Component$0 data={x$10}></Component$0>;
167
- $[4] = x$10;
168
- $[5] = child$19;
166
+ child = <Component data={x}></Component>;
167
+ $[4] = x;
168
+ $[5] = child;
169
} else {
170
- child$19 = $[5];
170
+ child = $[5];
171
}
172
173
- y$20.push(props$9.p4);
174
- const c_6 = $[6] !== y$20;
175
- const c_7 = $[7] !== child$19;
176
- let t8$22;
173
+ y$0.push(props.p4);
174
+ const c_6 = $[6] !== y$0;
175
+ const c_7 = $[7] !== child;
176
+ let t8;
177
178
if (c_6 || c_7) {
179
- t8$22 = <Component$0 data={y$20}>{child$19}</Component$0>;
180
- $[6] = y$20;
181
- $[7] = child$19;
182
- $[8] = t8$22;
179
+ t8 = <Component data={y$0}>{child}</Component>;
180
+ $[6] = y$0;
181
+ $[7] = child;
182
+ $[8] = t8;
183
} else {
184
- t8$22 = $[8];
184
+ t8 = $[8];
185
}
186
187
- return t8$22;
187
+ return t8;
188
}
189
190
```
compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md
+21
-21
@@ -54,27 +54,27 @@ bb0:
54
Fallthrough: bb1
55
bb10:
56
predecessor blocks: bb0
57
- [9] Const mutate y$17:TPrimitive = 0
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$18:TPrimitive = 1
61
+ [11] Const mutate y$1$18:TPrimitive = 1
62
[12] Goto bb1
63
bb5:
64
predecessor blocks: bb0
65
- [13] Const mutate y$19:TPrimitive = 3
65
+ [13] Const mutate y$2$19:TPrimitive = 3
66
[14] Goto bb1
67
bb4:
68
predecessor blocks: bb0
69
- [15] Const mutate y$20:TPrimitive = 4
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$21:TPrimitive = 5
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$22:TPrimitive = 0
77
+ [19] Const mutate y$5$22:TPrimitive = 0
78
[20] Goto bb1
79
bb1:
80
predecessor blocks: bb9 bb0 bb5 bb2
@@ -96,27 +96,27 @@ function foo(
96
[7] Const mutate $16:TPrimitive = 0
97
switch (read x$9) {
98
case read $16:TPrimitive: {
99
- [9] Const mutate y$17:TPrimitive = 0
99
+ [9] Const mutate y$0$17:TPrimitive = 0
100
}
101
case read $15:TPrimitive: {
102
- [11] Const mutate y$18:TPrimitive = 1
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$19:TPrimitive = 3
109
+ [13] Const mutate y$2$19:TPrimitive = 3
110
break bb1
111
}
112
case read $12:TPrimitive: {
113
- [15] Const mutate y$20:TPrimitive = 4
113
+ [15] Const mutate y$3$20:TPrimitive = 4
114
}
115
case read $11:TPrimitive: {
116
- [17] Const mutate y$21:TPrimitive = 5
116
+ [17] Const mutate y$4$21:TPrimitive = 5
117
}
118
default: {
119
- [19] Const mutate y$22:TPrimitive = 0
119
+ [19] Const mutate y$5$22:TPrimitive = 0
120
}
121
}
122
return
@@ -127,15 +127,15 @@ function foo(
127
## Code
128
129
```javascript
130
-function foo$0(x$9) {
131
- const y$10 = undefined;
132
- bb1: switch (x$9) {
130
+function foo(x) {
131
+ const y = undefined;
132
+ bb1: switch (x) {
133
case 0: {
134
- const y$17 = 0;
134
+ const y$0 = 0;
135
}
136
137
case 1: {
138
- const y$18 = 1;
138
+ const y$1 = 1;
139
break bb1;
140
}
141
@@ -144,20 +144,20 @@ function foo$0(x$9) {
144
}
145
146
case 3: {
147
- const y$19 = 3;
147
+ const y$2 = 3;
148
break bb1;
149
}
150
151
case 4: {
152
- const y$20 = 4;
152
+ const y$3 = 4;
153
}
154
155
case 5: {
156
- const y$21 = 5;
156
+ const y$4 = 5;
157
}
158
159
default: {
160
- const y$22 = 0;
160
+ const y$5 = 0;
161
}
162
}
163
}
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+48
-48
@@ -31,7 +31,7 @@ bb0:
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$20_@1[1:12] = read y$10:TPrimitive
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
@@ -41,18 +41,18 @@ 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$13_@2 = Array []
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$15 = read x$9_@1
49
- [11] Reassign mutate y$20_@1[1:12] = read y$15
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$20_@1.push(read props$8.p4)
55
- [14] Const mutate t8$23_@4 = JSX <read Component$0 data={read y$20_@1} >{read child$19_@3}</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
@@ -67,25 +67,25 @@ function Component(
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$20_@1[1:12] = read y$10:TPrimitive
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$13_@2 = Array []
75
+ [8] Const mutate y$1$13_@2 = Array []
76
}
77
case read $11:TPrimitive: {
78
- [10] Const mutate y$15 = read x$9_@1
79
- [11] Reassign mutate y$20_@1[1:12] = read y$15
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$20_@1.push(read props$8.p4)
87
- scope @4 [14:15] deps=[read y$20_@1, read child$19_@3] out=[$23_@4] {
88
- [14] Const mutate $23_@4 = JSX <read Component$0 data={read y$20_@1} >{read child$19_@3}</read Component$0>
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
}
@@ -95,64 +95,64 @@ function Component(
95
## Code
96
97
```javascript
98
-function Component$0(props$8) {
98
+function Component(props) {
99
const $ = React.useMemoCache();
100
- const c_0 = $[0] !== props$8.p0;
101
- const c_1 = $[1] !== props$8.p2;
102
- const c_2 = $[2] !== props$8.p3;
103
- let x$9;
100
+ const c_0 = $[0] !== props.p0;
101
+ const c_1 = $[1] !== props.p2;
102
+ const c_2 = $[2] !== props.p3;
103
+ let x;
104
if (c_0 || c_1 || c_2) {
105
- x$9 = [];
106
- const y$10 = undefined;
107
- let y$20 = y$10;
105
+ x = [];
106
+ const y = undefined;
107
+ let y$0 = y;
108
109
- switch (props$8.p0) {
109
+ switch (props.p0) {
110
case true: {
111
- x$9.push(props$8.p2);
112
- x$9.push(props$8.p3);
113
- const y$13 = [];
111
+ x.push(props.p2);
112
+ x.push(props.p3);
113
+ const y$1 = [];
114
}
115
116
case false: {
117
- const y$15 = x$9;
118
- y$20 = y$15;
117
+ const y$2 = x;
118
+ y$0 = y$2;
119
}
120
}
121
122
- $[0] = props$8.p0;
123
- $[1] = props$8.p2;
124
- $[2] = props$8.p3;
125
- $[3] = x$9;
122
+ $[0] = props.p0;
123
+ $[1] = props.p2;
124
+ $[2] = props.p3;
125
+ $[3] = x;
126
} else {
127
- x$9 = $[3];
127
+ x = $[3];
128
}
129
130
- const c_4 = $[4] !== x$9;
131
- let child$19;
130
+ const c_4 = $[4] !== x;
131
+ let child;
132
133
if (c_4) {
134
- child$19 = <Component$0 data={x$9}></Component$0>;
135
- $[4] = x$9;
136
- $[5] = child$19;
134
+ child = <Component data={x}></Component>;
135
+ $[4] = x;
136
+ $[5] = child;
137
} else {
138
- child$19 = $[5];
138
+ child = $[5];
139
}
140
141
- y$20.push(props$8.p4);
142
- const c_6 = $[6] !== y$20;
143
- const c_7 = $[7] !== child$19;
144
- let t8$23;
141
+ y$0.push(props.p4);
142
+ const c_6 = $[6] !== y$0;
143
+ const c_7 = $[7] !== child;
144
+ let t8;
145
146
if (c_6 || c_7) {
147
- t8$23 = <Component$0 data={y$20}>{child$19}</Component$0>;
148
- $[6] = y$20;
149
- $[7] = child$19;
150
- $[8] = t8$23;
147
+ t8 = <Component data={y$0}>{child}</Component>;
148
+ $[6] = y$0;
149
+ $[7] = child;
150
+ $[8] = t8;
151
} else {
152
- t8$23 = $[8];
152
+ t8 = $[8];
153
}
154
155
- return t8$23;
155
+ return t8;
156
}
157
158
```
compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md
+9
-9
@@ -53,15 +53,15 @@ function component(
53
## Code
54
55
```javascript
56
-function component$0() {
57
- const x$6 = {};
58
- const p$7 = {};
59
- const q$8 = {};
60
- const y$9 = {};
61
- x$6.y = y$9;
62
- p$7.y = x$6.y;
63
- q$8.y = p$7.y;
64
- mutate$5(q$8);
56
+function component() {
57
+ const x = {};
58
+ const p = {};
59
+ const q = {};
60
+ const y = {};
61
+ x.y = y;
62
+ p.y = x.y;
63
+ q.y = p.y;
64
+ mutate(q);
65
}
66
67
```
compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md
+3
-3
@@ -44,9 +44,9 @@ function component(
44
## Code
45
46
```javascript
47
-function component$0(a$5, b$6) {
48
- if (a$5 > b$6) {
49
- const m$8 = {};
47
+function component(a, b) {
48
+ if (a > b) {
49
+ const m = {};
50
}
51
}
52
compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md
+11
-11
@@ -52,27 +52,27 @@ function component(
52
## Code
53
54
```javascript
55
-function component$0() {
55
+function component() {
56
const $ = React.useMemoCache();
57
- let a$7;
57
+ let a;
58
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
59
- a$7 = some$1();
60
- $[0] = a$7;
59
+ a = some();
60
+ $[0] = a;
61
} else {
62
- a$7 = $[0];
62
+ a = $[0];
63
}
64
65
- let b$8;
65
+ let b;
66
67
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
68
- b$8 = someOther$3();
69
- $[1] = b$8;
68
+ b = someOther();
69
+ $[1] = b;
70
} else {
71
- b$8 = $[1];
71
+ b = $[1];
72
}
73
74
- if (a$7 > b$8) {
75
- const m$10 = {};
74
+ if (a > b) {
75
+ const m = {};
76
}
77
}
78
compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md
+6
-6
@@ -37,19 +37,19 @@ function component(
37
## Code
38
39
```javascript
40
-function component$0() {
40
+function component() {
41
const $ = React.useMemoCache();
42
- let x$5;
42
+ let x;
43
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
44
- x$5 = {
44
+ x = {
45
t: 1,
46
};
47
- $[0] = x$5;
47
+ $[0] = x;
48
} else {
49
- x$5 = $[0];
49
+ x = $[0];
50
}
51
52
- const p$6 = x$5.t;
52
+ const p = x.t;
53
}
54
55
```
compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md
+24
-24
@@ -62,49 +62,49 @@ function component(
62
## Code
63
64
```javascript
65
-function component$0() {
65
+function component() {
66
const $ = React.useMemoCache();
67
- let t0$10;
67
+ let t0;
68
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
69
- t0$10 = makeSomePrimitive$1();
70
- $[0] = t0$10;
69
+ t0 = makeSomePrimitive();
70
+ $[0] = t0;
71
} else {
72
- t0$10 = $[0];
72
+ t0 = $[0];
73
}
74
75
- let t1$11;
75
+ let t1;
76
77
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
78
- t1$11 = makeSomePrimitive$1();
79
- $[1] = t1$11;
78
+ t1 = makeSomePrimitive();
79
+ $[1] = t1;
80
} else {
81
- t1$11 = $[1];
81
+ t1 = $[1];
82
}
83
84
- const c_2 = $[2] !== t0$10;
85
- const c_3 = $[3] !== t1$11;
86
- let x$12;
84
+ const c_2 = $[2] !== t0;
85
+ const c_3 = $[3] !== t1;
86
+ let x;
87
88
if (c_2 || c_3) {
89
- x$12 = {
90
- u: t0$10,
91
- v: t1$11,
89
+ x = {
90
+ u: t0,
91
+ v: t1,
92
};
93
- $[2] = t0$10;
94
- $[3] = t1$11;
95
- $[4] = x$12;
93
+ $[2] = t0;
94
+ $[3] = t1;
95
+ $[4] = x;
96
} else {
97
- x$12 = $[4];
97
+ x = $[4];
98
}
99
100
- const u$13 = x$12.u;
101
- const v$14 = x$12.v;
100
+ const u = x.u;
101
+ const v = x.v;
102
103
- if (u$13 > v$14) {
103
+ if (u > v) {
104
}
105
106
- const y$16 = x$12.u;
107
- const z$17 = x$12.v;
106
+ const y = x.u;
107
+ const z = x.v;
108
}
109
110
```
compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md
+11
-11
@@ -43,27 +43,27 @@ function component(
43
## Code
44
45
```javascript
46
-function component$0() {
46
+function component() {
47
const $ = React.useMemoCache();
48
- let x$4;
48
+ let x;
49
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
50
- x$4 = {};
51
- let q$5;
50
+ x = {};
51
+ let q;
52
53
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
54
- q$5 = {};
55
- $[1] = q$5;
54
+ q = {};
55
+ $[1] = q;
56
} else {
57
- q$5 = $[1];
57
+ q = $[1];
58
}
59
60
- x$4.t = q$5;
61
- $[0] = x$4;
60
+ x.t = q;
61
+ $[0] = x;
62
} else {
63
- x$4 = $[0];
63
+ x = $[0];
64
}
65
66
- const z$6 = x$4.t;
66
+ const z = x.t;
67
}
68
69
```
compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md
+22
-22
@@ -60,43 +60,43 @@ function component(
60
## Code
61
62
```javascript
63
-function component$0() {
63
+function component() {
64
const $ = React.useMemoCache();
65
- let p$7;
65
+ let p;
66
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
67
- p$7 = makePrimitive$1();
68
- $[0] = p$7;
67
+ p = makePrimitive();
68
+ $[0] = p;
69
} else {
70
- p$7 = $[0];
70
+ p = $[0];
71
}
72
73
- p$7 + p$7;
74
- let o$8;
73
+ p + p;
74
+ let o;
75
76
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
77
- o$8 = {};
78
- $[1] = o$8;
77
+ o = {};
78
+ $[1] = o;
79
} else {
80
- o$8 = $[1];
80
+ o = $[1];
81
}
82
83
- const c_2 = $[2] !== p$7;
84
- const c_3 = $[3] !== o$8;
85
- let x$9;
83
+ const c_2 = $[2] !== p;
84
+ const c_3 = $[3] !== o;
85
+ let x;
86
87
if (c_2 || c_3) {
88
- x$9 = {};
89
- x$9.t = p$7;
90
- const z$10 = x$9.t;
91
- x$9.t = o$8;
92
- $[2] = p$7;
93
- $[3] = o$8;
94
- $[4] = x$9;
88
+ x = {};
89
+ x.t = p;
90
+ const z = x.t;
91
+ x.t = o;
92
+ $[2] = p;
93
+ $[3] = o;
94
+ $[4] = x;
95
} else {
96
- x$9 = $[4];
96
+ x = $[4];
97
}
98
99
- const y$11 = x$9.t;
99
+ const y = x.t;
100
}
101
102
```
compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md
+3
-3
@@ -33,9 +33,9 @@ function component(
33
## Code
34
35
```javascript
36
-function component$0() {
37
- const x$3 = 1;
38
- const y$4 = 2;
36
+function component() {
37
+ const x = 1;
38
+ const y = 2;
39
}
40
41
```
compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md
+12
-12
@@ -56,30 +56,30 @@ function component(
56
## Code
57
58
```javascript
59
-function component$0() {
59
+function component() {
60
const $ = React.useMemoCache();
61
- let x$7;
61
+ let x;
62
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
63
- x$7 = foo$1();
64
- $[0] = x$7;
63
+ x = foo();
64
+ $[0] = x;
65
} else {
66
- x$7 = $[0];
66
+ x = $[0];
67
}
68
69
- let y$8;
69
+ let y;
70
71
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
72
- y$8 = foo$1();
73
- $[1] = y$8;
72
+ y = foo();
73
+ $[1] = y;
74
} else {
75
- y$8 = $[1];
75
+ y = $[1];
76
}
77
78
- if (x$7 > y$8) {
79
- const z$10 = {};
78
+ if (x > y) {
79
+ const z = {};
80
}
81
82
- const z$12 = foo$1();
82
+ const z = foo();
83
}
84
85
```
compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md
+3
-3
@@ -44,11 +44,11 @@ function foo(
44
## Code
45
46
```javascript
47
-function foo$0(a$3, b$4) {
48
- while (a$3) {
47
+function foo(a, b) {
48
+ while (a) {
49
break;
50
}
51
- return b$4;
51
+ return b;
52
}
53
54
```
compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md
+5
-5
@@ -65,15 +65,15 @@ function foo(
65
## Code
66
67
```javascript
68
-function foo$0(a$5, b$6, c$7, d$8) {
69
- while (a$5) {
70
- if (b$6) {
68
+function foo(a, b, c, d) {
69
+ while (a) {
70
+ if (b) {
71
continue;
72
}
73
- c$7();
73
+ c();
74
}
75
76
- d$8();
76
+ d();
77
}
78
79
```
compiler/forget/test262
+1
-1
@@ -1 +1 @@
1
-Subproject commit 920a567b72433deed172180d8649df23dbca1607
1
+Subproject commit 83a46bfe0e79aed8274a1b9f4beb0a2efa0b3533