Record scope outputs
While we're collecting scope dependencies, we have the exact right information to record scope outputs. These are variables that need to be defined outside of the scope and populated by recomputing (on change) or via the cached value (if no change).
Joe Savona committed
Dec 14, 2022 at 13:27 UTC
7199229cb45e896cf93faf5905636221c66e0b1f
90 files changed
+235
-213
compiler/forget/src/HIR/HIR.ts
+1
@@ -382,6 +382,7 @@ export type ReactiveScope = {
382
id: ScopeId;
383
range: MutableRange;
384
dependencies: Set<Place>;
385
+ outputs: Set<Identifier>;
386
};
387
388
/**
compiler/forget/src/HIR/InferReactiveScopeVariables.ts
+1
@@ -123,6 +123,7 @@ export function inferReactiveScopeVariables(fn: HIRFunction) {
123
id: makeScopeId(scopes.size),
124
range: identifier.mutableRange,
125
dependencies: new Set(),
126
+ outputs: new Set(),
127
};
128
scopes.set(groupIdentifier, scope);
129
} else {
compiler/forget/src/HIR/PrintReactiveFunction.ts
+3
@@ -15,6 +15,7 @@ import {
15
ReactiveValueBlock,
16
} from "./HIR";
17
import {
18
+ printIdentifier,
19
printInstruction,
20
printInstructionValue,
21
printPlace,
@@ -40,6 +41,8 @@ export function printReactiveBlock(writer: Writer, block: ReactiveBlock): void {
41
block.scope.range.end
42
}] deps=[${Array.from(block.scope.dependencies)
43
.map((dep) => printPlace(dep))
44
+ .join(", ")}] out=[${Array.from(block.scope.outputs)
45
+ .map((out) => printIdentifier(out))
46
.join(", ")}] {`
47
);
48
printReactiveInstructions(writer, block.instructions);
compiler/forget/src/HIR/PropagateScopeDependencies.ts
+60
-41
@@ -13,6 +13,7 @@ import {
13
InstructionKind,
14
InstructionValue,
15
makeInstructionId,
16
+ MutableRange,
17
Place,
18
ReactiveBasicBlock,
19
ReactiveFunction,
@@ -52,7 +53,7 @@ function visit(
53
block: ReactiveBasicBlock,
54
dependencies: Set<Place>,
55
declarations: DeclMap,
55
- scopeStart: InstructionId | null
56
+ scopeRange: MutableRange | null
57
): void {
58
for (const item of block) {
59
switch (item.kind) {
@@ -64,7 +65,7 @@ function visit(
65
item.instructions,
66
scopeDependencies,
67
scopeDeclarations,
67
- item.scope.range.start
68
+ item.scope.range
69
);
70
item.scope.dependencies = scopeDependencies;
71
for (const dep of scopeDependencies) {
@@ -72,7 +73,7 @@ function visit(
73
// normal dependency collection. child scopes may have dependencies
74
// on values created within the outer scope, which necessarily cannot
75
// be dependencies of the outer scope
75
- visitOperand(dep, dependencies, declarations, scopeStart);
76
+ visitOperand(dep, dependencies, declarations, scopeRange);
77
}
78
for (const [ident, kind] of scopeDeclarations) {
79
declarations.set(ident, kind);
@@ -84,7 +85,7 @@ function visit(
85
item.instruction,
86
dependencies,
87
declarations,
87
- scopeStart
88
+ scopeRange
89
);
90
break;
91
}
@@ -101,7 +102,7 @@ function visit(
102
terminal.value,
103
dependencies,
104
declarations,
104
- scopeStart
105
+ scopeRange
106
);
107
}
108
break;
@@ -111,7 +112,7 @@ function visit(
112
terminal.value,
113
dependencies,
114
declarations,
114
- scopeStart
115
+ scopeRange
116
);
117
break;
118
}
@@ -120,21 +121,21 @@ function visit(
121
terminal.init,
122
dependencies,
123
declarations,
123
- scopeStart
124
+ scopeRange
125
);
126
visitValueBlock(
127
terminal.test,
128
dependencies,
129
declarations,
129
- scopeStart
130
+ scopeRange
131
);
132
visitValueBlock(
133
terminal.update,
134
dependencies,
135
declarations,
135
- scopeStart
136
+ scopeRange
137
);
137
- visit(terminal.loop, dependencies, declarations, scopeStart);
138
+ visit(terminal.loop, dependencies, declarations, scopeRange);
139
break;
140
}
141
case "while": {
@@ -142,24 +143,24 @@ function visit(
143
terminal.test,
144
dependencies,
145
declarations,
145
- scopeStart
146
+ scopeRange
147
);
147
- visit(terminal.loop, dependencies, declarations, scopeStart);
148
+ visit(terminal.loop, dependencies, declarations, scopeRange);
149
break;
150
}
151
case "if": {
151
- visitOperand(terminal.test, dependencies, declarations, scopeStart);
152
- visit(terminal.consequent, dependencies, declarations, scopeStart);
152
+ visitOperand(terminal.test, dependencies, declarations, scopeRange);
153
+ visit(terminal.consequent, dependencies, declarations, scopeRange);
154
if (terminal.alternate !== null) {
154
- visit(terminal.alternate, dependencies, declarations, scopeStart);
155
+ visit(terminal.alternate, dependencies, declarations, scopeRange);
156
}
157
break;
158
}
159
case "switch": {
159
- visitOperand(terminal.test, dependencies, declarations, scopeStart);
160
+ visitOperand(terminal.test, dependencies, declarations, scopeRange);
161
for (const case_ of terminal.cases) {
162
if (case_.block !== undefined) {
162
- visit(case_.block, dependencies, declarations, scopeStart);
163
+ visit(case_.block, dependencies, declarations, scopeRange);
164
}
165
}
166
break;
@@ -184,7 +185,7 @@ function visitValueBlock(
185
block: ReactiveValueBlock,
186
dependencies: Set<Place>,
187
declarations: DeclMap,
187
- scopeStart: InstructionId | null
188
+ scopeRange: MutableRange | null
189
): void {
190
for (const initItem of block.instructions) {
191
if (initItem.kind === "instruction") {
@@ -192,34 +193,49 @@ function visitValueBlock(
193
initItem.instruction,
194
dependencies,
195
declarations,
195
- scopeStart
196
+ scopeRange
197
);
198
}
199
}
200
if (block.value !== null) {
200
- visitInstructionValue(block.value, dependencies, declarations, scopeStart);
201
+ visitInstructionValue(block.value, dependencies, declarations, scopeRange);
202
}
203
}
204
205
function visitOperand(
205
- operand: Place,
206
+ maybeDependency: Place,
207
dependencies: Set<Place>,
208
declarations: DeclMap,
208
- scopeStart: InstructionId | null
209
+ scopeRange: MutableRange | null
210
): void {
210
- const decl = declarations.get(operand.identifier);
211
- if (decl === undefined) {
212
- // Probably a global, ignore for now
213
- // TODO @josephsavona: improve handling of globals
214
- return;
215
- } else if (decl.kind === DeclKind.Const) {
216
- // constant, dont need to add a dep
217
- return;
218
- } else if (scopeStart !== null && decl.id < scopeStart) {
211
+ const decl = declarations.get(maybeDependency.identifier);
212
+
213
+ // Any value used after its defining scope has concluded must be added as an
214
+ // output of its defining scope. Regardless of whether its a const or not,
215
+ // some later code needs access to the value.
216
+ if (decl !== undefined) {
217
+ const operandScope = maybeDependency.identifier.scope;
218
+ if (
219
+ operandScope !== null &&
220
+ ((scopeRange !== null && operandScope.range.end <= scopeRange.start) ||
221
+ scopeRange === null)
222
+ ) {
223
+ operandScope.outputs.add(maybeDependency.identifier);
224
+ }
225
+ }
226
+
227
+ // If this operand is used in a scope, has a dynamic value, and was defined
228
+ // before this scope, then its a dependency of the scope.
229
+ if (
230
+ decl !== undefined &&
231
+ decl.kind !== DeclKind.Const &&
232
+ scopeRange !== null &&
233
+ decl.id < scopeRange.start
234
+ ) {
235
// Check if there is an existing dependency that describes this operand
236
for (const dep of dependencies) {
237
// not the same identifier
222
- if (dep.identifier !== operand.identifier) {
238
+ if (dep.identifier !== maybeDependency.identifier) {
239
continue;
240
}
241
const depPath = dep.memberPath;
@@ -227,11 +243,11 @@ function visitOperand(
243
if (depPath === null) {
244
return;
245
}
230
- const operandPath = operand.memberPath;
246
+ const operandPath = maybeDependency.memberPath;
247
// existing dep is for a path, this operand covers all paths so swap them
248
if (operandPath === null) {
249
dependencies.delete(dep);
234
- dependencies.add(operand);
250
+ dependencies.add(maybeDependency);
251
return;
252
}
253
// both the operand and dep have paths, determine if the existing path
@@ -248,7 +264,7 @@ function visitOperand(
264
return;
265
}
266
}
251
- dependencies.add(operand);
267
+ dependencies.add(maybeDependency);
268
}
269
}
270
@@ -256,7 +272,7 @@ function visitInstructionValue(
272
value: InstructionValue,
273
dependencies: Set<Place>,
274
declarations: DeclMap,
259
- scopeStart: InstructionId | null
275
+ scopeRange: MutableRange | null
276
): void {
277
for (const operand of eachInstructionValueOperand(value)) {
278
// check for method invocation, we want to depend on the callee, not the method
@@ -269,9 +285,9 @@ function visitInstructionValue(
285
...operand,
286
memberPath: operand.memberPath.slice(0, -1),
287
};
272
- visitOperand(callee, dependencies, declarations, scopeStart);
288
+ visitOperand(callee, dependencies, declarations, scopeRange);
289
} else {
274
- visitOperand(operand, dependencies, declarations, scopeStart);
290
+ visitOperand(operand, dependencies, declarations, scopeRange);
291
}
292
}
293
}
@@ -280,16 +296,19 @@ function visitInstruction(
296
instr: Instruction,
297
dependencies: Set<Place>,
298
declarations: DeclMap,
283
- scopeStart: InstructionId | null
299
+ scopeRange: MutableRange | null
300
): void {
285
- visitInstructionValue(instr.value, dependencies, declarations, scopeStart);
301
+ visitInstructionValue(instr.value, dependencies, declarations, scopeRange);
302
const { lvalue } = instr;
303
if (
304
lvalue !== null &&
305
lvalue.kind !== InstructionKind.Reassign &&
306
lvalue.place.memberPath === null
307
) {
292
- const kind = valueKind(instr.value);
308
+ const range = lvalue.place.identifier.mutableRange;
309
+ // TODO: only assign Const if the value is never reassigned
310
+ const kind =
311
+ range.end === range.start + 1 ? valueKind(instr.value) : DeclKind.Dynamic;
312
declarations.set(lvalue.place.identifier, { kind, id: instr.id });
313
}
314
}
compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md
+1
-1
@@ -43,7 +43,7 @@ bb1:
43
function Component(
44
props,
45
) {
46
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] {
46
+ scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] {
47
[1] Const mutate a$4_@0:TFunction[1:7] = Array []
48
[2] Call mutate a$4_@0.push(read props$3.a)
49
if (read props$3.b) {
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md
+1
-1
@@ -31,7 +31,7 @@ bb0:
31
```
32
function component(
33
) {
34
- scope @0 [1:7] deps=[] {
34
+ scope @0 [1:7] deps=[] out=[] {
35
[1] Const mutate z$5_@0[1:7] = Array []
36
[2] Const mutate y$6_@0:TObject[1:7] = Object { }
37
[3] Reassign mutate y$6_@0.z[1:7] = read z$5_@0
compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md
+3
-3
@@ -30,14 +30,14 @@ bb0:
30
```
31
function component(
32
) {
33
- scope @0 [1:2] deps=[] {
33
+ scope @0 [1:2] deps=[] out=[z$4_@0] {
34
[1] Const mutate z$4_@0 = Array []
35
}
36
- scope @1 [2:4] deps=[read z$4_@0] {
36
+ scope @1 [2:4] deps=[read z$4_@0] out=[y$5_@1] {
37
[2] Const mutate y$5_@1:TObject[2:4] = Object { }
38
[3] Reassign mutate y$5_@1.z[2:4] = read z$4_@0
39
}
40
- scope @2 [4:6] deps=[read y$5_@1:TObject] {
40
+ scope @2 [4:6] deps=[read y$5_@1:TObject] out=[x$6_@2] {
41
[4] Const mutate x$6_@2:TObject[4:6] = Object { }
42
[5] Reassign mutate x$6_@2.y[4:6] = read y$5_@1:TObject
43
}
compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md
+1
-1
@@ -56,7 +56,7 @@ bb2:
56
function foo(
57
cond,
58
) {
59
- scope @0 [1:12] deps=[read cond$7] {
59
+ scope @0 [1:12] deps=[read cond$7] out=[a$8_@0, b$9_@0, c$10_@0] {
60
[1] Let mutate a$8_@0:TObject[1:12] = Object { }
61
[2] Let mutate b$9_@0:TObject[1:12] = Object { }
62
[3] Let mutate c$10_@0:TObject[1:12] = Object { }
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
+1
-1
@@ -76,7 +76,7 @@ function g(
76
a,
77
) {
78
[1] Const mutate $5:TPrimitive = 1
79
- scope @0 [0:5] deps=[] {
79
+ scope @0 [0:5] deps=[] out=[] {
80
[2] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c + read $5:TPrimitive
81
[3] Const mutate $6:TPrimitive = 2
82
[4] Reassign mutate a$4_@0.b.c[0:5] = Binary read a$4_@0.b.c * read $6:TPrimitive
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+3
-3
@@ -59,18 +59,18 @@ bb0:
59
function Component(
60
props,
61
) {
62
- scope @0 [1:7] deps=[] {
62
+ scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
[1] Const mutate a$10_@0:TObject[1:7] = Array []
64
[2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
[3] Call mutate foo$4:TFunction(mutate a$10_@0:TObject, mutate b$11_@0:TObject)
66
[4] Const mutate $12:TPrimitive = "div"
67
- scope @1 [5:6] deps=[freeze a$10_@0:TObject] {
67
+ scope @1 [5:6] deps=[freeze a$10_@0:TObject] out=[] {
68
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0:TObject} ></read $12:TPrimitive>
69
}
70
[6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject)
71
}
72
[7] Const mutate $14:TPrimitive = "div"
73
- scope @2 [8:9] deps=[read a$10_@0:TObject, freeze b$11_@0:TObject] {
73
+ scope @2 [8:9] deps=[read a$10_@0:TObject, freeze b$11_@0:TObject] out=[$15_@2] {
74
[8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0:TObject} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
75
}
76
return read $15_@2
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+4
-4
@@ -110,11 +110,11 @@ function Component(
110
) {
111
[1] Const mutate items$30:TProp = read props$29.items
112
[2] Const mutate maxItems$31:TProp = read props$29.maxItems
113
- scope @0 [3:33] deps=[read maxItems$31:TProp, read items$30.length, read items$30] {
113
+ scope @0 [3:33] deps=[read maxItems$31:TProp, read items$30.length, read items$30] out=[renderedItems$32_@0] {
114
[3] Const mutate renderedItems$32_@0:TFunction[3:33] = Array []
115
[4] Const mutate seen$33_@0:TFunction[3:33] = New mutate Set$6()
116
[5] Const mutate $34:TPrimitive = 0
117
- scope @2 [6:7] deps=[read maxItems$31:TProp] {
117
+ scope @2 [6:7] deps=[read maxItems$31:TProp] out=[] {
118
[6] Const mutate max$35_@2:TPrimitive = Call mutate Math$8.max(read $34:TPrimitive, read maxItems$31:TProp)
119
}
120
for (
@@ -154,12 +154,12 @@ function Component(
154
[35] Const mutate $68 = "\n "
155
[36] Const mutate $69:TPrimitive = "h1"
156
[37] Const mutate $70 = " Items"
157
- scope @4 [38:39] deps=[freeze count$66:TProp] {
157
+ scope @4 [38:39] deps=[freeze count$66:TProp] out=[$71_@4] {
158
[38] Const mutate $71_@4 = JSX <read $69:TPrimitive>{freeze count$66:TProp}{read $70}</read $69:TPrimitive>
159
}
160
[39] Const mutate $72 = "\n "
161
[40] Const mutate $73 = "\n "
162
- scope @5 [41:42] deps=[read $71_@4, freeze renderedItems$32_@0:TFunction] {
162
+ scope @5 [41:42] deps=[read $71_@4, freeze renderedItems$32_@0:TFunction] out=[$74_@5] {
163
[41] Const mutate $74_@5 = JSX <read $67:TPrimitive>{read $68}{read $71_@4}{read $72}{freeze renderedItems$32_@0:TFunction}{read $73}</read $67:TPrimitive>
164
}
165
return read $74_@5
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+5
-5
@@ -97,7 +97,7 @@ bb1:
97
function Component(
98
props,
99
) {
100
- scope @0 [1:7] deps=[read props$4.a, read props$4.b, read props$4.d] {
100
+ scope @0 [1:7] deps=[read props$4.a, read props$4.b, read props$4.d] out=[a_DEBUG$5_@0] {
101
[1] Const mutate a_DEBUG$5_@0:TFunction[1:7] = Array []
102
[2] Call mutate a_DEBUG$5_@0.push(read props$4.a)
103
if (read props$4.b) {
@@ -149,7 +149,7 @@ bb1:
149
function Component(
150
props,
151
) {
152
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] {
152
+ scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] {
153
[1] Const mutate a$4_@0:TFunction[1:7] = Array []
154
[2] Call mutate a$4_@0.push(read props$3.a)
155
if (read props$3.b) {
@@ -201,7 +201,7 @@ bb1:
201
function Component(
202
props,
203
) {
204
- scope @0 [1:8] deps=[read props$4.a, read props$4.b, read props$4.c, read props$4.d] {
204
+ scope @0 [1:8] deps=[read props$4.a, read props$4.b, read props$4.c, read props$4.d] out=[a$5_@0] {
205
[1] Const mutate a$5_@0:TFunction[1:8] = Array []
206
[2] Call mutate a$5_@0.push(read props$4.a)
207
if (read props$4.b) {
@@ -255,7 +255,7 @@ bb1:
255
function Component(
256
props,
257
) {
258
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] {
258
+ scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] {
259
[1] Const mutate a$4_@0:TFunction[1:7] = Array []
260
[2] Call mutate a$4_@0.push(read props$3.a)
261
if (read props$3.b) {
@@ -308,7 +308,7 @@ bb1:
308
function Component(
309
props,
310
) {
311
- scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] {
311
+ scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] {
312
[1] Const mutate a$4_@0:TFunction[1:7] = Array []
313
[2] Call mutate a$4_@0.push(read props$3.a)
314
if (read props$3.b) {
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+4
-4
@@ -61,7 +61,7 @@ bb3:
61
function Component(
62
props,
63
) {
64
- scope @0 [1:9] deps=[read props$6.p0, read props$6.p1, read props$6.p2] {
64
+ scope @0 [1:9] deps=[read props$6.p0, read props$6.p1, read props$6.p2] out=[a$7_@0] {
65
[1] Const mutate a$7_@0:TFunction[1:9] = Array []
66
[2] Const mutate b$8_@0:TFunction[1:9] = Array []
67
if (read b$8_@0:TFunction) {
@@ -71,7 +71,7 @@ function Component(
71
[7] Call mutate b$8_@0.push(read props$6.p2)
72
}
73
}
74
- scope @2 [9:10] deps=[freeze a$7_@0:TFunction, freeze b$8_@0:TFunction] {
74
+ scope @2 [9:10] deps=[freeze a$7_@0:TFunction, freeze b$8_@0:TFunction] out=[$16_@2] {
75
[9] Const mutate $16_@2 = JSX <read Foo$4 a={freeze a$7_@0:TFunction} b={freeze b$8_@0:TFunction} ></read Foo$4>
76
}
77
return read $16_@2
@@ -128,7 +128,7 @@ bb3:
128
function Component(
129
props,
130
) {
131
- scope @0 [1:10] deps=[read props$8.p0, read props$8.p1, read props$8.p2] {
131
+ scope @0 [1:10] deps=[read props$8.p0, read props$8.p1, read props$8.p2] out=[a$9_@0] {
132
[1] Const mutate a$9_@0:TFunction[1:10] = Array []
133
[2] Const mutate b$10_@0:TFunction[1:10] = Array []
134
[3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0:TFunction)
@@ -139,7 +139,7 @@ function Component(
139
[8] Call mutate b$10_@0.push(read props$8.p2)
140
}
141
}
142
- scope @2 [10:11] deps=[freeze a$9_@0:TFunction, freeze b$10_@0:TFunction] {
142
+ scope @2 [10:11] deps=[freeze a$9_@0:TFunction, freeze b$10_@0:TFunction] out=[$19_@2] {
143
[10] Const mutate $19_@2 = JSX <read Foo$6 a={freeze a$9_@0:TFunction} b={freeze b$10_@0:TFunction} ></read Foo$6>
144
}
145
return read $19_@2
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+3
-3
@@ -59,18 +59,18 @@ bb0:
59
function Component(
60
props,
61
) {
62
- scope @0 [1:7] deps=[] {
62
+ scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
[1] Const mutate a$10_@0[1:7] = Array []
64
[2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
[3] New mutate Foo$4(mutate a$10_@0, mutate b$11_@0:TObject)
66
[4] Const mutate $12:TPrimitive = "div"
67
- scope @1 [5:6] deps=[freeze a$10_@0] {
67
+ scope @1 [5:6] deps=[freeze a$10_@0] out=[] {
68
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
69
}
70
[6] New mutate Foo$4(mutate b$11_@0:TObject)
71
}
72
[7] Const mutate $14:TPrimitive = "div"
73
- scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] {
73
+ scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] {
74
[8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
75
}
76
return read $15_@2
compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md
+2
-2
@@ -51,13 +51,13 @@ function foo(
51
a,
52
b,
53
) {
54
- scope @0 [1:3] deps=[read a$6] {
54
+ scope @0 [1:3] deps=[read a$6] out=[x$8_@0] {
55
[1] Const mutate x$8_@0:TFunction[1:3] = Array []
56
[2] Call mutate x$8_@0.push(read a$6)
57
}
58
[3] Const mutate $9:TPrimitive = "div"
59
[4] JSX <read $9:TPrimitive>{freeze x$8_@0:TFunction}</read $9:TPrimitive>
60
- scope @1 [5:12] deps=[read x$8_@0:TFunction, read b$7:TFunction] {
60
+ scope @1 [5:12] deps=[read x$8_@0:TFunction, read b$7:TFunction] out=[] {
61
[5] Const mutate y$10_@1:TFunction[5:12] = Array []
62
if (read x$8_@0.length) {
63
[7] Call mutate y$10_@1.push(read x$8_@0:TFunction)
compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md
+2
-2
@@ -52,10 +52,10 @@ function foo(
52
y,
53
z,
54
) {
55
- scope @0 [1:10] deps=[read z$8, read x$6, read y$7] {
55
+ scope @0 [1:10] deps=[read z$8, read x$6, read y$7] out=[] {
56
[1] Const mutate items$9_@0:TFunction[1:10] = Array [read z$8]
57
[2] Call mutate items$9_@0.push(read x$6)
58
- scope @1 [3:7] deps=[read x$6, read y$7] {
58
+ scope @1 [3:7] deps=[read x$6, read y$7] out=[items2$10_@1] {
59
[3] Const mutate items2$10_@1:TFunction[3:7] = Array []
60
if (read x$6) {
61
[5] Call mutate items2$10_@1.push(read y$7)
compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md
+1
-1
@@ -56,7 +56,7 @@ function foo(
56
b,
57
c,
58
) {
59
- scope @0 [1:8] deps=[read a$7, read b$8, read c$9] {
59
+ scope @0 [1:8] deps=[read a$7, read b$8, read c$9] out=[] {
60
[1] Const mutate x$10_@0:TFunction[1:8] = Array []
61
if (read a$7) {
62
if (read b$8) {
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+1
-1
@@ -30,7 +30,7 @@ bb0:
30
```
31
function Component(
32
) {
33
- scope @0 [1:2] deps=[] {
33
+ scope @0 [1:2] deps=[] out=[a$5_@0] {
34
[1] Const mutate a$5_@0 = Array []
35
}
36
[2] Const mutate b$6 = read a$5_@0
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
+3
-3
@@ -85,17 +85,17 @@ bb0:
85
function Component(
86
props,
87
) {
88
- scope @0 [1:2] deps=[] {
88
+ scope @0 [1:2] deps=[] out=[x$11_@0] {
89
[1] Const mutate x$11_@0 = Array []
90
}
91
- scope @1 [2:3] deps=[freeze x$11_@0] {
91
+ scope @1 [2:3] deps=[freeze x$11_@0] out=[y$12_@1] {
92
[2] Const mutate y$12_@1 = Call read useFreeze$4:TFunction(freeze x$11_@0)
93
}
94
[3] Call mutate foo$5:TFunction(read y$12_@1, read x$11_@0)
95
[4] Const mutate $13 = "\n "
96
[5] Const mutate $14 = "\n "
97
[6] Const mutate $15 = "\n "
98
- scope @2 [7:8] deps=[read x$11_@0, read y$12_@1] {
98
+ scope @2 [7:8] deps=[read x$11_@0, read y$12_@1] out=[$16_@2] {
99
[7] Const mutate $16_@2 = JSX <read Component$0>{read $13}{read x$11_@0}{read $14}{read y$12_@1}{read $15}</read Component$0>
100
}
101
return read $16_@2
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
+1
-1
@@ -31,7 +31,7 @@ bb0:
31
```
32
function Component(
33
) {
34
- scope @0 [1:2] deps=[] {
34
+ scope @0 [1:2] deps=[] out=[a$4_@0] {
35
[1] Const mutate a$4_@0 = Array []
36
}
37
[2] Call read useFreeze$2:TFunction(freeze a$4_@0)
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+1
-1
@@ -56,7 +56,7 @@ function Component(
56
[1] Const mutate cond$8:TProp = read props$7.cond
57
[2] Const mutate x$9:TProp = read props$7.x
58
[3] Const mutate a$10:TPrimitive = undefined
59
- scope @0 [4:9] deps=[read cond$8:TProp, read x$9:TProp] {
59
+ scope @0 [4:9] deps=[read cond$8:TProp, read x$9:TProp] out=[a$11_@0] {
60
[4] Let mutate a$11_@0:TProp[4:9] = undefined
61
if (read cond$8:TProp) {
62
[5] Reassign mutate a$11_@0:TProp[4:9] = read x$9:TProp
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+2
-2
@@ -149,7 +149,7 @@ bb1:
149
function Component(
150
props,
151
) {
152
- scope @1 [1:7] deps=[read props$8.a, read props$8.b, read props$8.c] {
152
+ scope @1 [1:7] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@1] {
153
[1] Const mutate a$9_@1[1:7] = Call mutate compute$3:TFunction(read props$8.a)
154
[2] Const mutate b$10_@1[1:7] = Call mutate compute$3:TFunction(read props$8.b)
155
if (read props$8.c) {
@@ -157,7 +157,7 @@ function Component(
157
[5] Call mutate mutate$5:TFunction(mutate b$10_@1)
158
}
159
}
160
- scope @2 [7:8] deps=[freeze a$9_@1, freeze b$10_@1] {
160
+ scope @2 [7:8] deps=[freeze a$9_@1, freeze b$10_@1] out=[$14_@2] {
161
[7] Const mutate $14_@2 = JSX <read Foo$6 a={freeze a$9_@1} b={freeze b$10_@1} ></read Foo$6>
162
}
163
return read $14_@2
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+3
-3
@@ -40,13 +40,13 @@ bb0:
40
function Component(
41
props,
42
) {
43
- scope @0 [1:2] deps=[read props$7.a] {
43
+ scope @0 [1:2] deps=[read props$7.a] out=[a$8_@0] {
44
[1] Const mutate a$8_@0 = Call mutate compute$3:TFunction(read props$7.a)
45
}
46
- scope @1 [2:3] deps=[read props$7.b] {
46
+ scope @1 [2:3] deps=[read props$7.b] out=[b$9_@1] {
47
[2] Const mutate b$9_@1 = Call mutate compute$3:TFunction(read props$7.b)
48
}
49
- scope @2 [3:4] deps=[freeze a$8_@0, freeze b$9_@1] {
49
+ scope @2 [3:4] deps=[freeze a$8_@0, freeze b$9_@1] out=[$10_@2] {
50
[3] Const mutate $10_@2 = JSX <read Foo$5 a={freeze a$8_@0} b={freeze b$9_@1} ></read Foo$5>
51
}
52
return read $10_@2
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+2
-2
@@ -119,14 +119,14 @@ bb1:
119
function Component(
120
props,
121
) {
122
- scope @0 [1:6] deps=[read props$8.a, read props$8.b, read props$8.c] {
122
+ scope @0 [1:6] deps=[read props$8.a, read props$8.b, read props$8.c] out=[a$9_@0, b$10_@0] {
123
[1] Const mutate a$9_@0[1:6] = Call mutate compute$3:TFunction(read props$8.a)
124
[2] Const mutate b$10_@0[1:6] = Call mutate compute$3:TFunction(read props$8.b)
125
if (read props$8.c) {
126
[4] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
127
}
128
}
129
- scope @1 [6:7] deps=[freeze a$9_@0, freeze b$10_@0] {
129
+ scope @1 [6:7] deps=[freeze a$9_@0, freeze b$10_@0] out=[$14_@1] {
130
[6] Const mutate $14_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
131
}
132
return read $14_@1
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+2
-2
@@ -41,12 +41,12 @@ bb0:
41
function Component(
42
props,
43
) {
44
- scope @0 [1:4] deps=[read props$8.a, read props$8.b] {
44
+ scope @0 [1:4] deps=[read props$8.a, read props$8.b] out=[a$9_@0, b$10_@0] {
45
[1] Const mutate a$9_@0[1:4] = Call mutate compute$3:TFunction(read props$8.a)
46
[2] Const mutate b$10_@0[1:4] = Call mutate compute$3:TFunction(read props$8.b)
47
[3] Call mutate foo$5:TFunction(mutate a$9_@0, mutate b$10_@0)
48
}
49
- scope @1 [4:5] deps=[freeze a$9_@0, freeze b$10_@0] {
49
+ scope @1 [4:5] deps=[freeze a$9_@0, freeze b$10_@0] out=[$11_@1] {
50
[4] Const mutate $11_@1 = JSX <read Foo$6 a={freeze a$9_@0} b={freeze b$10_@0} ></read Foo$6>
51
}
52
return read $11_@1
compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md
+1
-1
@@ -40,7 +40,7 @@ function foo(
40
b,
41
c,
42
) {
43
- scope @0 [1:6] deps=[read a$5, read b$6, read c$7] {
43
+ scope @0 [1:6] deps=[read a$5, read b$6, read c$7] out=[] {
44
[1] Const mutate y$8_@0:TFunction[1:6] = Array []
45
if (read a$5) {
46
if (read b$6) {
compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md
+1
-1
@@ -28,7 +28,7 @@ bb0:
28
function Component(
29
c,
30
) {
31
- scope @0 [1:3] deps=[read c$6] {
31
+ scope @0 [1:3] deps=[read c$6] out=[x$7_@0] {
32
[1] Const mutate x$7_@0:TObject[1:3] = Object { c: read c$6 }
33
[2] Call mutate mutate$3:TFunction(mutate x$7_@0:TObject)
34
}
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
+3
-3
@@ -45,15 +45,15 @@ function Foo(
45
[4] Const mutate $17:TPrimitive = "div"
46
[5] Const mutate $18 = "\n "
47
[6] Const mutate $19 = "Text"
48
- scope @0 [7:8] deps=[] {
48
+ scope @0 [7:8] deps=[] out=[$20_@0] {
49
[7] Const mutate $20_@0 = JsxFragment [read $19]
50
}
51
[8] Const mutate $21 = "\n "
52
- scope @1 [9:10] deps=[read $20_@0] {
52
+ scope @1 [9:10] deps=[read $20_@0] out=[$22_@1] {
53
[9] Const mutate $22_@1 = JSX <read $17:TPrimitive>{read $18}{read $20_@0}{read $21}</read $17:TPrimitive>
54
}
55
[10] Const mutate $23 = "\n "
56
- scope @2 [11:12] deps=[read props$13.greeting, read $22_@1] {
56
+ scope @2 [11:12] deps=[read props$13.greeting, read $22_@1] out=[$24_@2] {
57
[11] Const mutate $24_@2 = JsxFragment [read $14, read props$13.greeting, read $15:TPrimitive, read $16, read $22_@1, read $23]
58
}
59
return read $24_@2
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
+6
-6
@@ -44,10 +44,10 @@ bb1:
44
```
45
function And(
46
) {
47
- scope @0 [1:2] deps=[] {
47
+ scope @0 [1:2] deps=[] out=[$5_@0] {
48
[1] Const mutate $5_@0 = Call mutate f$1:TFunction()
49
}
50
- scope @1 [2:7] deps=[read $5_@0] {
50
+ scope @1 [2:7] deps=[read $5_@0] out=[$6_@1] {
51
[2] Let mutate $6_@1[2:7] = undefined
52
if (read $5_@0) {
53
[3] Const mutate $6_@1[2:7] = Call mutate g$4:TFunction()
@@ -96,10 +96,10 @@ bb1:
96
```
97
function Or(
98
) {
99
- scope @0 [1:2] deps=[] {
99
+ scope @0 [1:2] deps=[] out=[$5_@0] {
100
[1] Const mutate $5_@0 = Call mutate f$1:TFunction()
101
}
102
- scope @1 [2:7] deps=[read $5_@0] {
102
+ scope @1 [2:7] deps=[read $5_@0] out=[$6_@1] {
103
[2] Let mutate $6_@1[2:7] = undefined
104
if (read $5_@0) {
105
[3] Const mutate $6_@1[2:7] = read $5_@0
@@ -151,12 +151,12 @@ bb1:
151
function QuestionQuestion(
152
props,
153
) {
154
- scope @0 [1:2] deps=[] {
154
+ scope @0 [1:2] deps=[] out=[$9_@0] {
155
[1] Const mutate $9_@0:TPrimitive = Call mutate f$2:TFunction()
156
}
157
[2] Const mutate $10:TPrimitive = null
158
[3] Const mutate $11:TPrimitive = Binary read $9_@0:TPrimitive != read $10:TPrimitive
159
- scope @1 [4:9] deps=[read $9_@0:TPrimitive] {
159
+ scope @1 [4:9] deps=[read $9_@0:TPrimitive] out=[$12_@1] {
160
[4] Let mutate $12_@1:TPrimitive[4:9] = undefined
161
if (read $11:TPrimitive) {
162
[5] Const mutate $12_@1:TPrimitive[4:9] = read $9_@0:TPrimitive
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+1
-1
@@ -139,7 +139,7 @@ bb13:
139
function Component(
140
props,
141
) {
142
- scope @0 [1:23] deps=[] {
142
+ scope @0 [1:23] deps=[] out=[] {
143
[1] Let mutate a$18_@0[1:23] = Object { }
144
[2] Let mutate b$20_@0[1:23] = Object { }
145
[3] Let mutate c$22_@0:TPrimitive[1:23] = Object { }
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+3
-3
@@ -97,12 +97,12 @@ bb9:
97
function Component(
98
props,
99
) {
100
- scope @0 [1:2] deps=[] {
100
+ scope @0 [1:2] deps=[] out=[a$11_@0] {
101
[1] Const mutate a$11_@0:TObject = Object { }
102
}
103
- scope @1 [2:15] deps=[read a$11_@0:TObject] {
103
+ scope @1 [2:15] deps=[read a$11_@0:TObject] out=[] {
104
[2] Const mutate b$12_@1[2:15] = Array [read a$11_@0:TObject]
105
- scope @2 [3:4] deps=[] {
105
+ scope @2 [3:4] deps=[] out=[] {
106
[3] Const mutate c$13_@2:TObject = Object { }
107
}
108
[4] Const mutate d$14_@1:TObject[2:15] = Object { c: read c$13_@2:TObject }
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
+2
-2
@@ -126,10 +126,10 @@ bb13:
126
function Component(
127
props,
128
) {
129
- scope @0 [1:18] deps=[] {
129
+ scope @0 [1:18] deps=[] out=[] {
130
[1] Const mutate a$12_@0:TObject[1:18] = Object { }
131
[2] Const mutate b$13_@0:TObject[1:18] = Object { }
132
- scope @1 [3:4] deps=[] {
132
+ scope @1 [3:4] deps=[] out=[] {
133
[3] Const mutate c$14_@1:TObject = Object { }
134
}
135
[4] Const mutate d$15_@0:TObject[1:18] = Object { }
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md
+1
-1
@@ -37,7 +37,7 @@ function foo(
37
b,
38
c,
39
) {
40
- scope @0 [1:6] deps=[read a$6, read b$7] {
40
+ scope @0 [1:6] deps=[read a$6, read b$7] out=[] {
41
[1] Const mutate x$9_@0:TFunction[1:6] = Array []
42
[2] Const mutate y$10_@0:TFunction[1:6] = Array []
43
if (read x$9_@0:TFunction) {
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md
+1
-1
@@ -29,7 +29,7 @@ function foo(
29
a,
30
b,
31
) {
32
- scope @0 [1:5] deps=[read a$5, read b$6] {
32
+ scope @0 [1:5] deps=[read a$5, read b$6] out=[] {
33
[1] Const mutate x$7_@0:TFunction[1:5] = Array []
34
[2] Const mutate y$8_@0:TFunction[1:5] = Array []
35
[3] Call mutate x$7_@0.push(read a$5)
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md
+2
-2
@@ -29,9 +29,9 @@ function foo(
29
a,
30
b,
31
) {
32
- scope @0 [1:5] deps=[read b$6, read a$5] {
32
+ scope @0 [1:5] deps=[read b$6, read a$5] out=[] {
33
[1] Const mutate x$7_@0:TFunction[1:5] = Array []
34
- scope @1 [2:4] deps=[read b$6] {
34
+ scope @1 [2:4] deps=[read b$6] out=[] {
35
[2] Const mutate y$8_@1:TFunction[2:4] = Array []
36
[3] Call mutate y$8_@1.push(read b$6)
37
}
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md
+3
-3
@@ -50,17 +50,17 @@ function foo(
50
b,
51
c,
52
) {
53
- scope @0 [1:11] deps=[read a$8, read b$9, read c$10] {
53
+ scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] {
54
[1] Const mutate x$11_@0:TFunction[1:11] = Array []
55
if (read a$8) {
56
- scope @1 [3:7] deps=[read b$9, read c$10] {
56
+ scope @1 [3:7] deps=[read b$9, read c$10] out=[y$12_@1] {
57
[3] Const mutate y$12_@1:TFunction[3:7] = Array []
58
if (read b$9) {
59
[5] Call mutate y$12_@1.push(read c$10)
60
}
61
}
62
[7] Const mutate $13:TPrimitive = "div"
63
- scope @2 [8:9] deps=[freeze y$12_@1:TFunction] {
63
+ scope @2 [8:9] deps=[freeze y$12_@1:TFunction] out=[] {
64
[8] Const mutate $15_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1:TFunction}</read $13:TPrimitive>
65
}
66
[9] Call mutate x$11_@0.push(read $15_@2)
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md
+1
-1
@@ -41,7 +41,7 @@ function foo(
41
b,
42
c,
43
) {
44
- scope @0 [1:8] deps=[read c$8, read b$7, read a$6] {
44
+ scope @0 [1:8] deps=[read c$8, read b$7, read a$6] out=[] {
45
[1] Const mutate x$9_@0:TFunction[1:8] = Array []
46
[2] Const mutate y$10_@0:TFunction[1:8] = Array []
47
while (
compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md
+1
-1
@@ -48,7 +48,7 @@ function foo(
48
b,
49
c,
50
) {
51
- scope @0 [1:9] deps=[read a$6, read b$7, read c$8] {
51
+ scope @0 [1:9] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] {
52
[1] Const mutate x$9_@0:TFunction[1:9] = Array []
53
if (read a$6) {
54
[3] Const mutate y$10_@0:TFunction[1:9] = Array []
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+2
-2
@@ -32,14 +32,14 @@ bb0:
32
function Component(
33
props,
34
) {
35
- scope @0 [1:6] deps=[read props$6.p0] {
35
+ scope @0 [1:6] deps=[read props$6.p0] out=[x$7_@0, child$9_@0] {
36
[1] Const mutate x$7_@0:TObject[1:6] = Object { }
37
[2] Const mutate y$8_@0[1:6] = Array []
38
[3] Reassign mutate x$7_@0.y[1:6] = read y$8_@0
39
[4] Const mutate child$9_@0[1:6] = JSX <read Component$0 data={freeze y$8_@0} ></read Component$0>
40
[5] Call mutate x$7_@0.y.push(read props$6.p0)
41
}
42
- scope @1 [6:7] deps=[freeze x$7_@0:TObject, read child$9_@0] {
42
+ scope @1 [6:7] deps=[freeze x$7_@0:TObject, read child$9_@0] out=[$10_@1] {
43
[6] Const mutate $10_@1 = JSX <read Component$0 data={freeze x$7_@0:TObject} >{read child$9_@0}</read Component$0>
44
}
45
return read $10_@1
compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md
+2
-2
@@ -31,9 +31,9 @@ bb0:
31
```
32
function foo(
33
) {
34
- scope @0 [1:6] deps=[] {
34
+ scope @0 [1:6] deps=[] out=[x$4_@0] {
35
[1] Const mutate x$4_@0:TObject[1:6] = Object { }
36
- scope @1 [2:5] deps=[] {
36
+ scope @1 [2:5] deps=[] out=[] {
37
[2] Const mutate y$5_@1:TFunction[2:5] = Array []
38
[3] Const mutate z$6_@1:TObject[2:5] = Object { }
39
[4] Call mutate y$5_@1.push(mutate z$6_@1:TObject)
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md
+3
-3
@@ -47,15 +47,15 @@ function foo(
47
b,
48
c,
49
) {
50
- scope @0 [1:11] deps=[read a$8, read b$9, read c$10] {
50
+ scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] {
51
[1] Const mutate x$11_@0:TFunction[1:11] = Array []
52
if (read a$8) {
53
- scope @1 [3:5] deps=[read b$9] {
53
+ scope @1 [3:5] deps=[read b$9] out=[y$12_@1] {
54
[3] Const mutate y$12_@1:TFunction[3:5] = Array []
55
[4] Call mutate y$12_@1.push(read b$9)
56
}
57
[5] Const mutate $13:TPrimitive = "div"
58
- scope @2 [6:7] deps=[freeze y$12_@1:TFunction] {
58
+ scope @2 [6:7] deps=[freeze y$12_@1:TFunction] out=[] {
59
[6] Const mutate $14_@2 = JSX <read $13:TPrimitive>{freeze y$12_@1:TFunction}</read $13:TPrimitive>
60
}
61
[7] Call mutate x$11_@0.push(read $14_@2)
compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md
+2
-2
@@ -44,7 +44,7 @@ function f(
44
a,
45
b,
46
) {
47
- scope @0 [1:8] deps=[read a$8.length, read b$9] {
47
+ scope @0 [1:8] deps=[read a$8.length, read b$9] out=[x$10_@0] {
48
[1] Const mutate x$10_@0:TFunction[1:8] = Array []
49
[2] Const mutate $11:TPrimitive = 1
50
[3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive
@@ -55,7 +55,7 @@ function f(
55
}
56
}
57
[8] Const mutate $13:TPrimitive = "div"
58
- scope @1 [9:10] deps=[freeze x$10_@0:TFunction] {
58
+ scope @1 [9:10] deps=[freeze x$10_@0:TFunction] out=[$15_@1] {
59
[9] Const mutate $15_@1 = JSX <read $13:TPrimitive>{freeze x$10_@0:TFunction}</read $13:TPrimitive>
60
}
61
return read $15_@1
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+3
-3
@@ -45,7 +45,7 @@ bb1:
45
function Component(
46
props,
47
) {
48
- scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] {
48
+ scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[x$7_@0] {
49
[1] Let mutate x$7_@0:TFunction[1:7] = Array []
50
[2] Call mutate x$7_@0.push(read props$6.p0)
51
[3] Const mutate y$8:TFunction = read x$7_@0:TFunction
@@ -53,11 +53,11 @@ function Component(
53
[5] Reassign mutate x$7_@0:TFunction[1:7] = Array []
54
}
55
}
56
- scope @1 [7:8] deps=[freeze x$7_@0:TFunction] {
56
+ scope @1 [7:8] deps=[freeze x$7_@0:TFunction] out=[] {
57
[7] Const mutate _$12_@1 = JSX <read Component$0 x={freeze x$7_@0:TFunction} ></read Component$0>
58
}
59
[8] Call read y$8.push(read props$6.p2)
60
- scope @2 [9:10] deps=[read x$7_@0:TFunction, read y$8:TFunction] {
60
+ scope @2 [9:10] deps=[read x$7_@0:TFunction, read y$8:TFunction] out=[$15_@2] {
61
[9] Const mutate $15_@2 = JSX <read Component$0 x={read x$7_@0:TFunction} y={read y$8:TFunction} ></read Component$0>
62
}
63
return read $15_@2
compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md
+4
-4
@@ -78,18 +78,18 @@ function foo(
78
b,
79
c,
80
) {
81
- scope @0 [1:5] deps=[read a$13] {
81
+ scope @0 [1:5] deps=[read a$13] out=[x$16_@0] {
82
[1] Const mutate x$16_@0:TFunction[1:5] = Array []
83
if (read a$13) {
84
[3] Call mutate x$16_@0.push(read a$13)
85
}
86
}
87
[5] Const mutate $17:TPrimitive = "div"
88
- scope @1 [6:7] deps=[freeze x$16_@0:TFunction] {
88
+ scope @1 [6:7] deps=[freeze x$16_@0:TFunction] out=[y$19_@1] {
89
[6] Const mutate y$19_@1 = JSX <read $17:TPrimitive>{freeze x$16_@0:TFunction}</read $17:TPrimitive>
90
}
91
[7] Const mutate $20:TPrimitive = 0
92
- scope @2 [8:15] deps=[read b$14, read c$15] {
92
+ scope @2 [8:15] deps=[read b$14, read c$15] out=[x$22_@2] {
93
[8] Let mutate x$22_@2:TFunction[8:15] = undefined
94
switch (read b$14) {
95
case read $20:TPrimitive: {
@@ -107,7 +107,7 @@ function foo(
107
[16] Const mutate $26 = "\n "
108
[17] Const mutate $27 = "\n "
109
[18] Const mutate $28 = "\n "
110
- scope @3 [19:20] deps=[read y$19_@1] {
110
+ scope @3 [19:20] deps=[read y$19_@1, freeze x$22_@2:TFunction] out=[$31_@3] {
111
[19] Const mutate $31_@3 = JSX <read $25:TPrimitive>{read $26}{read y$19_@1}{read $27}{freeze x$22_@2:TFunction}{read $28}</read $25:TPrimitive>
112
}
113
return read $31_@3
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+4
-4
@@ -37,19 +37,19 @@ bb0:
37
function Component(
38
props,
39
) {
40
- scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] {
40
+ scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[y$8_@0] {
41
[1] Const mutate x$7_@0:TFunction[1:7] = Array []
42
[2] Call mutate x$7_@0.push(read props$6.p0)
43
[3] Const mutate y$8_@0:TFunction[1:7] = read x$7_@0:TFunction
44
- scope @1 [4:5] deps=[] {
44
+ scope @1 [4:5] deps=[] out=[x$9_@1] {
45
[4] Const mutate x$9_@1 = Array []
46
}
47
- scope @2 [5:6] deps=[freeze x$9_@1] {
47
+ scope @2 [5:6] deps=[freeze x$9_@1] out=[] {
48
[5] Const mutate _$10_@2 = JSX <read Component$0 x={freeze x$9_@1} ></read Component$0>
49
}
50
[6] Call mutate y$8_@0.push(read props$6.p1)
51
}
52
- scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0:TFunction] {
52
+ scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0:TFunction] out=[$11_@3] {
53
[7] Const mutate $11_@3 = JSX <read Component$0 x={read x$9_@1} y={freeze y$8_@0:TFunction} ></read Component$0>
54
}
55
return read $11_@3
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+1
-1
@@ -86,7 +86,7 @@ function Component(
86
props,
87
) {
88
[1] Const mutate x$7:TPrimitive = undefined
89
- 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] {
89
+ 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$11_@0] {
90
[2] Let mutate x$11_@0:TProp[2:18] = undefined
91
if (read props$6.cond) {
92
[3] Const mutate $8:TPrimitive = 2
compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md
+2
-2
@@ -58,10 +58,10 @@ bb0:
58
```
59
function foo(
60
) {
61
- scope @0 [1:2] deps=[] {
61
+ scope @0 [1:2] deps=[] out=[] {
62
[1] Const mutate a$5_@0:TObject = Object { }
63
}
64
- scope @1 [2:8] deps=[] {
64
+ scope @1 [2:8] deps=[] out=[c$10_@1] {
65
[2] Const mutate b$6_@1:TObject[2:8] = Object { }
66
[3] Const mutate c$7_@1:TObject[2:8] = Object { }
67
[4] Const mutate a$8_@1:TObject[2:8] = read b$6_@1:TObject
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
+2
-2
@@ -38,14 +38,14 @@ function foo(
38
) {
39
if (read x$8) {
40
[2] Const mutate $10:TPrimitive = false
41
- scope @0 [3:4] deps=[read y$9:TPrimitive] {
41
+ scope @0 [3:4] deps=[read y$9:TPrimitive] out=[$11_@0] {
42
[3] Const mutate $11_@0 = Call read foo$0:TFunction(read $10:TPrimitive, read y$9:TPrimitive)
43
}
44
return freeze $11_@0
45
}
46
[5] Const mutate $12:TPrimitive = 10
47
[6] Const mutate $13:TPrimitive = Binary read y$9:TPrimitive * read $12:TPrimitive
48
- scope @1 [7:8] deps=[] {
48
+ scope @1 [7:8] deps=[] out=[$14_@1] {
49
[7] Const mutate $14_@1 = Array [read $13:TPrimitive]
50
}
51
return freeze $14_@1
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
+1
-1
@@ -29,7 +29,7 @@ function Component(
29
) {
30
[1] Const mutate a$6:TPrimitive = 1
31
[2] Const mutate b$7:TPrimitive = 2
32
- scope @0 [3:4] deps=[] {
32
+ scope @0 [3:4] deps=[] out=[x$8_@0] {
33
[3] Const mutate x$8_@0 = Array [read a$6:TPrimitive, read b$7:TPrimitive]
34
}
35
return freeze x$8_@0
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
+4
-4
@@ -69,23 +69,23 @@ bb1:
69
function Component(
70
props,
71
) {
72
- scope @0 [1:10] deps=[] {
72
+ scope @0 [1:10] deps=[] out=[a$11_@0, b$12_@0] {
73
[1] Const mutate a$11_@0[1:10] = Array []
74
[2] Const mutate b$12_@0:TObject[1:10] = Object { }
75
[3] Call mutate foo$4:TFunction(mutate a$11_@0, mutate b$12_@0:TObject)
76
- scope @1 [4:5] deps=[] {
76
+ scope @1 [4:5] deps=[] out=[] {
77
[4] Const mutate $13_@1 = Call mutate foo$4:TFunction()
78
}
79
if (read $13_@1) {
80
[6] Const mutate $14:TPrimitive = "div"
81
- scope @2 [7:8] deps=[freeze a$11_@0] {
81
+ scope @2 [7:8] deps=[freeze a$11_@0] out=[] {
82
[7] Const mutate _$15_@2 = JSX <read $14:TPrimitive a={freeze a$11_@0} ></read $14:TPrimitive>
83
}
84
}
85
[9] Call mutate foo$4:TFunction(read a$11_@0, mutate b$12_@0:TObject)
86
}
87
[10] Const mutate $19:TPrimitive = "div"
88
- scope @3 [11:12] deps=[freeze a$11_@0, freeze b$12_@0:TObject] {
88
+ scope @3 [11:12] deps=[freeze a$11_@0, freeze b$12_@0:TObject] out=[$20_@3] {
89
[11] Const mutate $20_@3 = JSX <read $19:TPrimitive a={freeze a$11_@0} b={freeze b$12_@0:TObject} ></read $19:TPrimitive>
90
}
91
return read $20_@3
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
+3
-3
@@ -59,18 +59,18 @@ bb0:
59
function Component(
60
props,
61
) {
62
- scope @0 [1:7] deps=[] {
62
+ scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] {
63
[1] Const mutate a$10_@0[1:7] = Array []
64
[2] Const mutate b$11_@0:TObject[1:7] = Object { }
65
[3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject)
66
[4] Const mutate $12:TPrimitive = "div"
67
- scope @1 [5:6] deps=[freeze a$10_@0] {
67
+ scope @1 [5:6] deps=[freeze a$10_@0] out=[] {
68
[5] Const mutate _$13_@1 = JSX <read $12:TPrimitive a={freeze a$10_@0} ></read $12:TPrimitive>
69
}
70
[6] Call mutate foo$4:TFunction(read a$10_@0, mutate b$11_@0:TObject)
71
}
72
[7] Const mutate $14:TPrimitive = "div"
73
- scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] {
73
+ scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] {
74
[8] Const mutate $15_@2 = JSX <read $14:TPrimitive a={read a$10_@0} b={freeze b$11_@0:TObject} ></read $14:TPrimitive>
75
}
76
return read $15_@2
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
+1
-1
@@ -50,7 +50,7 @@ bb3:
50
```
51
function foo(
52
) {
53
- scope @0 [1:13] deps=[] {
53
+ scope @0 [1:13] deps=[] out=[x$7_@0] {
54
[1] Let mutate x$7_@0:TPrimitive[1:13] = 1
55
[2] Const mutate y$8:TPrimitive = 2
56
[3] Const mutate $9:TPrimitive = 2
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
+1
-1
@@ -38,7 +38,7 @@ bb1:
38
```
39
function foo(
40
) {
41
- scope @0 [1:8] deps=[] {
41
+ scope @0 [1:8] deps=[] out=[x$5_@0] {
42
[1] Let mutate x$5_@0:TPrimitive[1:8] = 1
43
[2] Const mutate y$6:TPrimitive = 2
44
[3] Const mutate $7:TPrimitive = 2
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
+1
-1
@@ -46,7 +46,7 @@ bb2:
46
function foo(
47
cond,
48
) {
49
- scope @0 [1:2] deps=[] {
49
+ scope @0 [1:2] deps=[] out=[] {
50
[1] Const mutate items$5_@0 = Array []
51
}
52
}
compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md
+1
-1
@@ -46,7 +46,7 @@ bb2:
46
```
47
function foo(
48
) {
49
- scope @0 [1:13] deps=[] {
49
+ scope @0 [1:13] deps=[] out=[x$6_@0] {
50
[1] Let mutate x$6_@0:TPrimitive[1:13] = 1
51
for (
52
[3] Const mutate i$7:TPrimitive = 0
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
+1
-1
@@ -48,7 +48,7 @@ bb2:
48
```
49
function foo(
50
) {
51
- scope @1 [1:15] deps=[] {
51
+ scope @1 [1:15] deps=[] out=[x$7_@1] {
52
[1] Let mutate x$7_@1:TPrimitive[1:15] = 1
53
for (
54
[3] Let mutate i$8_@1:TPrimitive[1:15] = 0
compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md
+5
-7
@@ -19,7 +19,7 @@ function foo(a, b, c, d) {
19
}
20
x;
21
}
22
- x;
22
+ return x;
23
}
24
25
```
@@ -66,8 +66,7 @@ bb7:
66
[19] Goto bb1
67
bb1:
68
predecessor blocks: bb3 bb7
69
- [20] read x$18_@0
70
- [21] Return
69
+ [20] Return read x$18_@0
70
```
71
72
## Reactive Scopes
@@ -81,7 +80,7 @@ function foo(
80
) {
81
[1] Const mutate x$13:TPrimitive = 0
82
[2] Const mutate $14:TPrimitive = true
84
- scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] {
83
+ scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] out=[x$18_@0] {
84
[3] Let mutate x$18_@0[3:20] = undefined
85
if (read $14:TPrimitive) {
86
[4] Const mutate $15:TPrimitive = true
@@ -101,8 +100,7 @@ function foo(
100
[18] read x$18_@0
101
}
102
}
104
- [20] read x$18_@0
105
- return
103
+ return read x$18_@0
104
}
105
106
```
@@ -131,7 +129,7 @@ function foo$0(a$9, b$10, c$11, d$12) {
129
x$18;
130
}
131
134
- x$18;
132
+ return x$18;
133
}
134
135
```
compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.js
+1
-1
@@ -15,5 +15,5 @@ function foo(a, b, c, d) {
15
}
16
x;
17
}
18
- x;
18
+ return x;
19
}
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md
+1
-1
@@ -44,7 +44,7 @@ function foo(
44
b,
45
c,
46
) {
47
- scope @0 [1:8] deps=[read a$5, read b$6, read c$7] {
47
+ scope @0 [1:8] deps=[read a$5, read b$6, read c$7] out=[] {
48
[1] Const mutate x$8_@0[1:8] = read a$5
49
if (read b$6) {
50
if (read c$7) {
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md
+1
-1
@@ -48,7 +48,7 @@ function foo(
48
d,
49
e,
50
) {
51
- scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] {
51
+ scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] out=[x$12_@0] {
52
[1] Let mutate x$12_@0:TPrimitive[1:8] = null
53
if (read a$7) {
54
[3] Reassign mutate x$12_@0:TPrimitive[1:8] = read b$8
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
+1
-1
@@ -52,7 +52,7 @@ bb0:
52
function Component(
53
props,
54
) {
55
- scope @0 [1:4] deps=[] {
55
+ scope @0 [1:4] deps=[] out=[c$9_@0] {
56
[1] Const mutate a$7_@0[1:4] = Array []
57
[2] Const mutate b$8_@0:TObject[1:4] = Object { }
58
[3] Const mutate c$9_@0[1:4] = New mutate Foo$5(mutate a$7_@0, mutate b$8_@0:TObject)
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
+2
-2
@@ -46,7 +46,7 @@ bb1:
46
```
47
function foo(
48
) {
49
- scope @0 [1:10] deps=[] {
49
+ scope @0 [1:10] deps=[] out=[x$6_@0] {
50
[1] Let mutate x$6_@0:TPrimitive[1:10] = 1
51
[2] Let mutate y$7_@0:TPrimitive[1:10] = 2
52
[3] Const mutate $8:TPrimitive = 1
@@ -57,7 +57,7 @@ function foo(
57
[8] Reassign mutate y$7_@0:TPrimitive[1:10] = 3
58
}
59
}
60
- scope @2 [10:11] deps=[] {
60
+ scope @2 [10:11] deps=[read x$6_@0:TPrimitive, read y$7_@0:TPrimitive] out=[t$14_@2] {
61
[10] Const mutate t$14_@2:TObject = Object { x: read x$6_@0:TPrimitive, y: read y$7_@0:TPrimitive }
62
}
63
return freeze t$14_@2:TObject
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
+1
-1
@@ -29,7 +29,7 @@ function Component(
29
) {
30
[1] Const mutate a$6:TPrimitive = 1
31
[2] Const mutate b$7:TPrimitive = 2
32
- scope @0 [3:4] deps=[] {
32
+ scope @0 [3:4] deps=[] out=[x$8_@0] {
33
[3] Const mutate x$8_@0:TObject = Object { a: read a$6:TPrimitive, b: read b$7:TPrimitive }
34
}
35
return freeze x$8_@0:TObject
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md
+1
-1
@@ -47,7 +47,7 @@ bb1:
47
function foo(
48
a,
49
) {
50
- scope @0 [1:11] deps=[read a$7] {
50
+ scope @0 [1:11] deps=[read a$7] out=[x$9_@0] {
51
[1] Const mutate b$8_@0:TObject[1:11] = Object { }
52
[2] Const mutate x$9_@0:TObject[1:11] = read b$8_@0:TObject
53
if (read a$7) {
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md
+3
-3
@@ -43,15 +43,15 @@ bb1:
43
function foo(
44
a,
45
) {
46
- scope @0 [1:9] deps=[read a$5] {
46
+ scope @0 [1:9] deps=[read a$5] out=[x$6_@0] {
47
[1] Const mutate x$6_@0:TObject[1:9] = Object { }
48
if (read a$5) {
49
- scope @1 [3:4] deps=[] {
49
+ scope @1 [3:4] deps=[] out=[] {
50
[3] Const mutate y$7_@1:TObject = Object { }
51
}
52
[4] Reassign mutate x$6_@0.y[1:9] = read y$7_@1:TObject
53
} else {
54
- scope @2 [6:7] deps=[] {
54
+ scope @2 [6:7] deps=[] out=[] {
55
[6] Const mutate z$8_@2:TObject = Object { }
56
}
57
[7] Reassign mutate x$6_@0.z[1:9] = read z$8_@2:TObject
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md
+1
-1
@@ -45,7 +45,7 @@ bb1:
45
function foo(
46
a,
47
) {
48
- scope @0 [1:10] deps=[read a$6] {
48
+ scope @0 [1:10] deps=[read a$6] out=[x$7_@0] {
49
[1] Const mutate x$7_@0:TObject[1:10] = Object { }
50
if (read a$6) {
51
[3] Const mutate y$8_@0:TObject[1:10] = Object { }
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md
+2
-2
@@ -45,14 +45,14 @@ bb1:
45
function foo(
46
a,
47
) {
48
- scope @0 [1:10] deps=[read a$6] {
48
+ scope @0 [1:10] deps=[read a$6] out=[x$7_@0] {
49
[1] Const mutate x$7_@0:TObject[1:10] = Object { }
50
if (read a$6) {
51
[3] Const mutate y$8_@0:TObject[1:10] = Object { }
52
[4] Reassign mutate x$7_@0.y[1:10] = read y$8_@0:TObject
53
[5] Call mutate mutate$4:TFunction(mutate y$8_@0:TObject)
54
} else {
55
- scope @1 [7:8] deps=[] {
55
+ scope @1 [7:8] deps=[] out=[] {
56
[7] Const mutate z$9_@1:TObject = Object { }
57
}
58
[8] Reassign mutate x$7_@0.z[1:10] = read z$9_@1:TObject
compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md
+1
-1
@@ -32,7 +32,7 @@ bb0:
32
```
33
function foo(
34
) {
35
- scope @0 [1:6] deps=[] {
35
+ scope @0 [1:6] deps=[] out=[y$7_@0] {
36
[1] Const mutate a$5_@0:TObject[1:6] = Object { }
37
[2] Const mutate x$6_@0:TObject[1:6] = read a$5_@0:TObject
38
[3] Const mutate y$7_@0:TObject[1:6] = Object { }
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
+2
-2
@@ -27,10 +27,10 @@ bb0:
27
```
28
function foo(
29
) {
30
- scope @0 [1:2] deps=[] {
30
+ scope @0 [1:2] deps=[] out=[x$4_@0] {
31
[1] Const mutate x$4_@0 = Array []
32
}
33
- scope @1 [2:5] deps=[read x$4_@0] {
33
+ scope @1 [2:5] deps=[read x$4_@0] out=[y$5_@1] {
34
[2] Const mutate y$5_@1:TObject[2:5] = Object { x: read x$4_@0 }
35
[3] Const mutate $6_@1[2:5] = Array []
36
[4] Call mutate y$5_@1.x.push(mutate $6_@1)
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md
+1
-1
@@ -28,7 +28,7 @@ bb0:
28
```
29
function foo(
30
) {
31
- scope @0 [1:5] deps=[] {
31
+ scope @0 [1:5] deps=[] out=[y$5_@0] {
32
[1] Const mutate x$4_@0[1:5] = Array []
33
[2] Const mutate y$5_@0:TObject[1:5] = Object { }
34
[3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md
+1
-1
@@ -32,7 +32,7 @@ bb0:
32
```
33
function foo(
34
) {
35
- scope @0 [1:6] deps=[] {
35
+ scope @0 [1:6] deps=[] out=[y$6_@0] {
36
[1] Const mutate a$5_@0:TObject[1:6] = Object { }
37
[2] Const mutate y$6_@0:TObject[1:6] = read a$5_@0:TObject
38
[3] Const mutate x$7_@0[1:6] = Array []
compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md
+1
-1
@@ -28,7 +28,7 @@ bb0:
28
```
29
function foo(
30
) {
31
- scope @0 [1:5] deps=[] {
31
+ scope @0 [1:5] deps=[] out=[y$5_@0] {
32
[1] Const mutate x$4_@0[1:5] = Array []
33
[2] Const mutate y$5_@0:TObject[1:5] = Object { }
34
[3] Reassign mutate y$5_@0.x[1:5] = read x$4_@0
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
+2
-2
@@ -26,10 +26,10 @@ bb0:
26
```
27
function foo(
28
) {
29
- scope @0 [1:2] deps=[] {
29
+ scope @0 [1:2] deps=[] out=[x$3_@0] {
30
[1] Const mutate x$3_@0 = Array []
31
}
32
- scope @1 [2:4] deps=[read x$3_@0] {
32
+ scope @1 [2:4] deps=[read x$3_@0] out=[y$4_@1] {
33
[2] Const mutate y$4_@1:TObject[2:4] = Object { }
34
[3] Reassign mutate y$4_@1.x[2:4] = read x$3_@0
35
}
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
+1
-1
@@ -35,7 +35,7 @@ bb1:
35
```
36
function foo(
37
) {
38
- scope @0 [1:7] deps=[] {
38
+ scope @0 [1:7] deps=[] out=[x$4_@0] {
39
[1] Let mutate x$4_@0:TPrimitive[1:7] = 1
40
[2] Const mutate $5:TPrimitive = 1
41
[3] Const mutate $6:TPrimitive = Binary read x$4_@0:TPrimitive === read $5:TPrimitive
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
+1
-1
@@ -67,7 +67,7 @@ bb1:
67
function Foo(
68
cond,
69
) {
70
- scope @0 [1:8] deps=[read cond$5] {
70
+ scope @0 [1:8] deps=[read cond$5] out=[str$6_@0] {
71
[1] Let mutate str$6_@0:TPrimitive[1:8] = ""
72
if (read cond$5) {
73
[3] Const mutate str$7:TPrimitive = "other test"
compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md
+2
-2
@@ -83,7 +83,7 @@ function foo(
83
[2] Const mutate $14:TPrimitive = true
84
if (read $14:TPrimitive) {
85
[4] Const mutate $15:TPrimitive = true
86
- scope @0 [5:10] deps=[read a$9, read b$10] {
86
+ scope @0 [5:10] deps=[read a$9, read b$10] out=[x$16_@0] {
87
[5] Let mutate x$16_@0[5:10] = undefined
88
if (read $15:TPrimitive) {
89
[6] Reassign mutate x$16_@0[5:10] = read a$9
@@ -94,7 +94,7 @@ function foo(
94
[10] read x$16_@0
95
} else {
96
[12] Const mutate $19:TPrimitive = true
97
- scope @1 [13:18] deps=[read c$11, read d$12] {
97
+ scope @1 [13:18] deps=[read c$11, read d$12] out=[x$20_@1] {
98
[13] Let mutate x$20_@1[13:18] = undefined
99
if (read $19:TPrimitive) {
100
[14] Reassign mutate x$20_@1[13:18] = read c$11
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
+1
-1
@@ -47,7 +47,7 @@ function foo(
47
[1] Const mutate y$5:TPrimitive = 2
48
[2] Const mutate $6:TPrimitive = 1
49
[3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive
50
- scope @0 [4:9] deps=[] {
50
+ scope @0 [4:9] deps=[] out=[y$8_@0] {
51
[4] Let mutate y$8_@0:TPrimitive[4:9] = undefined
52
if (read $7:TPrimitive) {
53
[5] Reassign mutate y$8_@0:TPrimitive[4:9] = 1
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
+1
-1
@@ -70,7 +70,7 @@ function foo(
70
[3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive
71
[4] Const mutate $13:TPrimitive = 1
72
[5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive
73
- scope @0 [6:16] deps=[] {
73
+ scope @0 [6:16] deps=[] out=[x$16_@0] {
74
[6] Let mutate x$16_@0:TPrimitive[6:16] = undefined
75
switch (read x$10:TPrimitive) {
76
case read $14:TPrimitive: {
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
+1
-1
@@ -34,7 +34,7 @@ bb1:
34
```
35
function foo(
36
) {
37
- scope @0 [1:7] deps=[] {
37
+ scope @0 [1:7] deps=[] out=[x$4_@0] {
38
[1] Let mutate x$4_@0:TPrimitive[1:7] = 1
39
[2] Const mutate $5:TPrimitive = 1
40
[3] Const mutate $6:TPrimitive = Binary read x$4_@0:TPrimitive === read $5:TPrimitive
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
+1
-1
@@ -39,7 +39,7 @@ bb2:
39
```
40
function foo(
41
) {
42
- scope @0 [1:9] deps=[] {
42
+ scope @0 [1:9] deps=[] out=[x$5_@0] {
43
[1] Let mutate x$5_@0:TPrimitive[1:9] = 1
44
while (
45
[3] Const mutate $6:TPrimitive = 10
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+3
-3
@@ -66,7 +66,7 @@ bb1:
66
function Component(
67
props,
68
) {
69
- scope @1 [1:12] deps=[read props$9.p0, read props$9.p2] {
69
+ scope @1 [1:12] deps=[read props$9.p0, read props$9.p2] out=[x$10_@1] {
70
[1] Const mutate x$10_@1:TFunction[1:12] = Array []
71
[2] Let mutate y$11_@1:TPrimitive[1:12] = undefined
72
[3] Const mutate $12:TPrimitive = false
@@ -89,11 +89,11 @@ function Component(
89
}
90
}
91
}
92
- scope @2 [12:13] deps=[freeze x$10_@1:TFunction] {
92
+ scope @2 [12:13] deps=[freeze x$10_@1:TFunction] out=[child$19_@2] {
93
[12] Const mutate child$19_@2 = JSX <read Component$0 data={freeze x$10_@1:TFunction} ></read Component$0>
94
}
95
[13] Call read y$11_@1.push(read props$9.p4)
96
- scope @3 [14:15] deps=[read child$19_@2] {
96
+ scope @3 [14:15] deps=[freeze y$11_@1:TPrimitive, read child$19_@2] out=[$22_@3] {
97
[14] Const mutate $22_@3 = JSX <read Component$0 data={freeze y$11_@1:TPrimitive} >{read child$19_@2}</read Component$0>
98
}
99
return read $22_@3
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+4
-4
@@ -60,7 +60,7 @@ bb1:
60
function Component(
61
props,
62
) {
63
- scope @1 [1:12] deps=[read props$8.p0, read props$8.p2, read props$8.p3] {
63
+ scope @1 [1:12] deps=[read props$8.p0, read props$8.p2, read props$8.p3] out=[x$9_@1] {
64
[1] Const mutate x$9_@1:TFunction[1:12] = Array []
65
[2] Let mutate y$10_@1:TPrimitive[1:12] = undefined
66
[3] Const mutate $11:TPrimitive = false
@@ -69,7 +69,7 @@ function Component(
69
case read $12:TPrimitive: {
70
[6] Call mutate x$9_@1.push(read props$8.p2)
71
[7] Call mutate x$9_@1.push(read props$8.p3)
72
- scope @2 [8:9] deps=[] {
72
+ scope @2 [8:9] deps=[] out=[] {
73
[8] Const mutate y$13_@2 = Array []
74
}
75
}
@@ -78,11 +78,11 @@ function Component(
78
}
79
}
80
}
81
- scope @3 [12:13] deps=[freeze x$9_@1:TFunction] {
81
+ scope @3 [12:13] deps=[freeze x$9_@1:TFunction] out=[child$19_@3] {
82
[12] Const mutate child$19_@3 = JSX <read Component$0 data={freeze x$9_@1:TFunction} ></read Component$0>
83
}
84
[13] Call read y$10_@1.push(read props$8.p4)
85
- scope @4 [14:15] deps=[read child$19_@3] {
85
+ scope @4 [14:15] deps=[read y$10_@1:TPrimitive, read child$19_@3] out=[$23_@4] {
86
[14] Const mutate $23_@4 = JSX <read Component$0 data={read y$10_@1:TPrimitive} >{read child$19_@3}</read Component$0>
87
}
88
return read $23_@4
compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md
+1
-1
@@ -37,7 +37,7 @@ bb0:
37
```
38
function component(
39
) {
40
- scope @0 [1:9] deps=[] {
40
+ scope @0 [1:9] deps=[] out=[] {
41
[1] Const mutate x$6_@0:TObject[1:9] = Object { }
42
[2] Const mutate p$7_@0:TObject[1:9] = Object { }
43
[3] Const mutate q$8_@0:TObject[1:9] = Object { }
compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md
+1
-1
@@ -34,7 +34,7 @@ function component(
34
) {
35
[1] Const mutate $7:TPrimitive = Binary read a$5:TPrimitive > read b$6:TPrimitive
36
if (read $7:TPrimitive) {
37
- scope @0 [3:4] deps=[] {
37
+ scope @0 [3:4] deps=[] out=[] {
38
[3] Const mutate m$8_@0:TObject = Object { }
39
}
40
}
compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md
+3
-3
@@ -34,15 +34,15 @@ bb1:
34
```
35
function component(
36
) {
37
- scope @0 [1:2] deps=[] {
37
+ scope @0 [1:2] deps=[] out=[a$7_@0] {
38
[1] Const mutate a$7_@0:TPrimitive = Call mutate some$2:TFunction()
39
}
40
- scope @1 [2:3] deps=[] {
40
+ scope @1 [2:3] deps=[] out=[b$8_@1] {
41
[2] Const mutate b$8_@1:TPrimitive = Call mutate someOther$4:TFunction()
42
}
43
[3] Const mutate $9:TPrimitive = Binary read a$7_@0:TPrimitive > read b$8_@1:TPrimitive
44
if (read $9:TPrimitive) {
45
- scope @2 [5:6] deps=[] {
45
+ scope @2 [5:6] deps=[] out=[] {
46
[5] Const mutate m$10_@2:TObject = Object { }
47
}
48
}
compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md
+1
-1
@@ -25,7 +25,7 @@ bb0:
25
function component(
26
) {
27
[1] Const mutate $4:TPrimitive = 1
28
- scope @0 [2:3] deps=[] {
28
+ scope @0 [2:3] deps=[] out=[x$5_@0] {
29
[2] Const mutate x$5_@0:TObject = Object { t: read $4:TPrimitive }
30
}
31
[3] Const mutate p$6:TPrimitive = read x$5_@0.t
compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md
+3
-3
@@ -38,13 +38,13 @@ bb1:
38
```
39
function component(
40
) {
41
- scope @0 [1:2] deps=[] {
41
+ scope @0 [1:2] deps=[] out=[$10_@0] {
42
[1] Const mutate $10_@0:TPrimitive = Call mutate makeSomePrimitive$2:TFunction()
43
}
44
- scope @1 [2:3] deps=[] {
44
+ scope @1 [2:3] deps=[] out=[$11_@1] {
45
[2] Const mutate $11_@1:TPrimitive = Call mutate makeSomePrimitive$2:TFunction()
46
}
47
- scope @2 [3:4] deps=[read $10_@0:TPrimitive, read $11_@1:TPrimitive] {
47
+ scope @2 [3:4] deps=[read $10_@0:TPrimitive, read $11_@1:TPrimitive] out=[x$12_@2] {
48
[3] Const mutate x$12_@2:TObject = Object { u: read $10_@0:TPrimitive, v: read $11_@1:TPrimitive }
49
}
50
[4] Const mutate u$13:TPrimitive = read x$12_@2.u
compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md
+2
-2
@@ -27,9 +27,9 @@ bb0:
27
```
28
function component(
29
) {
30
- scope @0 [1:4] deps=[] {
30
+ scope @0 [1:4] deps=[] out=[x$4_@0] {
31
[1] Const mutate x$4_@0:TObject[1:4] = Object { }
32
- scope @1 [2:3] deps=[] {
32
+ scope @1 [2:3] deps=[] out=[] {
33
[2] Const mutate q$5_@1:TObject = Object { }
34
}
35
[3] Reassign mutate x$4_@0.t[1:4] = read q$5_@1:TObject
compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md
+3
-3
@@ -38,14 +38,14 @@ bb0:
38
```
39
function component(
40
) {
41
- scope @0 [1:2] deps=[] {
41
+ scope @0 [1:2] deps=[] out=[p$7_@0] {
42
[1] Const mutate p$7_@0:TPrimitive = Call mutate makePrimitive$2:TFunction()
43
}
44
[2] Binary read p$7_@0:TPrimitive + read p$7_@0:TPrimitive
45
- scope @1 [3:4] deps=[] {
45
+ scope @1 [3:4] deps=[] out=[o$8_@1] {
46
[3] Const mutate o$8_@1:TObject = Object { }
47
}
48
- scope @2 [4:8] deps=[read p$7_@0:TPrimitive, read o$8_@1:TObject] {
48
+ scope @2 [4:8] deps=[read p$7_@0:TPrimitive, read o$8_@1:TObject] out=[x$9_@2] {
49
[4] Const mutate x$9_@2:TObject[4:8] = Object { }
50
[5] Reassign mutate x$9_@2.t[4:8] = read p$7_@0:TPrimitive
51
[6] Const mutate z$10_@2:TPrimitive[4:8] = read x$9_@2.t
compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md
+4
-4
@@ -37,19 +37,19 @@ bb1:
37
```
38
function component(
39
) {
40
- scope @0 [1:2] deps=[] {
40
+ scope @0 [1:2] deps=[] out=[x$7_@0] {
41
[1] Const mutate x$7_@0:TPrimitive = Call mutate foo$2:TFunction()
42
}
43
- scope @1 [2:3] deps=[] {
43
+ scope @1 [2:3] deps=[] out=[y$8_@1] {
44
[2] Const mutate y$8_@1:TPrimitive = Call mutate foo$2:TFunction()
45
}
46
[3] Const mutate $9:TPrimitive = Binary read x$7_@0:TPrimitive > read y$8_@1:TPrimitive
47
if (read $9:TPrimitive) {
48
- scope @2 [5:6] deps=[] {
48
+ scope @2 [5:6] deps=[] out=[] {
49
[5] Const mutate z$10_@2:TObject = Object { }
50
}
51
}
52
- scope @3 [7:8] deps=[] {
52
+ scope @3 [7:8] deps=[] out=[] {
53
[7] Const mutate z$12_@3:TPrimitive = Call mutate foo$2:TFunction()
54
}
55
return