@samitouri / QOS-React / commits / e149413057

Distinguish identifier id and ssa id

I noticed on @kassens's #771 that despite running LeaveSSA there are still cases where we still reassign to a unique identifier: functions that have reassignment but no phi nodes, such as: ```javascript function foo() { let x$1 = 0; x$2 = x$1 + 1; } ``` Here SSA form rewrote the second statement's LHS, but bc there's no phi node we can't recover what the original was supposed to be (`x = x + 1`). This was my oversight when suggesting the simpler LeaveSSA algorithm, it works for eliminating phis but not other reassignments. The only alternative to removing SSA form is to add assignment statements, which we obviously don't want to do since that generates bloat. This PR addresses the issue by adding an additional, optional property to `Identifier` called `preSsaId` that starts off null. When entering SSA we save the original id in this property and update id to a new SSA value. LeaveSSA does the inverse, setting id = preSsaId and nulling out the latter. This means that an identifier can always be uniquely identified by its `id` value at any point in the compiler, while it's trivial to correctly undo SSA form. ```typescript type Identifier = { // Unique value for each original identifier id: IdentifierId; // The original, un-mangled variable name if this was a variable present in the source (null if it's generated) name: string | null; // When in SSA mode, this is set to the original, pre-SSA `id` value preSsaId: IdentifierId | null; } ```

Joseph Savona committed Nov 15, 2022 at 10:36 UTC e149413057b911ea82597251ccb3b023c0d3ac81
58 files changed +1259 -1261
compiler/forget/src/HIR/EliminateRedundantPhi.ts
+1 -2
@@ -6,8 +6,7 @@
6 */
7
8 import invariant from "invariant";
9 -import { assertExhaustive } from "../Common/utils";
10 -import { BlockId, HIRFunction, Identifier, Place, Terminal } from "./HIR";
9 +import { BlockId, HIRFunction, Identifier, Place } from "./HIR";
10 import { eachInstructionOperand, eachTerminalOperand } from "./visitors";
11
12 /**
compiler/forget/src/HIR/EnterSSA.ts
+11 -4
@@ -1,5 +1,12 @@
1 import { invariant } from "../CompilerError";
2 -import { BasicBlock, HIRFunction, Identifier, Phi, Place } from "./HIR";
2 +import {
3 + BasicBlock,
4 + HIRFunction,
5 + Identifier,
6 + IdentifierId,
7 + Phi,
8 + Place,
9 +} from "./HIR";
10 import { Environment } from "./HIRBuilder";
11 import { printIdentifier } from "./PrintHIR";
12 import {
@@ -28,7 +35,7 @@ class SSABuilder {
35 this.#env = env;
36 }
37
31 - get nextIdentifierId() {
38 + get nextSsaId(): IdentifierId {
39 return this.#env.nextIdentifierId;
40 }
41
@@ -42,7 +49,8 @@ class SSABuilder {
49
50 makeId(oldId: Identifier): Identifier {
51 return {
45 - id: this.nextIdentifierId,
52 + id: this.nextSsaId,
53 + preSsaId: oldId.id,
54 name: oldId.name,
55 mutableRange: {
56 start: 0,
@@ -121,7 +129,6 @@ class SSABuilder {
129 const phi: Phi = {
130 kind: "Phi",
131 id: newId,
124 - oldId,
132 operands: predDefs,
133 };
134
compiler/forget/src/HIR/HIR.ts
+10 -2
@@ -202,7 +202,6 @@ export type InstructionValue =
202 export type Phi = {
203 kind: "Phi";
204 id: Identifier;
205 - oldId: Identifier;
205 operands: Map<BasicBlock, Identifier>;
206 };
207
@@ -278,7 +277,8 @@ export type MutableRange = {
277 * Represents a user-defined variable (has a name) or a temporary variable (no name).
278 */
279 export type Identifier = {
281 - id: IdentifierId; // unique value to distinguish different instances of the same name in different scopes
280 + preSsaId: IdentifierId | null; // the original `id` value prior to entering SSA form
281 + id: IdentifierId; // unique value to distinguish a variable, since name is not guaranteed to exist or be unique
282 name: string | null; // null for temporaries. name is primarily used for debugging.
283 mutableRange: MutableRange;
284 };
@@ -344,3 +344,11 @@ export function makeScopeId(id: number): ScopeId {
344 */
345 const opaqueIdentifierId = Symbol();
346 export type IdentifierId = number & { [opaqueIdentifierId]: "IdentifierId" };
347 +
348 +export function makeIdentifierId(id: number): IdentifierId {
349 + invariant(
350 + id >= 0 && Number.isInteger(id),
351 + "Expected identifier id to be a non-negative integer"
352 + );
353 + return id as IdentifierId;
354 +}
compiler/forget/src/HIR/HIRBuilder.ts
+9 -10
@@ -17,6 +17,7 @@ import {
17 IdentifierId,
18 Instruction,
19 makeBlockId,
20 + makeIdentifierId,
21 Terminal,
22 } from "./HIR";
23 import { printInstruction } from "./PrintHIR";
@@ -61,16 +62,8 @@ function newBlock(id: BlockId): WipBlock {
62 export class Environment {
63 #nextIdentifer: number = 0;
64
64 - #makeIdentifierId(id: number): IdentifierId {
65 - invariant(
66 - id >= 0 && Number.isInteger(id),
67 - "Expected identifier id to be a non-negative integer"
68 - );
69 - return id as IdentifierId;
70 - }
71 -
65 get nextIdentifierId(): IdentifierId {
73 - return this.#makeIdentifierId(this.#nextIdentifer++);
66 + return makeIdentifierId(this.#nextIdentifer++);
67 }
68 }
69
@@ -116,6 +109,7 @@ export default class HIRBuilder {
109 makeTemporary(): Identifier {
110 const id = this.nextIdentifierId;
111 return {
112 + preSsaId: null,
113 id,
114 name: null,
115 mutableRange: { start: 0, end: 0 },
@@ -126,7 +120,12 @@ export default class HIRBuilder {
120 let identifier = this.#bindings.get(node);
121 if (identifier == null) {
122 const id = this.nextIdentifierId;
129 - identifier = { id, name: node.name, mutableRange: { start: 0, end: 0 } };
123 + identifier = {
124 + preSsaId: null,
125 + id,
126 + name: node.name,
127 + mutableRange: { start: 0, end: 0 },
128 + };
129 this.#bindings.set(node, identifier);
130 }
131 return identifier;
compiler/forget/src/HIR/LeaveSSA.ts
+8 -23
@@ -1,39 +1,24 @@
1 -import { BasicBlock, HIRFunction, Identifier, Phi, Place } from "./HIR";
1 +import { HIRFunction } from "./HIR";
2 import { eachBlockOperand } from "./visitors";
3
4 /**
5 - * Leaves SSA form by building up a mapping of SSA'd {@link Identifier}s to their original
6 - * {@link Identifier}, then rewriting all {@link Place}s within a {@link BasicBlock} to reference
7 - * the original id. This allows us to skip adding instruction copies when removing {@link Phi}s,
8 - * while still allowing shadowing to work.
5 + * Removes SSA form by restoring each `Identifier.id` value to its pre-SSA value,
6 + * and removing all phi nodes.
7 */
8 export default function leaveSSA(fn: HIRFunction) {
9 const ir = fn.body;
12 - const originalIdMap = new Map<
13 - /* SSA'd id */ Identifier,
14 - /* original id*/ Identifier
15 - >();
10
17 - for (const [, block] of ir.blocks) {
18 - for (const phi of block.phis) {
19 - originalIdMap.set(phi.id, phi.oldId);
20 - for (const [, ssaId] of phi.operands) {
21 - originalIdMap.set(ssaId, phi.oldId);
22 - }
23 - }
24 - block.phis.clear();
11 + for (const param of fn.params) {
12 + param.identifier.id = param.identifier.preSsaId ?? param.identifier.id;
13 }
14
27 - if (originalIdMap.size === 0) {
28 - return;
15 + for (const [, block] of ir.blocks) {
16 + block.phis.clear();
17 }
18
19 for (const [, block] of ir.blocks) {
20 for (const place of eachBlockOperand(block)) {
33 - const originalId = originalIdMap.get(place.identifier);
34 - if (originalId != null) {
35 - place.identifier = originalId;
36 - }
21 + place.identifier.id = place.identifier.preSsaId ?? place.identifier.id;
22 }
23 }
24 }
compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md
+29 -29
@@ -20,13 +20,13 @@ function g(a) {
20
21 ```
22 bb0:
23 - [1] Let mutate x$5 = 1
24 - [2] Const mutate $6 = 1
25 - [3] Reassign mutate x$7 = Binary read x$5 + read $6
26 - [4] Const mutate $8 = 1
27 - [5] Reassign mutate x$9 = Binary read x$7 + read $8
28 - [6] Const mutate $10 = 1
29 - [7] Reassign mutate x$11 = Binary read x$9 >>> read $10
23 + [1] Let mutate x$1 = 1
24 + [2] Const mutate $2 = 1
25 + [3] Reassign mutate x$1 = Binary read x$1 + read $2
26 + [4] Const mutate $3 = 1
27 + [5] Reassign mutate x$1 = Binary read x$1 + read $3
28 + [6] Const mutate $4 = 1
29 + [7] Reassign mutate x$1 = Binary read x$1 >>> read $4
30 Return
31 ```
32
@@ -37,13 +37,13 @@ flowchart TB
37 %% Basic Blocks
38 subgraph bb0
39 bb0_instrs["
40 - [1] Let mutate x$5 = 1
41 - [2] Const mutate $6 = 1
42 - [3] Reassign mutate x$7 = Binary read x$5 + read $6
43 - [4] Const mutate $8 = 1
44 - [5] Reassign mutate x$9 = Binary read x$7 + read $8
45 - [6] Const mutate $10 = 1
46 - [7] Reassign mutate x$11 = Binary read x$9 >>> read $10
40 + [1] Let mutate x$1 = 1
41 + [2] Const mutate $2 = 1
42 + [3] Reassign mutate x$1 = Binary read x$1 + read $2
43 + [4] Const mutate $3 = 1
44 + [5] Reassign mutate x$1 = Binary read x$1 + read $3
45 + [6] Const mutate $4 = 1
46 + [7] Reassign mutate x$1 = Binary read x$1 >>> read $4
47 "]
48 bb0_instrs --> bb0_terminal(["Return"])
49 end
@@ -56,10 +56,10 @@ flowchart TB
56
57 ```javascript
58 function f$0() {
59 - let x$5 = 1;
60 - x$7 = x$5 + 1;
61 - x$9 = x$7 + 1;
62 - x$11 = x$9 >>> 1;
59 + let x$1 = 1;
60 + x$1 = x$1 + 1;
61 + x$1 = x$1 + 1;
62 + x$1 = x$1 >>> 1;
63 return;
64 }
65
@@ -68,10 +68,10 @@ function f$0() {
68
69 ```
70 bb0:
71 - [1] Const mutate $5 = 1
72 - [2] Reassign mutate a$4.b.c[0:4] = Binary read a$4.b.c + read $5
73 - [3] Const mutate $6 = 2
74 - [4] Reassign mutate a$4.b.c[0:4] = Binary read a$4.b.c * read $6
71 + [1] Const mutate $2 = 1
72 + [2] Reassign mutate a$1.b.c[0:4] = Binary read a$1.b.c + read $2
73 + [3] Const mutate $3 = 2
74 + [4] Reassign mutate a$1.b.c[0:4] = Binary read a$1.b.c * read $3
75 Return
76 ```
77
@@ -82,10 +82,10 @@ flowchart TB
82 %% Basic Blocks
83 subgraph bb0
84 bb0_instrs["
85 - [1] Const mutate $5 = 1
86 - [2] Reassign mutate a$4.b.c[0:4] = Binary read a$4.b.c + read $5
87 - [3] Const mutate $6 = 2
88 - [4] Reassign mutate a$4.b.c[0:4] = Binary read a$4.b.c * read $6
85 + [1] Const mutate $2 = 1
86 + [2] Reassign mutate a$1.b.c[0:4] = Binary read a$1.b.c + read $2
87 + [3] Const mutate $3 = 2
88 + [4] Reassign mutate a$1.b.c[0:4] = Binary read a$1.b.c * read $3
89 "]
90 bb0_instrs --> bb0_terminal(["Return"])
91 end
@@ -97,9 +97,9 @@ flowchart TB
97 ## Code
98
99 ```javascript
100 -function g$0(a$4) {
101 - a$4.c.b = a$4.b.c + 1;
102 - a$4.c.b = a$4.b.c * 2;
100 +function g$0(a$1) {
101 + a$1.c.b = a$1.b.c + 1;
102 + a$1.c.b = a$1.b.c * 2;
103 return;
104 }
105
compiler/forget/src/__tests__/fixtures/hir/call.expect.md
+26 -26
@@ -47,15 +47,15 @@ function foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$10[1:3] = Array []
51 - [2] Const mutate b$11[2:6] = Object { }
52 - [3] Call mutate foo$4(mutate a$10, mutate b$11)
53 - [4] Const mutate $12 = "div"
54 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
55 - [6] Call mutate foo$4(mutate b$11)
56 - [7] Const mutate $14 = "div"
57 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
58 - Return read $15
50 + [1] Const mutate a$2[1:3] = Array []
51 + [2] Const mutate b$3[2:6] = Object { }
52 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
53 + [4] Const mutate $6 = "div"
54 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
55 + [6] Call mutate foo$4(mutate b$3)
56 + [7] Const mutate $7 = "div"
57 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
58 + Return read $8
59 ```
60
61 ### CFG
@@ -65,16 +65,16 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$10[1:3] = Array []
69 - [2] Const mutate b$11[2:6] = Object { }
70 - [3] Call mutate foo$4(mutate a$10, mutate b$11)
71 - [4] Const mutate $12 = 'div'
72 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
73 - [6] Call mutate foo$4(mutate b$11)
74 - [7] Const mutate $14 = 'div'
75 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
68 + [1] Const mutate a$2[1:3] = Array []
69 + [2] Const mutate b$3[2:6] = Object { }
70 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
71 + [4] Const mutate $6 = 'div'
72 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
73 + [6] Call mutate foo$4(mutate b$3)
74 + [7] Const mutate $7 = 'div'
75 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
76 "]
77 - bb0_instrs --> bb0_terminal(["Return read $15"])
77 + bb0_instrs --> bb0_terminal(["Return read $8"])
78 end
79
80 %% Jumps
@@ -84,14 +84,14 @@ flowchart TB
84 ## Code
85
86 ```javascript
87 -function Component$0(props$9) {
88 - const a$10 = [];
89 - const b$11 = {};
90 - foo$4(a$10, b$11);
91 - let _$13 = <div a={a$10}></div>;
92 -
93 - foo$4(b$11);
94 - return <div a={a$10} b={b$11}></div>;
87 +function Component$0(props$1) {
88 + const a$2 = [];
89 + const b$3 = {};
90 + foo$4(a$2, b$3);
91 + let _$5 = <div a={a$2}></div>;
92 +
93 + foo$4(b$3);
94 + return <div a={a$2} b={b$3}></div>;
95 }
96
97 ```
compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md
+10 -10
@@ -18,16 +18,16 @@ function foo(a, b, c) {
18
19 ```
20 bb0:
21 - If (read a$4) then:bb3 else:bb1
21 + If (read a$1) then:bb3 else:bb1
22 bb3:
23 predecessor blocks: bb0
24 While test=bb4 loop=bb6 fallthrough=bb1
25 bb4:
26 predecessor blocks: bb3 bb7
27 - If (read b$5) then:bb6 else:bb1
27 + If (read b$2) then:bb6 else:bb1
28 bb6:
29 predecessor blocks: bb4
30 - If (read c$6) then:bb1 else:bb7
30 + If (read c$3) then:bb1 else:bb7
31 bb7:
32 predecessor blocks: bb6
33 Goto(Continue) bb4
@@ -42,16 +42,16 @@ bb1:
42 flowchart TB
43 %% Basic Blocks
44 subgraph bb0
45 - bb0_terminal(["If (read a$4)"])
45 + bb0_terminal(["If (read a$1)"])
46 end
47 subgraph bb3
48 bb3_terminal(["While"])
49 end
50 subgraph bb4
51 - bb4_terminal(["If (read b$5)"])
51 + bb4_terminal(["If (read b$2)"])
52 end
53 subgraph bb6
54 - bb6_terminal(["If (read c$6)"])
54 + bb6_terminal(["If (read c$3)"])
55 end
56 subgraph bb7
57 bb7_terminal(["Goto"])
@@ -77,10 +77,10 @@ flowchart TB
77 ## Code
78
79 ```javascript
80 -function foo$0(a$4, b$5, c$6) {
81 - bb1: if (a$4) {
82 - while (b$5) {
83 - bb7: if (c$6) break;
80 +function foo$0(a$1, b$2, c$3) {
81 + bb1: if (a$1) {
82 + while (b$2) {
83 + bb7: if (c$3) break;
84 }
85 }
86 return;
compiler/forget/src/__tests__/fixtures/hir/component.expect.md
+62 -62
@@ -35,28 +35,28 @@ function Component(props) {
35
36 ```
37 bb0:
38 - [1] Const mutate items$27 = read props$26.items
39 - [2] Const mutate maxItems$28 = read props$26.maxItems
40 - [3] Const mutate renderedItems$29[3:14] = Array []
41 - [4] Const mutate seen$30[4:11] = New mutate Set$6()
42 - [5] Const mutate $31 = 0
43 - [6] Const mutate max$32 = Call mutate Math$8.max(read $31, read maxItems$28)
38 + [1] Const mutate items$2 = read props$1.items
39 + [2] Const mutate maxItems$3 = read props$1.maxItems
40 + [3] Const mutate renderedItems$4[3:14] = Array []
41 + [4] Const mutate seen$5[4:11] = New mutate Set$6()
42 + [5] Const mutate $9 = 0
43 + [6] Const mutate max$7 = Call mutate Math$8.max(read $9, read maxItems$3)
44 Goto bb1
45 bb1:
46 predecessor blocks: bb0 bb5 bb10
47 - If (read items$27) then:bb3 else:bb2
47 + If (read items$2) then:bb3 else:bb2
48 bb3:
49 predecessor blocks: bb1
50 - [7] Const mutate $34 = null
51 - [8] Const mutate $36 = Binary read item$10 == read $34
52 - If (read $36) then:bb8 else:bb9
50 + [7] Const mutate $11 = null
51 + [8] Const mutate $12 = Binary read item$10 == read $11
52 + If (read $12) then:bb8 else:bb9
53 bb8:
54 predecessor blocks: bb3
55 - [9] Const mutate $13 = read $36
55 + [9] Const mutate $13 = read $12
56 Goto bb7
57 bb9:
58 predecessor blocks: bb3
59 - [10] Const mutate $13 = Call mutate seen$30.has(mutate item$10)
59 + [10] Const mutate $13 = Call mutate seen$5.has(mutate item$10)
60 Goto bb7
61 bb7:
62 predecessor blocks: bb8 bb9
@@ -66,27 +66,27 @@ bb5:
66 Goto(Continue) bb1
67 bb4:
68 predecessor blocks: bb7
69 - [11] Call mutate seen$30.add(mutate item$10)
70 - [12] Const mutate $43 = "div"
71 - [13] Const mutate $44 = JSX <read $43>{read item$10}</read $43>
72 - [14] Call mutate renderedItems$29.push(read $44)
73 - [15] Const mutate $49 = Binary read renderedItems$29.length >= read max$32
74 - If (read $49) then:bb2 else:bb10
69 + [11] Call mutate seen$5.add(mutate item$10)
70 + [12] Const mutate $14 = "div"
71 + [13] Const mutate $15 = JSX <read $14>{read item$10}</read $14>
72 + [14] Call mutate renderedItems$4.push(read $15)
73 + [15] Const mutate $16 = Binary read renderedItems$4.length >= read max$7
74 + If (read $16) then:bb2 else:bb10
75 bb10:
76 predecessor blocks: bb4
77 Goto(Continue) bb1
78 bb2:
79 predecessor blocks: bb4 bb1
80 - [16] Const mutate count$52 = read renderedItems$29.length
81 - [17] Const mutate $53 = "div"
82 - [18] Const mutate $54 = "\n "
83 - [19] Const mutate $55 = "h1"
84 - [20] Const mutate $56 = " Items"
85 - [21] Const mutate $57 = JSX <read $55>{freeze count$52}{read $56}</read $55>
86 - [22] Const mutate $58 = "\n "
87 - [23] Const mutate $59 = "\n "
88 - [24] Const mutate $60 = JSX <read $53>{read $54}{read $57}{read $58}{freeze renderedItems$29}{read $59}</read $53>
89 - Return read $60
80 + [16] Const mutate count$17 = read renderedItems$4.length
81 + [17] Const mutate $18 = "div"
82 + [18] Const mutate $19 = "\n "
83 + [19] Const mutate $20 = "h1"
84 + [20] Const mutate $21 = " Items"
85 + [21] Const mutate $22 = JSX <read $20>{freeze count$17}{read $21}</read $20>
86 + [22] Const mutate $23 = "\n "
87 + [23] Const mutate $24 = "\n "
88 + [24] Const mutate $25 = JSX <read $18>{read $19}{read $22}{read $23}{freeze renderedItems$4}{read $24}</read $18>
89 + Return read $25
90 ```
91
92 ### CFG
@@ -96,34 +96,34 @@ flowchart TB
96 %% Basic Blocks
97 subgraph bb0
98 bb0_instrs["
99 - [1] Const mutate items$27 = read props$26.items
100 - [2] Const mutate maxItems$28 = read props$26.maxItems
101 - [3] Const mutate renderedItems$29[3:14] = Array []
102 - [4] Const mutate seen$30[4:11] = New mutate Set$6()
103 - [5] Const mutate $31 = 0
104 - [6] Const mutate max$32 = Call mutate Math$8.max(read $31, read maxItems$28)
99 + [1] Const mutate items$2 = read props$1.items
100 + [2] Const mutate maxItems$3 = read props$1.maxItems
101 + [3] Const mutate renderedItems$4[3:14] = Array []
102 + [4] Const mutate seen$5[4:11] = New mutate Set$6()
103 + [5] Const mutate $9 = 0
104 + [6] Const mutate max$7 = Call mutate Math$8.max(read $9, read maxItems$3)
105 "]
106 bb0_instrs --> bb0_terminal(["Goto"])
107 end
108 subgraph bb1
109 - bb1_terminal(["If (read items$27)"])
109 + bb1_terminal(["If (read items$2)"])
110 end
111 subgraph bb3
112 bb3_instrs["
113 - [7] Const mutate $34 = null
114 - [8] Const mutate $36 = Binary read item$10 == read $34
113 + [7] Const mutate $11 = null
114 + [8] Const mutate $12 = Binary read item$10 == read $11
115 "]
116 - bb3_instrs --> bb3_terminal(["If (read $36)"])
116 + bb3_instrs --> bb3_terminal(["If (read $12)"])
117 end
118 subgraph bb8
119 bb8_instrs["
120 - [9] Const mutate $13 = read $36
120 + [9] Const mutate $13 = read $12
121 "]
122 bb8_instrs --> bb8_terminal(["Goto"])
123 end
124 subgraph bb9
125 bb9_instrs["
126 - [10] Const mutate $13 = Call mutate seen$30.has(mutate item$10)
126 + [10] Const mutate $13 = Call mutate seen$5.has(mutate item$10)
127 "]
128 bb9_instrs --> bb9_terminal(["Goto"])
129 end
@@ -135,30 +135,30 @@ flowchart TB
135 end
136 subgraph bb4
137 bb4_instrs["
138 - [11] Call mutate seen$30.add(mutate item$10)
139 - [12] Const mutate $43 = 'div'
140 - [13] Const mutate $44 = JSX <read $43>{read item$10}</read $43>
141 - [14] Call mutate renderedItems$29.push(read $44)
142 - [15] Const mutate $49 = Binary read renderedItems$29.length >= read max$32
138 + [11] Call mutate seen$5.add(mutate item$10)
139 + [12] Const mutate $14 = 'div'
140 + [13] Const mutate $15 = JSX <read $14>{read item$10}</read $14>
141 + [14] Call mutate renderedItems$4.push(read $15)
142 + [15] Const mutate $16 = Binary read renderedItems$4.length >= read max$7
143 "]
144 - bb4_instrs --> bb4_terminal(["If (read $49)"])
144 + bb4_instrs --> bb4_terminal(["If (read $16)"])
145 end
146 subgraph bb10
147 bb10_terminal(["Goto"])
148 end
149 subgraph bb2
150 bb2_instrs["
151 - [16] Const mutate count$52 = read renderedItems$29.length
152 - [17] Const mutate $53 = 'div'
153 - [18] Const mutate $54 = '\n '
154 - [19] Const mutate $55 = 'h1'
155 - [20] Const mutate $56 = ' Items'
156 - [21] Const mutate $57 = JSX <read $55>{freeze count$52}{read $56}</read $55>
157 - [22] Const mutate $58 = '\n '
158 - [23] Const mutate $59 = '\n '
159 - [24] Const mutate $60 = JSX <read $53>{read $54}{read $57}{read $58}{freeze renderedItems$29}{read $59}</read $53>
151 + [16] Const mutate count$17 = read renderedItems$4.length
152 + [17] Const mutate $18 = 'div'
153 + [18] Const mutate $19 = '\n '
154 + [19] Const mutate $20 = 'h1'
155 + [20] Const mutate $21 = ' Items'
156 + [21] Const mutate $22 = JSX <read $20>{freeze count$17}{read $21}</read $20>
157 + [22] Const mutate $23 = '\n '
158 + [23] Const mutate $24 = '\n '
159 + [24] Const mutate $25 = JSX <read $18>{read $19}{read $22}{read $23}{freeze renderedItems$4}{read $24}</read $18>
160 "]
161 - bb2_instrs --> bb2_terminal(["Return read $60"])
161 + bb2_instrs --> bb2_terminal(["Return read $25"])
162 end
163
164 %% Jumps
@@ -182,12 +182,12 @@ flowchart TB
182 ## Code
183
184 ```javascript
185 -function Component$0(props$26) {
186 - const items$27 = props$26.items;
187 - const maxItems$28 = props$26.maxItems;
188 - const renderedItems$29 = [];
189 - const seen$30 = new Set$6();
190 - const max$32 = Math$8.max(0, maxItems$28);
185 +function Component$0(props$1) {
186 + const items$2 = props$1.items;
187 + const maxItems$3 = props$1.maxItems;
188 + const renderedItems$4 = [];
189 + const seen$5 = new Set$6();
190 + const max$7 = Math$8.max(0, maxItems$3);
191 }
192
193 ```
compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md
+103 -103
@@ -78,17 +78,17 @@ function Component(props) {
78
79 ```
80 bb0:
81 - [1] Const mutate a_DEBUG$5[1:4] = Array []
82 - [2] Call mutate a_DEBUG$5.push(read props$4.a)
83 - If (read props$4.b) then:bb2 else:bb1
81 + [1] Const mutate a_DEBUG$2[1:4] = Array []
82 + [2] Call mutate a_DEBUG$2.push(read props$1.a)
83 + If (read props$1.b) then:bb2 else:bb1
84 bb2:
85 predecessor blocks: bb0
86 - [3] Const mutate $6 = null
87 - Return read $6
86 + [3] Const mutate $3 = null
87 + Return read $3
88 bb1:
89 predecessor blocks: bb0
90 - [4] Call mutate a_DEBUG$5.push(read props$4.d)
91 - Return freeze a_DEBUG$5
90 + [4] Call mutate a_DEBUG$2.push(read props$1.d)
91 + Return freeze a_DEBUG$2
92 ```
93
94 ### CFG
@@ -98,22 +98,22 @@ flowchart TB
98 %% Basic Blocks
99 subgraph bb0
100 bb0_instrs["
101 - [1] Const mutate a_DEBUG$5[1:4] = Array []
102 - [2] Call mutate a_DEBUG$5.push(read props$4.a)
101 + [1] Const mutate a_DEBUG$2[1:4] = Array []
102 + [2] Call mutate a_DEBUG$2.push(read props$1.a)
103 "]
104 - bb0_instrs --> bb0_terminal(["If (read props$4.b)"])
104 + bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
105 end
106 subgraph bb2
107 bb2_instrs["
108 - [3] Const mutate $6 = null
108 + [3] Const mutate $3 = null
109 "]
110 - bb2_instrs --> bb2_terminal(["Return read $6"])
110 + bb2_instrs --> bb2_terminal(["Return read $3"])
111 end
112 subgraph bb1
113 bb1_instrs["
114 - [4] Call mutate a_DEBUG$5.push(read props$4.d)
114 + [4] Call mutate a_DEBUG$2.push(read props$1.d)
115 "]
116 - bb1_instrs --> bb1_terminal(["Return freeze a_DEBUG$5"])
116 + bb1_instrs --> bb1_terminal(["Return freeze a_DEBUG$2"])
117 end
118
119 %% Jumps
@@ -125,15 +125,15 @@ flowchart TB
125 ## Code
126
127 ```javascript
128 -function Component$0(props$4) {
129 - const a_DEBUG$5 = [];
130 - a_DEBUG$5.push(props$4.a);
131 - bb1: if (props$4.b) {
128 +function Component$0(props$1) {
129 + const a_DEBUG$2 = [];
130 + a_DEBUG$2.push(props$1.a);
131 + bb1: if (props$1.b) {
132 return null;
133 }
134
135 - a_DEBUG$5.push(props$4.d);
136 - return a_DEBUG$5;
135 + a_DEBUG$2.push(props$1.d);
136 + return a_DEBUG$2;
137 }
138
139 ```
@@ -141,17 +141,17 @@ function Component$0(props$4) {
141
142 ```
143 bb0:
144 - [1] Const mutate a$4[1:4] = Array []
145 - [2] Call mutate a$4.push(read props$3.a)
146 - If (read props$3.b) then:bb2 else:bb1
144 + [1] Const mutate a$2[1:4] = Array []
145 + [2] Call mutate a$2.push(read props$1.a)
146 + If (read props$1.b) then:bb2 else:bb1
147 bb2:
148 predecessor blocks: bb0
149 - [3] Call mutate a$4.push(read props$3.c)
149 + [3] Call mutate a$2.push(read props$1.c)
150 Goto bb1
151 bb1:
152 predecessor blocks: bb2 bb0
153 - [4] Call mutate a$4.push(read props$3.d)
154 - Return freeze a$4
153 + [4] Call mutate a$2.push(read props$1.d)
154 + Return freeze a$2
155 ```
156
157 ### CFG
@@ -161,22 +161,22 @@ flowchart TB
161 %% Basic Blocks
162 subgraph bb0
163 bb0_instrs["
164 - [1] Const mutate a$4[1:4] = Array []
165 - [2] Call mutate a$4.push(read props$3.a)
164 + [1] Const mutate a$2[1:4] = Array []
165 + [2] Call mutate a$2.push(read props$1.a)
166 "]
167 - bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
167 + bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
168 end
169 subgraph bb2
170 bb2_instrs["
171 - [3] Call mutate a$4.push(read props$3.c)
171 + [3] Call mutate a$2.push(read props$1.c)
172 "]
173 bb2_instrs --> bb2_terminal(["Goto"])
174 end
175 subgraph bb1
176 bb1_instrs["
177 - [4] Call mutate a$4.push(read props$3.d)
177 + [4] Call mutate a$2.push(read props$1.d)
178 "]
179 - bb1_instrs --> bb1_terminal(["Return freeze a$4"])
179 + bb1_instrs --> bb1_terminal(["Return freeze a$2"])
180 end
181
182 %% Jumps
@@ -189,15 +189,15 @@ flowchart TB
189 ## Code
190
191 ```javascript
192 -function Component$0(props$3) {
193 - const a$4 = [];
194 - a$4.push(props$3.a);
195 - bb1: if (props$3.b) {
196 - a$4.push(props$3.c);
192 +function Component$0(props$1) {
193 + const a$2 = [];
194 + a$2.push(props$1.a);
195 + bb1: if (props$1.b) {
196 + a$2.push(props$1.c);
197 }
198
199 - a$4.push(props$3.d);
200 - return a$4;
199 + a$2.push(props$1.d);
200 + return a$2;
201 }
202
203 ```
@@ -205,18 +205,18 @@ function Component$0(props$3) {
205
206 ```
207 bb0:
208 - [1] Const mutate a$5[1:5] = Array []
209 - [2] Call mutate a$5.push(read props$4.a)
210 - If (read props$4.b) then:bb2 else:bb1
208 + [1] Const mutate a$2[1:5] = Array []
209 + [2] Call mutate a$2.push(read props$1.a)
210 + If (read props$1.b) then:bb2 else:bb1
211 bb2:
212 predecessor blocks: bb0
213 - [3] Call mutate a$5.push(read props$4.c)
214 - [4] Const mutate $6 = null
215 - Return read $6
213 + [3] Call mutate a$2.push(read props$1.c)
214 + [4] Const mutate $3 = null
215 + Return read $3
216 bb1:
217 predecessor blocks: bb0
218 - [5] Call mutate a$5.push(read props$4.d)
219 - Return freeze a$5
218 + [5] Call mutate a$2.push(read props$1.d)
219 + Return freeze a$2
220 ```
221
222 ### CFG
@@ -226,23 +226,23 @@ flowchart TB
226 %% Basic Blocks
227 subgraph bb0
228 bb0_instrs["
229 - [1] Const mutate a$5[1:5] = Array []
230 - [2] Call mutate a$5.push(read props$4.a)
229 + [1] Const mutate a$2[1:5] = Array []
230 + [2] Call mutate a$2.push(read props$1.a)
231 "]
232 - bb0_instrs --> bb0_terminal(["If (read props$4.b)"])
232 + bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
233 end
234 subgraph bb2
235 bb2_instrs["
236 - [3] Call mutate a$5.push(read props$4.c)
237 - [4] Const mutate $6 = null
236 + [3] Call mutate a$2.push(read props$1.c)
237 + [4] Const mutate $3 = null
238 "]
239 - bb2_instrs --> bb2_terminal(["Return read $6"])
239 + bb2_instrs --> bb2_terminal(["Return read $3"])
240 end
241 subgraph bb1
242 bb1_instrs["
243 - [5] Call mutate a$5.push(read props$4.d)
243 + [5] Call mutate a$2.push(read props$1.d)
244 "]
245 - bb1_instrs --> bb1_terminal(["Return freeze a$5"])
245 + bb1_instrs --> bb1_terminal(["Return freeze a$2"])
246 end
247
248 %% Jumps
@@ -254,16 +254,16 @@ flowchart TB
254 ## Code
255
256 ```javascript
257 -function Component$0(props$4) {
258 - const a$5 = [];
259 - a$5.push(props$4.a);
260 - bb1: if (props$4.b) {
261 - a$5.push(props$4.c);
257 +function Component$0(props$1) {
258 + const a$2 = [];
259 + a$2.push(props$1.a);
260 + bb1: if (props$1.b) {
261 + a$2.push(props$1.c);
262 return null;
263 }
264
265 - a$5.push(props$4.d);
266 - return a$5;
265 + a$2.push(props$1.d);
266 + return a$2;
267 }
268
269 ```
@@ -271,17 +271,17 @@ function Component$0(props$4) {
271
272 ```
273 bb0:
274 - [1] Const mutate a$4[1:4] = Array []
275 - [2] Call mutate a$4.push(read props$3.a)
276 - If (read props$3.b) then:bb2 else:bb1
274 + [1] Const mutate a$2[1:4] = Array []
275 + [2] Call mutate a$2.push(read props$1.a)
276 + If (read props$1.b) then:bb2 else:bb1
277 bb2:
278 predecessor blocks: bb0
279 - [3] Call mutate a$4.push(read props$3.c)
280 - Return freeze a$4
279 + [3] Call mutate a$2.push(read props$1.c)
280 + Return freeze a$2
281 bb1:
282 predecessor blocks: bb0
283 - [4] Call mutate a$4.push(read props$3.d)
284 - Return freeze a$4
283 + [4] Call mutate a$2.push(read props$1.d)
284 + Return freeze a$2
285 ```
286
287 ### CFG
@@ -291,22 +291,22 @@ flowchart TB
291 %% Basic Blocks
292 subgraph bb0
293 bb0_instrs["
294 - [1] Const mutate a$4[1:4] = Array []
295 - [2] Call mutate a$4.push(read props$3.a)
294 + [1] Const mutate a$2[1:4] = Array []
295 + [2] Call mutate a$2.push(read props$1.a)
296 "]
297 - bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
297 + bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
298 end
299 subgraph bb2
300 bb2_instrs["
301 - [3] Call mutate a$4.push(read props$3.c)
301 + [3] Call mutate a$2.push(read props$1.c)
302 "]
303 - bb2_instrs --> bb2_terminal(["Return freeze a$4"])
303 + bb2_instrs --> bb2_terminal(["Return freeze a$2"])
304 end
305 subgraph bb1
306 bb1_instrs["
307 - [4] Call mutate a$4.push(read props$3.d)
307 + [4] Call mutate a$2.push(read props$1.d)
308 "]
309 - bb1_instrs --> bb1_terminal(["Return freeze a$4"])
309 + bb1_instrs --> bb1_terminal(["Return freeze a$2"])
310 end
311
312 %% Jumps
@@ -318,16 +318,16 @@ flowchart TB
318 ## Code
319
320 ```javascript
321 -function Component$0(props$3) {
322 - const a$4 = [];
323 - a$4.push(props$3.a);
324 - bb1: if (props$3.b) {
325 - a$4.push(props$3.c);
326 - return a$4;
321 +function Component$0(props$1) {
322 + const a$2 = [];
323 + a$2.push(props$1.a);
324 + bb1: if (props$1.b) {
325 + a$2.push(props$1.c);
326 + return a$2;
327 }
328
329 - a$4.push(props$3.d);
330 - return a$4;
329 + a$2.push(props$1.d);
330 + return a$2;
331 }
332
333 ```
@@ -335,17 +335,17 @@ function Component$0(props$3) {
335
336 ```
337 bb0:
338 - [1] Const mutate a$4[1:4] = Array []
339 - [2] Call mutate a$4.push(read props$3.a)
340 - If (read props$3.b) then:bb1 else:bb2
338 + [1] Const mutate a$2[1:4] = Array []
339 + [2] Call mutate a$2.push(read props$1.a)
340 + If (read props$1.b) then:bb1 else:bb2
341 bb2:
342 predecessor blocks: bb0
343 - [3] Call mutate a$4.push(read props$3.c)
343 + [3] Call mutate a$2.push(read props$1.c)
344 Goto bb1
345 bb1:
346 predecessor blocks: bb0 bb2
347 - [4] Call mutate a$4.push(read props$3.d)
348 - Return freeze a$4
347 + [4] Call mutate a$2.push(read props$1.d)
348 + Return freeze a$2
349 ```
350
351 ### CFG
@@ -355,22 +355,22 @@ flowchart TB
355 %% Basic Blocks
356 subgraph bb0
357 bb0_instrs["
358 - [1] Const mutate a$4[1:4] = Array []
359 - [2] Call mutate a$4.push(read props$3.a)
358 + [1] Const mutate a$2[1:4] = Array []
359 + [2] Call mutate a$2.push(read props$1.a)
360 "]
361 - bb0_instrs --> bb0_terminal(["If (read props$3.b)"])
361 + bb0_instrs --> bb0_terminal(["If (read props$1.b)"])
362 end
363 subgraph bb2
364 bb2_instrs["
365 - [3] Call mutate a$4.push(read props$3.c)
365 + [3] Call mutate a$2.push(read props$1.c)
366 "]
367 bb2_instrs --> bb2_terminal(["Goto"])
368 end
369 subgraph bb1
370 bb1_instrs["
371 - [4] Call mutate a$4.push(read props$3.d)
371 + [4] Call mutate a$2.push(read props$1.d)
372 "]
373 - bb1_instrs --> bb1_terminal(["Return freeze a$4"])
373 + bb1_instrs --> bb1_terminal(["Return freeze a$2"])
374 end
375
376 %% Jumps
@@ -383,15 +383,15 @@ flowchart TB
383 ## Code
384
385 ```javascript
386 -function Component$0(props$3) {
387 - const a$4 = [];
388 - a$4.push(props$3.a);
389 - bb2: if (props$3.b) {
390 - a$4.push(props$3.d);
391 - return a$4;
386 +function Component$0(props$1) {
387 + const a$2 = [];
388 + a$2.push(props$1.a);
389 + bb2: if (props$1.b) {
390 + a$2.push(props$1.d);
391 + return a$2;
392 }
393
394 - a$4.push(props$3.c);
394 + a$2.push(props$1.c);
395 }
396
397 ```
compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md
+50 -50
@@ -67,24 +67,24 @@ function mayMutate() {}
67
68 ```
69 bb0:
70 - [1] Const mutate a$7[1:3] = Array []
71 - [2] Const mutate b$8[2:4] = Array []
72 - If (read b$8) then:bb2 else:bb1
70 + [1] Const mutate a$2[1:3] = Array []
71 + [2] Const mutate b$3[2:4] = Array []
72 + If (read b$3) then:bb2 else:bb1
73 bb2:
74 predecessor blocks: bb0
75 - [3] Call mutate a$7.push(read props$6.p0)
75 + [3] Call mutate a$2.push(read props$1.p0)
76 Goto bb1
77 bb1:
78 predecessor blocks: bb2 bb0
79 - If (read props$6.p1) then:bb4 else:bb3
79 + If (read props$1.p1) then:bb4 else:bb3
80 bb4:
81 predecessor blocks: bb1
82 - [4] Call mutate b$8.push(read props$6.p2)
82 + [4] Call mutate b$3.push(read props$1.p2)
83 Goto bb3
84 bb3:
85 predecessor blocks: bb4 bb1
86 - [5] Const mutate $16 = JSX <read Foo$4 a={freeze a$7} b={freeze b$8} ></read Foo$4>
87 - Return read $16
86 + [5] Const mutate $5 = JSX <read Foo$4 a={freeze a$2} b={freeze b$3} ></read Foo$4>
87 + Return read $5
88 ```
89
90 ### CFG
@@ -94,31 +94,31 @@ flowchart TB
94 %% Basic Blocks
95 subgraph bb0
96 bb0_instrs["
97 - [1] Const mutate a$7[1:3] = Array []
98 - [2] Const mutate b$8[2:4] = Array []
97 + [1] Const mutate a$2[1:3] = Array []
98 + [2] Const mutate b$3[2:4] = Array []
99 "]
100 - bb0_instrs --> bb0_terminal(["If (read b$8)"])
100 + bb0_instrs --> bb0_terminal(["If (read b$3)"])
101 end
102 subgraph bb2
103 bb2_instrs["
104 - [3] Call mutate a$7.push(read props$6.p0)
104 + [3] Call mutate a$2.push(read props$1.p0)
105 "]
106 bb2_instrs --> bb2_terminal(["Goto"])
107 end
108 subgraph bb1
109 - bb1_terminal(["If (read props$6.p1)"])
109 + bb1_terminal(["If (read props$1.p1)"])
110 end
111 subgraph bb4
112 bb4_instrs["
113 - [4] Call mutate b$8.push(read props$6.p2)
113 + [4] Call mutate b$3.push(read props$1.p2)
114 "]
115 bb4_instrs --> bb4_terminal(["Goto"])
116 end
117 subgraph bb3
118 bb3_instrs["
119 - [5] Const mutate $16 = JSX <read Foo$4 a={freeze a$7} b={freeze b$8} ></read Foo$4>
119 + [5] Const mutate $5 = JSX <read Foo$4 a={freeze a$2} b={freeze b$3} ></read Foo$4>
120 "]
121 - bb3_instrs --> bb3_terminal(["Return read $16"])
121 + bb3_instrs --> bb3_terminal(["Return read $5"])
122 end
123
124 %% Jumps
@@ -134,18 +134,18 @@ flowchart TB
134 ## Code
135
136 ```javascript
137 -function Component$0(props$6) {
138 - const a$7 = [];
139 - const b$8 = [];
140 - bb1: if (b$8) {
141 - a$7.push(props$6.p0);
137 +function Component$0(props$1) {
138 + const a$2 = [];
139 + const b$3 = [];
140 + bb1: if (b$3) {
141 + a$2.push(props$1.p0);
142 }
143
144 - bb3: if (props$6.p1) {
145 - b$8.push(props$6.p2);
144 + bb3: if (props$1.p1) {
145 + b$3.push(props$1.p2);
146 }
147
148 - return <Foo$4 a={a$7} b={b$8}></Foo$4>;
148 + return <Foo$4 a={a$2} b={b$3}></Foo$4>;
149 }
150
151 ```
@@ -153,25 +153,25 @@ function Component$0(props$6) {
153
154 ```
155 bb0:
156 - [1] Const mutate a$9[1:4] = Array []
157 - [2] Const mutate b$10[2:5] = Array []
158 - [3] Const mutate $11 = Call mutate mayMutate$4(mutate b$10)
159 - If (read $11) then:bb2 else:bb1
156 + [1] Const mutate a$2[1:4] = Array []
157 + [2] Const mutate b$3[2:5] = Array []
158 + [3] Const mutate $5 = Call mutate mayMutate$4(mutate b$3)
159 + If (read $5) then:bb2 else:bb1
160 bb2:
161 predecessor blocks: bb0
162 - [4] Call mutate a$9.push(read props$8.p0)
162 + [4] Call mutate a$2.push(read props$1.p0)
163 Goto bb1
164 bb1:
165 predecessor blocks: bb2 bb0
166 - If (read props$8.p1) then:bb4 else:bb3
166 + If (read props$1.p1) then:bb4 else:bb3
167 bb4:
168 predecessor blocks: bb1
169 - [5] Call mutate b$10.push(read props$8.p2)
169 + [5] Call mutate b$3.push(read props$1.p2)
170 Goto bb3
171 bb3:
172 predecessor blocks: bb4 bb1
173 - [6] Const mutate $19 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
174 - Return read $19
173 + [6] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$3} ></read Foo$6>
174 + Return read $7
175 ```
176
177 ### CFG
@@ -181,32 +181,32 @@ flowchart TB
181 %% Basic Blocks
182 subgraph bb0
183 bb0_instrs["
184 - [1] Const mutate a$9[1:4] = Array []
185 - [2] Const mutate b$10[2:5] = Array []
186 - [3] Const mutate $11 = Call mutate mayMutate$4(mutate b$10)
184 + [1] Const mutate a$2[1:4] = Array []
185 + [2] Const mutate b$3[2:5] = Array []
186 + [3] Const mutate $5 = Call mutate mayMutate$4(mutate b$3)
187 "]
188 - bb0_instrs --> bb0_terminal(["If (read $11)"])
188 + bb0_instrs --> bb0_terminal(["If (read $5)"])
189 end
190 subgraph bb2
191 bb2_instrs["
192 - [4] Call mutate a$9.push(read props$8.p0)
192 + [4] Call mutate a$2.push(read props$1.p0)
193 "]
194 bb2_instrs --> bb2_terminal(["Goto"])
195 end
196 subgraph bb1
197 - bb1_terminal(["If (read props$8.p1)"])
197 + bb1_terminal(["If (read props$1.p1)"])
198 end
199 subgraph bb4
200 bb4_instrs["
201 - [5] Call mutate b$10.push(read props$8.p2)
201 + [5] Call mutate b$3.push(read props$1.p2)
202 "]
203 bb4_instrs --> bb4_terminal(["Goto"])
204 end
205 subgraph bb3
206 bb3_instrs["
207 - [6] Const mutate $19 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
207 + [6] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$3} ></read Foo$6>
208 "]
209 - bb3_instrs --> bb3_terminal(["Return read $19"])
209 + bb3_instrs --> bb3_terminal(["Return read $7"])
210 end
211
212 %% Jumps
@@ -222,18 +222,18 @@ flowchart TB
222 ## Code
223
224 ```javascript
225 -function Component$0(props$8) {
226 - const a$9 = [];
227 - const b$10 = [];
228 - bb1: if (mayMutate$4(b$10)) {
229 - a$9.push(props$8.p0);
225 +function Component$0(props$1) {
226 + const a$2 = [];
227 + const b$3 = [];
228 + bb1: if (mayMutate$4(b$3)) {
229 + a$2.push(props$1.p0);
230 }
231
232 - bb3: if (props$8.p1) {
233 - b$10.push(props$8.p2);
232 + bb3: if (props$1.p1) {
233 + b$3.push(props$1.p2);
234 }
235
236 - return <Foo$6 a={a$9} b={b$10}></Foo$6>;
236 + return <Foo$6 a={a$2} b={b$3}></Foo$6>;
237 }
238
239 ```
compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md
+26 -26
@@ -47,15 +47,15 @@ function Foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$10[1:3] = Array []
51 - [2] Const mutate b$11[2:6] = Object { }
52 - [3] New mutate Foo$4(mutate a$10, mutate b$11)
53 - [4] Const mutate $12 = "div"
54 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
55 - [6] New mutate Foo$4(mutate b$11)
56 - [7] Const mutate $14 = "div"
57 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
58 - Return read $15
50 + [1] Const mutate a$2[1:3] = Array []
51 + [2] Const mutate b$3[2:6] = Object { }
52 + [3] New mutate Foo$4(mutate a$2, mutate b$3)
53 + [4] Const mutate $6 = "div"
54 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
55 + [6] New mutate Foo$4(mutate b$3)
56 + [7] Const mutate $7 = "div"
57 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
58 + Return read $8
59 ```
60
61 ### CFG
@@ -65,16 +65,16 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$10[1:3] = Array []
69 - [2] Const mutate b$11[2:6] = Object { }
70 - [3] New mutate Foo$4(mutate a$10, mutate b$11)
71 - [4] Const mutate $12 = 'div'
72 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
73 - [6] New mutate Foo$4(mutate b$11)
74 - [7] Const mutate $14 = 'div'
75 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
68 + [1] Const mutate a$2[1:3] = Array []
69 + [2] Const mutate b$3[2:6] = Object { }
70 + [3] New mutate Foo$4(mutate a$2, mutate b$3)
71 + [4] Const mutate $6 = 'div'
72 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
73 + [6] New mutate Foo$4(mutate b$3)
74 + [7] Const mutate $7 = 'div'
75 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
76 "]
77 - bb0_instrs --> bb0_terminal(["Return read $15"])
77 + bb0_instrs --> bb0_terminal(["Return read $8"])
78 end
79
80 %% Jumps
@@ -84,14 +84,14 @@ flowchart TB
84 ## Code
85
86 ```javascript
87 -function Component$0(props$9) {
88 - const a$10 = [];
89 - const b$11 = {};
90 - new Foo$4(a$10, b$11);
91 - let _$13 = <div a={a$10}></div>;
92 -
93 - new Foo$4(b$11);
94 - return <div a={a$10} b={b$11}></div>;
87 +function Component$0(props$1) {
88 + const a$2 = [];
89 + const b$3 = {};
90 + new Foo$4(a$2, b$3);
91 + let _$5 = <div a={a$2}></div>;
92 +
93 + new Foo$4(b$3);
94 + return <div a={a$2} b={b$3}></div>;
95 }
96
97 ```
compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md
+13 -13
@@ -18,10 +18,10 @@ function foo(x) {}
18
19 ```
20 bb0:
21 - [1] Const mutate a$5 = Array []
22 - [2] Const mutate b$6 = read a$5
23 - [3] Call read useFreeze$3(freeze a$5)
24 - [4] Call mutate foo$4(read b$6)
21 + [1] Const mutate a$1 = Array []
22 + [2] Const mutate b$2 = read a$1
23 + [3] Call read useFreeze$3(freeze a$1)
24 + [4] Call mutate foo$4(read b$2)
25 Return
26 ```
27
@@ -32,10 +32,10 @@ flowchart TB
32 %% Basic Blocks
33 subgraph bb0
34 bb0_instrs["
35 - [1] Const mutate a$5 = Array []
36 - [2] Const mutate b$6 = read a$5
37 - [3] Call read useFreeze$3(freeze a$5)
38 - [4] Call mutate foo$4(read b$6)
35 + [1] Const mutate a$1 = Array []
36 + [2] Const mutate b$2 = read a$1
37 + [3] Call read useFreeze$3(freeze a$1)
38 + [4] Call mutate foo$4(read b$2)
39 "]
40 bb0_instrs --> bb0_terminal(["Return"])
41 end
@@ -48,10 +48,10 @@ flowchart TB
48
49 ```javascript
50 function Component$0() {
51 - const a$5 = [];
52 - const b$6 = a$5;
53 - useFreeze$3(a$5);
54 - foo$4(b$6);
51 + const a$1 = [];
52 + const b$2 = a$1;
53 + useFreeze$3(a$1);
54 + foo$4(b$2);
55 return;
56 }
57
@@ -107,7 +107,7 @@ flowchart TB
107 ## Code
108
109 ```javascript
110 -function foo$0(x$2) {
110 +function foo$0(x$1) {
111 return;
112 }
113
compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md
+22 -22
@@ -79,14 +79,14 @@ function foo$0() {
79
80 ```
81 bb0:
82 - [1] Const mutate x$11 = Array []
83 - [2] Const mutate y$12 = Call read useFreeze$4(freeze x$11)
84 - [3] Call mutate foo$5(read y$12, read x$11)
85 - [4] Const mutate $13 = "\n "
86 - [5] Const mutate $14 = "\n "
87 - [6] Const mutate $15 = "\n "
88 - [7] Const mutate $16 = JSX <read Component$0>{read $13}{read x$11}{read $14}{read y$12}{read $15}</read Component$0>
89 - Return read $16
82 + [1] Const mutate x$2 = Array []
83 + [2] Const mutate y$3 = Call read useFreeze$4(freeze x$2)
84 + [3] Call mutate foo$5(read y$3, read x$2)
85 + [4] Const mutate $6 = "\n "
86 + [5] Const mutate $7 = "\n "
87 + [6] Const mutate $8 = "\n "
88 + [7] Const mutate $9 = JSX <read Component$0>{read $6}{read x$2}{read $7}{read y$3}{read $8}</read Component$0>
89 + Return read $9
90 ```
91
92 ### CFG
@@ -96,15 +96,15 @@ flowchart TB
96 %% Basic Blocks
97 subgraph bb0
98 bb0_instrs["
99 - [1] Const mutate x$11 = Array []
100 - [2] Const mutate y$12 = Call read useFreeze$4(freeze x$11)
101 - [3] Call mutate foo$5(read y$12, read x$11)
102 - [4] Const mutate $13 = '\n '
103 - [5] Const mutate $14 = '\n '
104 - [6] Const mutate $15 = '\n '
105 - [7] Const mutate $16 = JSX <read Component$0>{read $13}{read x$11}{read $14}{read y$12}{read $15}</read Component$0>
99 + [1] Const mutate x$2 = Array []
100 + [2] Const mutate y$3 = Call read useFreeze$4(freeze x$2)
101 + [3] Call mutate foo$5(read y$3, read x$2)
102 + [4] Const mutate $6 = '\n '
103 + [5] Const mutate $7 = '\n '
104 + [6] Const mutate $8 = '\n '
105 + [7] Const mutate $9 = JSX <read Component$0>{read $6}{read x$2}{read $7}{read y$3}{read $8}</read Component$0>
106 "]
107 - bb0_instrs --> bb0_terminal(["Return read $16"])
107 + bb0_instrs --> bb0_terminal(["Return read $9"])
108 end
109
110 %% Jumps
@@ -114,14 +114,14 @@ flowchart TB
114 ## Code
115
116 ```javascript
117 -function Component$0(props$10) {
118 - const x$11 = [];
119 - const y$12 = useFreeze$4(x$11);
120 - foo$5(y$12, x$11);
117 +function Component$0(props$1) {
118 + const x$2 = [];
119 + const y$3 = useFreeze$4(x$2);
120 + foo$5(y$3, x$2);
121 return (
122 <Component$0>
123 - {x$11}
124 - {y$12}
123 + {x$2}
124 + {y$3}
125 </Component$0>
126 );
127 }
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md
+17 -17
@@ -19,11 +19,11 @@ function call(x) {}
19
20 ```
21 bb0:
22 - [1] Const mutate a$4 = Array []
23 - [2] Call read useFreeze$2(freeze a$4)
24 - [3] Call read useFreeze$2(read a$4)
25 - [4] Call mutate call$3(read a$4)
26 - Return read a$4
22 + [1] Const mutate a$1 = Array []
23 + [2] Call read useFreeze$2(freeze a$1)
24 + [3] Call read useFreeze$2(read a$1)
25 + [4] Call mutate call$3(read a$1)
26 + Return read a$1
27 ```
28
29 ### CFG
@@ -33,12 +33,12 @@ flowchart TB
33 %% Basic Blocks
34 subgraph bb0
35 bb0_instrs["
36 - [1] Const mutate a$4 = Array []
37 - [2] Call read useFreeze$2(freeze a$4)
38 - [3] Call read useFreeze$2(read a$4)
39 - [4] Call mutate call$3(read a$4)
36 + [1] Const mutate a$1 = Array []
37 + [2] Call read useFreeze$2(freeze a$1)
38 + [3] Call read useFreeze$2(read a$1)
39 + [4] Call mutate call$3(read a$1)
40 "]
41 - bb0_instrs --> bb0_terminal(["Return read a$4"])
41 + bb0_instrs --> bb0_terminal(["Return read a$1"])
42 end
43
44 %% Jumps
@@ -49,11 +49,11 @@ flowchart TB
49
50 ```javascript
51 function Component$0() {
52 - const a$4 = [];
53 - useFreeze$2(a$4);
54 - useFreeze$2(a$4);
55 - call$3(a$4);
56 - return a$4;
52 + const a$1 = [];
53 + useFreeze$2(a$1);
54 + useFreeze$2(a$1);
55 + call$3(a$1);
56 + return a$1;
57 }
58
59 ```
@@ -80,7 +80,7 @@ flowchart TB
80 ## Code
81
82 ```javascript
83 -function useFreeze$0(x$2) {
83 +function useFreeze$0(x$1) {
84 return;
85 }
86
@@ -108,7 +108,7 @@ flowchart TB
108 ## Code
109
110 ```javascript
111 -function call$0(x$2) {
111 +function call$0(x$1) {
112 return;
113 }
114
compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md
+18 -18
@@ -26,13 +26,13 @@ function call(x) {}
26
27 ```
28 bb0:
29 - [1] Const mutate cond$8 = read props$7.cond
30 - [2] Const mutate x$9 = read props$7.x
31 - [3] Let mutate a$10 = undefined
32 - If (read cond$8) then:bb2 else:bb3
29 + [1] Const mutate cond$2 = read props$1.cond
30 + [2] Const mutate x$3 = read props$1.x
31 + [3] Let mutate a$4 = undefined
32 + If (read cond$2) then:bb2 else:bb3
33 bb2:
34 predecessor blocks: bb0
35 - [4] Reassign mutate a$4 = read x$9
35 + [4] Reassign mutate a$4 = read x$3
36 Goto bb1
37 bb3:
38 predecessor blocks: bb0
@@ -53,15 +53,15 @@ flowchart TB
53 %% Basic Blocks
54 subgraph bb0
55 bb0_instrs["
56 - [1] Const mutate cond$8 = read props$7.cond
57 - [2] Const mutate x$9 = read props$7.x
58 - [3] Let mutate a$10 = undefined
56 + [1] Const mutate cond$2 = read props$1.cond
57 + [2] Const mutate x$3 = read props$1.x
58 + [3] Let mutate a$4 = undefined
59 "]
60 - bb0_instrs --> bb0_terminal(["If (read cond$8)"])
60 + bb0_instrs --> bb0_terminal(["If (read cond$2)"])
61 end
62 subgraph bb2
63 bb2_instrs["
64 - [4] Reassign mutate a$4 = read x$9
64 + [4] Reassign mutate a$4 = read x$3
65 "]
66 bb2_instrs --> bb2_terminal(["Goto"])
67 end
@@ -92,12 +92,12 @@ flowchart TB
92 ## Code
93
94 ```javascript
95 -function Component$0(props$7) {
96 - const cond$8 = props$7.cond;
97 - const x$9 = props$7.x;
98 - let a$10 = undefined;
99 - bb1: if (cond$8) {
100 - a$4 = x$9;
95 +function Component$0(props$1) {
96 + const cond$2 = props$1.cond;
97 + const x$3 = props$1.x;
98 + let a$4 = undefined;
99 + bb1: if (cond$2) {
100 + a$4 = x$3;
101 } else {
102 a$4 = [];
103 }
@@ -132,7 +132,7 @@ flowchart TB
132 ## Code
133
134 ```javascript
135 -function useFreeze$0(x$2) {
135 +function useFreeze$0(x$1) {
136 return;
137 }
138
@@ -160,7 +160,7 @@ flowchart TB
160 ## Code
161
162 ```javascript
163 -function call$0(x$2) {
163 +function call$0(x$1) {
164 return;
165 }
166
compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md
+21 -21
@@ -149,18 +149,18 @@ function Foo$0() {
149
150 ```
151 bb0:
152 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
153 - [2] Const mutate b$10[2:4] = Call mutate compute$3(read props$8.b)
154 - If (read props$8.c) then:bb2 else:bb1
152 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
153 + [2] Const mutate b$4[2:4] = Call mutate compute$3(read props$1.b)
154 + If (read props$1.c) then:bb2 else:bb1
155 bb2:
156 predecessor blocks: bb0
157 - [3] Call mutate mutate$5(mutate a$9)
158 - [4] Call mutate mutate$5(mutate b$10)
157 + [3] Call mutate mutate$5(mutate a$2)
158 + [4] Call mutate mutate$5(mutate b$4)
159 Goto bb1
160 bb1:
161 predecessor blocks: bb2 bb0
162 - [5] Const mutate $14 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
163 - Return read $14
162 + [5] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
163 + Return read $7
164 ```
165
166 ### CFG
@@ -170,23 +170,23 @@ flowchart TB
170 %% Basic Blocks
171 subgraph bb0
172 bb0_instrs["
173 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
174 - [2] Const mutate b$10[2:4] = Call mutate compute$3(read props$8.b)
173 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
174 + [2] Const mutate b$4[2:4] = Call mutate compute$3(read props$1.b)
175 "]
176 - bb0_instrs --> bb0_terminal(["If (read props$8.c)"])
176 + bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
177 end
178 subgraph bb2
179 bb2_instrs["
180 - [3] Call mutate mutate$5(mutate a$9)
181 - [4] Call mutate mutate$5(mutate b$10)
180 + [3] Call mutate mutate$5(mutate a$2)
181 + [4] Call mutate mutate$5(mutate b$4)
182 "]
183 bb2_instrs --> bb2_terminal(["Goto"])
184 end
185 subgraph bb1
186 bb1_instrs["
187 - [5] Const mutate $14 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
187 + [5] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
188 "]
189 - bb1_instrs --> bb1_terminal(["Return read $14"])
189 + bb1_instrs --> bb1_terminal(["Return read $7"])
190 end
191
192 %% Jumps
@@ -199,15 +199,15 @@ flowchart TB
199 ## Code
200
201 ```javascript
202 -function Component$0(props$8) {
203 - const a$9 = compute$3(props$8.a);
204 - const b$10 = compute$3(props$8.b);
205 - bb1: if (props$8.c) {
206 - mutate$5(a$9);
207 - mutate$5(b$10);
202 +function Component$0(props$1) {
203 + const a$2 = compute$3(props$1.a);
204 + const b$4 = compute$3(props$1.b);
205 + bb1: if (props$1.c) {
206 + mutate$5(a$2);
207 + mutate$5(b$4);
208 }
209
210 - return <Foo$6 a={a$9} b={b$10}></Foo$6>;
210 + return <Foo$6 a={a$2} b={b$4}></Foo$6>;
211 }
212
213 ```
compiler/forget/src/__tests__/fixtures/hir/independent.expect.md
+12 -12
@@ -28,10 +28,10 @@ function Foo() {}
28
29 ```
30 bb0:
31 - [1] Const mutate a$8 = Call mutate compute$3(read props$7.a)
32 - [2] Const mutate b$9 = Call mutate compute$3(read props$7.b)
33 - [3] Const mutate $10 = JSX <read Foo$5 a={freeze a$8} b={freeze b$9} ></read Foo$5>
34 - Return read $10
31 + [1] Const mutate a$2 = Call mutate compute$3(read props$1.a)
32 + [2] Const mutate b$4 = Call mutate compute$3(read props$1.b)
33 + [3] Const mutate $6 = JSX <read Foo$5 a={freeze a$2} b={freeze b$4} ></read Foo$5>
34 + Return read $6
35 ```
36
37 ### CFG
@@ -41,11 +41,11 @@ flowchart TB
41 %% Basic Blocks
42 subgraph bb0
43 bb0_instrs["
44 - [1] Const mutate a$8 = Call mutate compute$3(read props$7.a)
45 - [2] Const mutate b$9 = Call mutate compute$3(read props$7.b)
46 - [3] Const mutate $10 = JSX <read Foo$5 a={freeze a$8} b={freeze b$9} ></read Foo$5>
44 + [1] Const mutate a$2 = Call mutate compute$3(read props$1.a)
45 + [2] Const mutate b$4 = Call mutate compute$3(read props$1.b)
46 + [3] Const mutate $6 = JSX <read Foo$5 a={freeze a$2} b={freeze b$4} ></read Foo$5>
47 "]
48 - bb0_instrs --> bb0_terminal(["Return read $10"])
48 + bb0_instrs --> bb0_terminal(["Return read $6"])
49 end
50
51 %% Jumps
@@ -55,10 +55,10 @@ flowchart TB
55 ## Code
56
57 ```javascript
58 -function Component$0(props$7) {
59 - const a$8 = compute$3(props$7.a);
60 - const b$9 = compute$3(props$7.b);
61 - return <Foo$5 a={a$8} b={b$9}></Foo$5>;
58 +function Component$0(props$1) {
59 + const a$2 = compute$3(props$1.a);
60 + const b$4 = compute$3(props$1.b);
61 + return <Foo$5 a={a$2} b={b$4}></Foo$5>;
62 }
63
64 ```
compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md
+18 -18
@@ -115,17 +115,17 @@ function Foo$0() {
115
116 ```
117 bb0:
118 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
119 - [2] Const mutate b$10[2:3] = Call mutate compute$3(read props$8.b)
120 - If (read props$8.c) then:bb2 else:bb1
118 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
119 + [2] Const mutate b$4[2:3] = Call mutate compute$3(read props$1.b)
120 + If (read props$1.c) then:bb2 else:bb1
121 bb2:
122 predecessor blocks: bb0
123 - [3] Call mutate foo$5(mutate a$9, mutate b$10)
123 + [3] Call mutate foo$5(mutate a$2, mutate b$4)
124 Goto bb1
125 bb1:
126 predecessor blocks: bb2 bb0
127 - [4] Const mutate $14 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
128 - Return read $14
127 + [4] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
128 + Return read $7
129 ```
130
131 ### CFG
@@ -135,22 +135,22 @@ flowchart TB
135 %% Basic Blocks
136 subgraph bb0
137 bb0_instrs["
138 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
139 - [2] Const mutate b$10[2:3] = Call mutate compute$3(read props$8.b)
138 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
139 + [2] Const mutate b$4[2:3] = Call mutate compute$3(read props$1.b)
140 "]
141 - bb0_instrs --> bb0_terminal(["If (read props$8.c)"])
141 + bb0_instrs --> bb0_terminal(["If (read props$1.c)"])
142 end
143 subgraph bb2
144 bb2_instrs["
145 - [3] Call mutate foo$5(mutate a$9, mutate b$10)
145 + [3] Call mutate foo$5(mutate a$2, mutate b$4)
146 "]
147 bb2_instrs --> bb2_terminal(["Goto"])
148 end
149 subgraph bb1
150 bb1_instrs["
151 - [4] Const mutate $14 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
151 + [4] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
152 "]
153 - bb1_instrs --> bb1_terminal(["Return read $14"])
153 + bb1_instrs --> bb1_terminal(["Return read $7"])
154 end
155
156 %% Jumps
@@ -163,14 +163,14 @@ flowchart TB
163 ## Code
164
165 ```javascript
166 -function Component$0(props$8) {
167 - const a$9 = compute$3(props$8.a);
168 - const b$10 = compute$3(props$8.b);
169 - bb1: if (props$8.c) {
170 - foo$5(a$9, b$10);
166 +function Component$0(props$1) {
167 + const a$2 = compute$3(props$1.a);
168 + const b$4 = compute$3(props$1.b);
169 + bb1: if (props$1.c) {
170 + foo$5(a$2, b$4);
171 }
172
173 - return <Foo$6 a={a$9} b={b$10}></Foo$6>;
173 + return <Foo$6 a={a$2} b={b$4}></Foo$6>;
174 }
175
176 ```
compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md
+15 -15
@@ -28,11 +28,11 @@ function Foo() {}
28
29 ```
30 bb0:
31 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
32 - [2] Const mutate b$10[2:3] = Call mutate compute$3(read props$8.b)
33 - [3] Call mutate foo$5(mutate a$9, mutate b$10)
34 - [4] Const mutate $11 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
35 - Return read $11
31 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
32 + [2] Const mutate b$4[2:3] = Call mutate compute$3(read props$1.b)
33 + [3] Call mutate foo$5(mutate a$2, mutate b$4)
34 + [4] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
35 + Return read $7
36 ```
37
38 ### CFG
@@ -42,12 +42,12 @@ flowchart TB
42 %% Basic Blocks
43 subgraph bb0
44 bb0_instrs["
45 - [1] Const mutate a$9[1:3] = Call mutate compute$3(read props$8.a)
46 - [2] Const mutate b$10[2:3] = Call mutate compute$3(read props$8.b)
47 - [3] Call mutate foo$5(mutate a$9, mutate b$10)
48 - [4] Const mutate $11 = JSX <read Foo$6 a={freeze a$9} b={freeze b$10} ></read Foo$6>
45 + [1] Const mutate a$2[1:3] = Call mutate compute$3(read props$1.a)
46 + [2] Const mutate b$4[2:3] = Call mutate compute$3(read props$1.b)
47 + [3] Call mutate foo$5(mutate a$2, mutate b$4)
48 + [4] Const mutate $7 = JSX <read Foo$6 a={freeze a$2} b={freeze b$4} ></read Foo$6>
49 "]
50 - bb0_instrs --> bb0_terminal(["Return read $11"])
50 + bb0_instrs --> bb0_terminal(["Return read $7"])
51 end
52
53 %% Jumps
@@ -57,11 +57,11 @@ flowchart TB
57 ## Code
58
59 ```javascript
60 -function Component$0(props$8) {
61 - const a$9 = compute$3(props$8.a);
62 - const b$10 = compute$3(props$8.b);
63 - foo$5(a$9, b$10);
64 - return <Foo$6 a={a$9} b={b$10}></Foo$6>;
60 +function Component$0(props$1) {
61 + const a$2 = compute$3(props$1.a);
62 + const b$4 = compute$3(props$1.b);
63 + foo$5(a$2, b$4);
64 + return <Foo$6 a={a$2} b={b$4}></Foo$6>;
65 }
66
67 ```
compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md
+26 -26
@@ -19,18 +19,18 @@ function Foo(props) {
19
20 ```
21 bb0:
22 - [1] Const mutate $14 = "\n Hello "
23 - [2] Const mutate $15 = " "
24 - [3] Const mutate $16 = "\n "
25 - [4] Const mutate $17 = "div"
26 - [5] Const mutate $18 = "\n "
27 - [6] Const mutate $19 = "Text"
28 - [7] Const mutate $20 = JsxFragment [read $19]
29 - [8] Const mutate $21 = "\n "
30 - [9] Const mutate $22 = JSX <read $17>{read $18}{read $20}{read $21}</read $17>
31 - [10] Const mutate $23 = "\n "
32 - [11] Const mutate $24 = JsxFragment [read $14, read props$13.greeting, read $15, read $16, read $22, read $23]
33 - Return read $24
22 + [1] Const mutate $2 = "\n Hello "
23 + [2] Const mutate $3 = " "
24 + [3] Const mutate $4 = "\n "
25 + [4] Const mutate $5 = "div"
26 + [5] Const mutate $6 = "\n "
27 + [6] Const mutate $7 = "Text"
28 + [7] Const mutate $8 = JsxFragment [read $7]
29 + [8] Const mutate $9 = "\n "
30 + [9] Const mutate $10 = JSX <read $5>{read $6}{read $8}{read $9}</read $5>
31 + [10] Const mutate $11 = "\n "
32 + [11] Const mutate $12 = JsxFragment [read $2, read props$1.greeting, read $3, read $4, read $10, read $11]
33 + Return read $12
34 ```
35
36 ### CFG
@@ -40,19 +40,19 @@ flowchart TB
40 %% Basic Blocks
41 subgraph bb0
42 bb0_instrs["
43 - [1] Const mutate $14 = '\n Hello '
44 - [2] Const mutate $15 = ' '
45 - [3] Const mutate $16 = '\n '
46 - [4] Const mutate $17 = 'div'
47 - [5] Const mutate $18 = '\n '
48 - [6] Const mutate $19 = 'Text'
49 - [7] Const mutate $20 = JsxFragment [read $19]
50 - [8] Const mutate $21 = '\n '
51 - [9] Const mutate $22 = JSX <read $17>{read $18}{read $20}{read $21}</read $17>
52 - [10] Const mutate $23 = '\n '
53 - [11] Const mutate $24 = JsxFragment [read $14, read props$13.greeting, read $15, read $16, read $22, read $23]
43 + [1] Const mutate $2 = '\n Hello '
44 + [2] Const mutate $3 = ' '
45 + [3] Const mutate $4 = '\n '
46 + [4] Const mutate $5 = 'div'
47 + [5] Const mutate $6 = '\n '
48 + [6] Const mutate $7 = 'Text'
49 + [7] Const mutate $8 = JsxFragment [read $7]
50 + [8] Const mutate $9 = '\n '
51 + [9] Const mutate $10 = JSX <read $5>{read $6}{read $8}{read $9}</read $5>
52 + [10] Const mutate $11 = '\n '
53 + [11] Const mutate $12 = JsxFragment [read $2, read props$1.greeting, read $3, read $4, read $10, read $11]
54 "]
55 - bb0_instrs --> bb0_terminal(["Return read $24"])
55 + bb0_instrs --> bb0_terminal(["Return read $12"])
56 end
57
58 %% Jumps
@@ -62,10 +62,10 @@ flowchart TB
62 ## Code
63
64 ```javascript
65 -function Foo$0(props$13) {
65 +function Foo$0(props$1) {
66 return (
67 <>
68 - Hello {props$13.greeting}
68 + Hello {props$1.greeting}
69 {<div>{<>Text</>}</div>}
70 </>
71 );
compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md
+23 -23
@@ -23,15 +23,15 @@ function g() {}
23
24 ```
25 bb0:
26 - [1] Const mutate $5 = Call mutate f$1()
27 - If (read $5) then:bb2 else:bb3
26 + [1] Const mutate $2 = Call mutate f$1()
27 + If (read $2) then:bb2 else:bb3
28 bb2:
29 predecessor blocks: bb0
30 [2] Const mutate $3 = Call mutate g$4()
31 Goto bb1
32 bb3:
33 predecessor blocks: bb0
34 - [3] Const mutate $3 = read $5
34 + [3] Const mutate $3 = read $2
35 Goto bb1
36 bb1:
37 predecessor blocks: bb2 bb3
@@ -45,9 +45,9 @@ flowchart TB
45 %% Basic Blocks
46 subgraph bb0
47 bb0_instrs["
48 - [1] Const mutate $5 = Call mutate f$1()
48 + [1] Const mutate $2 = Call mutate f$1()
49 "]
50 - bb0_instrs --> bb0_terminal(["If (read $5)"])
50 + bb0_instrs --> bb0_terminal(["If (read $2)"])
51 end
52 subgraph bb2
53 bb2_instrs["
@@ -57,7 +57,7 @@ flowchart TB
57 end
58 subgraph bb3
59 bb3_instrs["
60 - [3] Const mutate $3 = read $5
60 + [3] Const mutate $3 = read $2
61 "]
62 bb3_instrs --> bb3_terminal(["Goto"])
63 end
@@ -89,11 +89,11 @@ function And$0() {
89
90 ```
91 bb0:
92 - [1] Const mutate $5 = Call mutate f$1()
93 - If (read $5) then:bb2 else:bb3
92 + [1] Const mutate $2 = Call mutate f$1()
93 + If (read $2) then:bb2 else:bb3
94 bb2:
95 predecessor blocks: bb0
96 - [2] Const mutate $3 = read $5
96 + [2] Const mutate $3 = read $2
97 Goto bb1
98 bb3:
99 predecessor blocks: bb0
@@ -111,13 +111,13 @@ flowchart TB
111 %% Basic Blocks
112 subgraph bb0
113 bb0_instrs["
114 - [1] Const mutate $5 = Call mutate f$1()
114 + [1] Const mutate $2 = Call mutate f$1()
115 "]
116 - bb0_instrs --> bb0_terminal(["If (read $5)"])
116 + bb0_instrs --> bb0_terminal(["If (read $2)"])
117 end
118 subgraph bb2
119 bb2_instrs["
120 - [2] Const mutate $3 = read $5
120 + [2] Const mutate $3 = read $2
121 "]
122 bb2_instrs --> bb2_terminal(["Goto"])
123 end
@@ -155,13 +155,13 @@ function Or$0() {
155
156 ```
157 bb0:
158 - [1] Const mutate $9 = Call mutate f$2()
159 - [2] Const mutate $10 = null
160 - [3] Const mutate $11 = Binary read $9 != read $10
161 - If (read $11) then:bb2 else:bb3
158 + [1] Const mutate $3 = Call mutate f$2()
159 + [2] Const mutate $4 = null
160 + [3] Const mutate $5 = Binary read $3 != read $4
161 + If (read $5) then:bb2 else:bb3
162 bb2:
163 predecessor blocks: bb0
164 - [4] Const mutate $6 = read $9
164 + [4] Const mutate $6 = read $3
165 Goto bb1
166 bb3:
167 predecessor blocks: bb0
@@ -179,15 +179,15 @@ flowchart TB
179 %% Basic Blocks
180 subgraph bb0
181 bb0_instrs["
182 - [1] Const mutate $9 = Call mutate f$2()
183 - [2] Const mutate $10 = null
184 - [3] Const mutate $11 = Binary read $9 != read $10
182 + [1] Const mutate $3 = Call mutate f$2()
183 + [2] Const mutate $4 = null
184 + [3] Const mutate $5 = Binary read $3 != read $4
185 "]
186 - bb0_instrs --> bb0_terminal(["If (read $11)"])
186 + bb0_instrs --> bb0_terminal(["If (read $5)"])
187 end
188 subgraph bb2
189 bb2_instrs["
190 - [4] Const mutate $6 = read $9
190 + [4] Const mutate $6 = read $3
191 "]
192 bb2_instrs --> bb2_terminal(["Goto"])
193 end
@@ -213,7 +213,7 @@ flowchart TB
213 ## Code
214
215 ```javascript
216 -function QuestionQuestion$0(props$8) {
216 +function QuestionQuestion$0(props$1) {
217 bb1: if (f$2() != null) {
218 } else {
219 }
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md
+25 -25
@@ -62,7 +62,7 @@ flowchart TB
62 ## Code
63
64 ```javascript
65 -function mutate$0(x$3, y$4) {
65 +function mutate$0(x$1, y$2) {
66 return;
67 }
68
@@ -90,7 +90,7 @@ flowchart TB
90 ## Code
91
92 ```javascript
93 -function cond$0(x$2) {
93 +function cond$0(x$1) {
94 return;
95 }
96
@@ -106,18 +106,18 @@ bb0:
106 While test=bb1 loop=bb3 fallthrough=bb2
107 bb1:
108 predecessor blocks: bb0 bb4
109 - [5] Const mutate $17 = true
110 - If (read $17) then:bb3 else:bb2
109 + [5] Const mutate $10 = true
110 + If (read $10) then:bb3 else:bb2
111 bb3:
112 predecessor blocks: bb1
113 - [6] Let mutate z$19 = read a$2
114 - [7] Reassign mutate a$2 = read b$3
115 - [8] Reassign mutate b$3 = read c$4
113 + [6] Let mutate z$6 = read a$2
114 + [7] Reassign mutate a$2[7:12] = read b$3
115 + [8] Reassign mutate b$3[8:11] = read c$4
116 [9] Reassign mutate c$4 = read d$5
117 - [10] Reassign mutate d$5 = read z$19
117 + [10] Reassign mutate d$5 = read z$6
118 [11] Call mutate mutate$7(mutate a$2, mutate b$3)
119 - [12] Const mutate $29 = Call mutate cond$8(mutate a$2)
120 - If (read $29) then:bb2 else:bb4
119 + [12] Const mutate $9 = Call mutate cond$8(mutate a$2)
120 + If (read $9) then:bb2 else:bb4
121 bb4:
122 predecessor blocks: bb3
123 Goto(Continue) bb1
@@ -135,8 +135,8 @@ bb11:
135 If (read d$5) then:bb13 else:bb13
136 bb13:
137 predecessor blocks: bb11
138 - [13] Const mutate $34 = null
139 - [14] Call mutate mutate$7(mutate d$5, read $34)
138 + [13] Const mutate $11 = null
139 + [14] Call mutate mutate$7(mutate d$5, read $11)
140 Return
141 ```
142
@@ -156,21 +156,21 @@ flowchart TB
156 end
157 subgraph bb1
158 bb1_instrs["
159 - [5] Const mutate $17 = true
159 + [5] Const mutate $10 = true
160 "]
161 - bb1_instrs --> bb1_terminal(["If (read $17)"])
161 + bb1_instrs --> bb1_terminal(["If (read $10)"])
162 end
163 subgraph bb3
164 bb3_instrs["
165 - [6] Let mutate z$19 = read a$2
166 - [7] Reassign mutate a$2 = read b$3
167 - [8] Reassign mutate b$3 = read c$4
165 + [6] Let mutate z$6 = read a$2
166 + [7] Reassign mutate a$2[7:12] = read b$3
167 + [8] Reassign mutate b$3[8:11] = read c$4
168 [9] Reassign mutate c$4 = read d$5
169 - [10] Reassign mutate d$5 = read z$19
169 + [10] Reassign mutate d$5 = read z$6
170 [11] Call mutate mutate$7(mutate a$2, mutate b$3)
171 - [12] Const mutate $29 = Call mutate cond$8(mutate a$2)
171 + [12] Const mutate $9 = Call mutate cond$8(mutate a$2)
172 "]
173 - bb3_instrs --> bb3_terminal(["If (read $29)"])
173 + bb3_instrs --> bb3_terminal(["If (read $9)"])
174 end
175 subgraph bb4
176 bb4_terminal(["Goto"])
@@ -189,8 +189,8 @@ flowchart TB
189 end
190 subgraph bb13
191 bb13_instrs["
192 - [13] Const mutate $34 = null
193 - [14] Call mutate mutate$7(mutate d$5, read $34)
192 + [13] Const mutate $11 = null
193 + [14] Call mutate mutate$7(mutate d$5, read $11)
194 "]
195 bb13_instrs --> bb13_terminal(["Return"])
196 end
@@ -218,17 +218,17 @@ flowchart TB
218 ## Code
219
220 ```javascript
221 -function Component$0(props$12) {
221 +function Component$0(props$1) {
222 let a$2 = {};
223 let b$3 = {};
224 let c$4 = {};
225 let d$5 = {};
226 bb2: while (true) {
227 - let z$19 = a$2;
227 + let z$6 = a$2;
228 a$2 = b$3;
229 b$3 = c$4;
230 c$4 = d$5;
231 - d$5 = z$19;
231 + d$5 = z$6;
232 mutate$7(a$2, b$3);
233
234 bb4: if (cond$8(a$2)) break;
compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md
+44 -44
@@ -58,7 +58,7 @@ flowchart TB
58 ## Code
59
60 ```javascript
61 -function mutate$0(x$3, y$4) {
61 +function mutate$0(x$1, y$2) {
62 return;
63 }
64
@@ -67,30 +67,30 @@ function mutate$0(x$3, y$4) {
67
68 ```
69 bb0:
70 - [1] Const mutate a$11 = Object { }
71 - [2] Const mutate b$12 = Array [read a$11]
72 - [3] Const mutate c$13 = Object { }
73 - [4] Const mutate d$14[4:7] = Object { c: read c$13 }
74 - [5] Const mutate x$15[5:9] = Object { }
75 - [6] Reassign mutate x$15.b[5:9] = read b$12
76 - [7] Const mutate y$16 = Call mutate mutate$8(mutate x$15, mutate d$14)
77 - If (read a$11) then:bb1 else:bb1
70 + [1] Const mutate a$2 = Object { }
71 + [2] Const mutate b$3 = Array [read a$2]
72 + [3] Const mutate c$4 = Object { }
73 + [4] Const mutate d$5[4:7] = Object { c: read c$4 }
74 + [5] Const mutate x$6[5:9] = Object { }
75 + [6] Reassign mutate x$6.b[5:9] = read b$3
76 + [7] Const mutate y$7 = Call mutate mutate$8(mutate x$6, mutate d$5)
77 + If (read a$2) then:bb1 else:bb1
78 bb1:
79 predecessor blocks: bb0
80 - If (read b$12) then:bb3 else:bb3
80 + If (read b$3) then:bb3 else:bb3
81 bb3:
82 predecessor blocks: bb1
83 - If (read c$13) then:bb5 else:bb5
83 + If (read c$4) then:bb5 else:bb5
84 bb5:
85 predecessor blocks: bb3
86 - If (read d$14) then:bb7 else:bb7
86 + If (read d$5) then:bb7 else:bb7
87 bb7:
88 predecessor blocks: bb5
89 - If (read y$16) then:bb9 else:bb9
89 + If (read y$7) then:bb9 else:bb9
90 bb9:
91 predecessor blocks: bb7
92 - [8] Const mutate $17 = null
93 - [9] Call mutate mutate$8(mutate x$15, read $17)
92 + [8] Const mutate $9 = null
93 + [9] Call mutate mutate$8(mutate x$6, read $9)
94 Return
95 ```
96
@@ -101,32 +101,32 @@ flowchart TB
101 %% Basic Blocks
102 subgraph bb0
103 bb0_instrs["
104 - [1] Const mutate a$11 = Object { }
105 - [2] Const mutate b$12 = Array [read a$11]
106 - [3] Const mutate c$13 = Object { }
107 - [4] Const mutate d$14[4:7] = Object { c: read c$13 }
108 - [5] Const mutate x$15[5:9] = Object { }
109 - [6] Reassign mutate x$15.b[5:9] = read b$12
110 - [7] Const mutate y$16 = Call mutate mutate$8(mutate x$15, mutate d$14)
104 + [1] Const mutate a$2 = Object { }
105 + [2] Const mutate b$3 = Array [read a$2]
106 + [3] Const mutate c$4 = Object { }
107 + [4] Const mutate d$5[4:7] = Object { c: read c$4 }
108 + [5] Const mutate x$6[5:9] = Object { }
109 + [6] Reassign mutate x$6.b[5:9] = read b$3
110 + [7] Const mutate y$7 = Call mutate mutate$8(mutate x$6, mutate d$5)
111 "]
112 - bb0_instrs --> bb0_terminal(["If (read a$11)"])
112 + bb0_instrs --> bb0_terminal(["If (read a$2)"])
113 end
114 subgraph bb1
115 - bb1_terminal(["If (read b$12)"])
115 + bb1_terminal(["If (read b$3)"])
116 end
117 subgraph bb3
118 - bb3_terminal(["If (read c$13)"])
118 + bb3_terminal(["If (read c$4)"])
119 end
120 subgraph bb5
121 - bb5_terminal(["If (read d$14)"])
121 + bb5_terminal(["If (read d$5)"])
122 end
123 subgraph bb7
124 - bb7_terminal(["If (read y$16)"])
124 + bb7_terminal(["If (read y$7)"])
125 end
126 subgraph bb9
127 bb9_instrs["
128 - [8] Const mutate $17 = null
129 - [9] Call mutate mutate$8(mutate x$15, read $17)
128 + [8] Const mutate $9 = null
129 + [9] Call mutate mutate$8(mutate x$6, read $9)
130 "]
131 bb9_instrs --> bb9_terminal(["Return"])
132 end
@@ -148,22 +148,22 @@ flowchart TB
148 ## Code
149
150 ```javascript
151 -function Component$0(props$10) {
152 - const a$11 = {};
153 - const b$12 = [a$11];
154 - const c$13 = {};
155 - const d$14 = {
156 - c: c$13,
151 +function Component$0(props$1) {
152 + const a$2 = {};
153 + const b$3 = [a$2];
154 + const c$4 = {};
155 + const d$5 = {
156 + c: c$4,
157 };
158 - const x$15 = {};
159 - x$15.b = b$12;
160 - const y$16 = mutate$8(x$15, d$14);
161 - a$11;
162 - b$12;
163 - c$13;
164 - d$14;
165 - y$16;
166 - mutate$8(x$15, null);
158 + const x$6 = {};
159 + x$6.b = b$3;
160 + const y$7 = mutate$8(x$6, d$5);
161 + a$2;
162 + b$3;
163 + c$4;
164 + d$5;
165 + y$7;
166 + mutate$8(x$6, null);
167 return;
168 }
169
compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md
+42 -42
@@ -94,39 +94,39 @@ function cond$0() {
94
95 ```
96 bb0:
97 - [1] Let mutate a$12[1:7] = Object { }
98 - [2] Let mutate b$13[2:6] = Object { }
99 - [3] Let mutate c$14 = Object { }
100 - [4] Let mutate d$15[4:9] = Object { }
97 + [1] Let mutate a$2[1:7] = Object { }
98 + [2] Let mutate b$3[2:6] = Object { }
99 + [3] Let mutate c$4 = Object { }
100 + [4] Let mutate d$5[4:9] = Object { }
101 While test=bb1 loop=bb3 fallthrough=bb2
102 bb1:
103 predecessor blocks: bb0 bb4
104 - [5] Const mutate $16 = true
105 - If (read $16) then:bb3 else:bb2
104 + [5] Const mutate $9 = true
105 + If (read $9) then:bb3 else:bb2
106 bb3:
107 predecessor blocks: bb1
108 - [6] Call mutate mutate$6(mutate a$12, mutate b$13)
109 - [7] Const mutate $21 = Call mutate cond$7(mutate a$12)
110 - If (read $21) then:bb2 else:bb4
108 + [6] Call mutate mutate$6(mutate a$2, mutate b$3)
109 + [7] Const mutate $8 = Call mutate cond$7(mutate a$2)
110 + If (read $8) then:bb2 else:bb4
111 bb4:
112 predecessor blocks: bb3
113 Goto(Continue) bb1
114 bb2:
115 predecessor blocks: bb3 bb1
116 - If (read a$12) then:bb7 else:bb7
116 + If (read a$2) then:bb7 else:bb7
117 bb7:
118 predecessor blocks: bb2
119 - If (read b$13) then:bb9 else:bb9
119 + If (read b$3) then:bb9 else:bb9
120 bb9:
121 predecessor blocks: bb7
122 - If (read c$14) then:bb11 else:bb11
122 + If (read c$4) then:bb11 else:bb11
123 bb11:
124 predecessor blocks: bb9
125 - If (read d$15) then:bb13 else:bb13
125 + If (read d$5) then:bb13 else:bb13
126 bb13:
127 predecessor blocks: bb11
128 - [8] Const mutate $28 = null
129 - [9] Call mutate mutate$6(mutate d$15, read $28)
128 + [8] Const mutate $10 = null
129 + [9] Call mutate mutate$6(mutate d$5, read $10)
130 Return
131 ```
132
@@ -137,45 +137,45 @@ flowchart TB
137 %% Basic Blocks
138 subgraph bb0
139 bb0_instrs["
140 - [1] Let mutate a$12[1:7] = Object { }
141 - [2] Let mutate b$13[2:6] = Object { }
142 - [3] Let mutate c$14 = Object { }
143 - [4] Let mutate d$15[4:9] = Object { }
140 + [1] Let mutate a$2[1:7] = Object { }
141 + [2] Let mutate b$3[2:6] = Object { }
142 + [3] Let mutate c$4 = Object { }
143 + [4] Let mutate d$5[4:9] = Object { }
144 "]
145 bb0_instrs --> bb0_terminal(["While"])
146 end
147 subgraph bb1
148 bb1_instrs["
149 - [5] Const mutate $16 = true
149 + [5] Const mutate $9 = true
150 "]
151 - bb1_instrs --> bb1_terminal(["If (read $16)"])
151 + bb1_instrs --> bb1_terminal(["If (read $9)"])
152 end
153 subgraph bb3
154 bb3_instrs["
155 - [6] Call mutate mutate$6(mutate a$12, mutate b$13)
156 - [7] Const mutate $21 = Call mutate cond$7(mutate a$12)
155 + [6] Call mutate mutate$6(mutate a$2, mutate b$3)
156 + [7] Const mutate $8 = Call mutate cond$7(mutate a$2)
157 "]
158 - bb3_instrs --> bb3_terminal(["If (read $21)"])
158 + bb3_instrs --> bb3_terminal(["If (read $8)"])
159 end
160 subgraph bb4
161 bb4_terminal(["Goto"])
162 end
163 subgraph bb2
164 - bb2_terminal(["If (read a$12)"])
164 + bb2_terminal(["If (read a$2)"])
165 end
166 subgraph bb7
167 - bb7_terminal(["If (read b$13)"])
167 + bb7_terminal(["If (read b$3)"])
168 end
169 subgraph bb9
170 - bb9_terminal(["If (read c$14)"])
170 + bb9_terminal(["If (read c$4)"])
171 end
172 subgraph bb11
173 - bb11_terminal(["If (read d$15)"])
173 + bb11_terminal(["If (read d$5)"])
174 end
175 subgraph bb13
176 bb13_instrs["
177 - [8] Const mutate $28 = null
178 - [9] Call mutate mutate$6(mutate d$15, read $28)
177 + [8] Const mutate $10 = null
178 + [9] Call mutate mutate$6(mutate d$5, read $10)
179 "]
180 bb13_instrs --> bb13_terminal(["Return"])
181 end
@@ -203,22 +203,22 @@ flowchart TB
203 ## Code
204
205 ```javascript
206 -function Component$0(props$11) {
207 - let a$12 = {};
208 - let b$13 = {};
209 - let c$14 = {};
210 - let d$15 = {};
206 +function Component$0(props$1) {
207 + let a$2 = {};
208 + let b$3 = {};
209 + let c$4 = {};
210 + let d$5 = {};
211 bb2: while (true) {
212 - mutate$6(a$12, b$13);
212 + mutate$6(a$2, b$3);
213
214 - bb4: if (cond$7(a$12)) break;
214 + bb4: if (cond$7(a$2)) break;
215 }
216
217 - a$12;
218 - b$13;
219 - c$14;
220 - d$15;
221 - mutate$6(d$15, null);
217 + a$2;
218 + b$3;
219 + c$4;
220 + d$5;
221 + mutate$6(d$5, null);
222 return;
223 }
224
compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md
+21 -21
@@ -17,13 +17,13 @@ function Component(props) {
17
18 ```
19 bb0:
20 - [1] Const mutate x$7[1:5] = Object { }
21 - [2] Const mutate y$8 = Array []
22 - [3] Reassign mutate x$7.y[1:5] = read y$8
23 - [4] Const mutate child$9 = JSX <read Component$0 data={freeze y$8} ></read Component$0>
24 - [5] Call mutate x$7.y.push(read props$6.p0)
25 - [6] Const mutate $10 = JSX <read Component$0 data={freeze x$7} >{read child$9}</read Component$0>
26 - Return read $10
20 + [1] Const mutate x$2[1:5] = Object { }
21 + [2] Const mutate y$3 = Array []
22 + [3] Reassign mutate x$2.y[1:5] = read y$3
23 + [4] Const mutate child$4 = JSX <read Component$0 data={freeze y$3} ></read Component$0>
24 + [5] Call mutate x$2.y.push(read props$1.p0)
25 + [6] Const mutate $5 = JSX <read Component$0 data={freeze x$2} >{read child$4}</read Component$0>
26 + Return read $5
27 ```
28
29 ### CFG
@@ -33,14 +33,14 @@ flowchart TB
33 %% Basic Blocks
34 subgraph bb0
35 bb0_instrs["
36 - [1] Const mutate x$7[1:5] = Object { }
37 - [2] Const mutate y$8 = Array []
38 - [3] Reassign mutate x$7.y[1:5] = read y$8
39 - [4] Const mutate child$9 = JSX <read Component$0 data={freeze y$8} ></read Component$0>
40 - [5] Call mutate x$7.y.push(read props$6.p0)
41 - [6] Const mutate $10 = JSX <read Component$0 data={freeze x$7} >{read child$9}</read Component$0>
36 + [1] Const mutate x$2[1:5] = Object { }
37 + [2] Const mutate y$3 = Array []
38 + [3] Reassign mutate x$2.y[1:5] = read y$3
39 + [4] Const mutate child$4 = JSX <read Component$0 data={freeze y$3} ></read Component$0>
40 + [5] Call mutate x$2.y.push(read props$1.p0)
41 + [6] Const mutate $5 = JSX <read Component$0 data={freeze x$2} >{read child$4}</read Component$0>
42 "]
43 - bb0_instrs --> bb0_terminal(["Return read $10"])
43 + bb0_instrs --> bb0_terminal(["Return read $5"])
44 end
45
46 %% Jumps
@@ -50,13 +50,13 @@ flowchart TB
50 ## Code
51
52 ```javascript
53 -function Component$0(props$6) {
54 - const x$7 = {};
55 - const y$8 = [];
56 - x$7.y = y$8;
57 - const child$9 = <Component$0 data={y$8}></Component$0>;
58 - x$7.y.push(props$6.p0);
59 - return <Component$0 data={x$7}>{child$9}</Component$0>;
53 +function Component$0(props$1) {
54 + const x$2 = {};
55 + const y$3 = [];
56 + x$2.y = y$3;
57 + const child$4 = <Component$0 data={y$3}></Component$0>;
58 + x$2.y.push(props$1.p0);
59 + return <Component$0 data={x$2}>{child$4}</Component$0>;
60 }
61
62 ```
compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md
+23 -23
@@ -23,20 +23,20 @@ function Component(props) {
23
24 ```
25 bb0:
26 - [1] Let mutate x$2 = Array []
27 - [2] Call mutate x$2.push(read props$6.p0)
28 - [3] Let mutate y$8 = read x$2
29 - If (read props$6.p1) then:bb2 else:bb1
26 + [1] Let mutate x$2[1:2] = Array []
27 + [2] Call mutate x$2.push(read props$1.p0)
28 + [3] Let mutate y$3 = read x$2
29 + If (read props$1.p1) then:bb2 else:bb1
30 bb2:
31 predecessor blocks: bb0
32 [4] Reassign mutate x$2 = Array []
33 Goto bb1
34 bb1:
35 predecessor blocks: bb2 bb0
36 - [5] Let mutate _$12 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
37 - [6] Call read y$8.push(read props$6.p2)
38 - [7] Const mutate $15 = JSX <read Component$0 x={read x$2} y={read y$8} ></read Component$0>
39 - Return read $15
36 + [5] Let mutate _$4 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
37 + [6] Call read y$3.push(read props$1.p2)
38 + [7] Const mutate $5 = JSX <read Component$0 x={read x$2} y={read y$3} ></read Component$0>
39 + Return read $5
40 ```
41
42 ### CFG
@@ -46,11 +46,11 @@ flowchart TB
46 %% Basic Blocks
47 subgraph bb0
48 bb0_instrs["
49 - [1] Let mutate x$2 = Array []
50 - [2] Call mutate x$2.push(read props$6.p0)
51 - [3] Let mutate y$8 = read x$2
49 + [1] Let mutate x$2[1:2] = Array []
50 + [2] Call mutate x$2.push(read props$1.p0)
51 + [3] Let mutate y$3 = read x$2
52 "]
53 - bb0_instrs --> bb0_terminal(["If (read props$6.p1)"])
53 + bb0_instrs --> bb0_terminal(["If (read props$1.p1)"])
54 end
55 subgraph bb2
56 bb2_instrs["
@@ -60,11 +60,11 @@ flowchart TB
60 end
61 subgraph bb1
62 bb1_instrs["
63 - [5] Let mutate _$12 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
64 - [6] Call read y$8.push(read props$6.p2)
65 - [7] Const mutate $15 = JSX <read Component$0 x={read x$2} y={read y$8} ></read Component$0>
63 + [5] Let mutate _$4 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
64 + [6] Call read y$3.push(read props$1.p2)
65 + [7] Const mutate $5 = JSX <read Component$0 x={read x$2} y={read y$3} ></read Component$0>
66 "]
67 - bb1_instrs --> bb1_terminal(["Return read $15"])
67 + bb1_instrs --> bb1_terminal(["Return read $5"])
68 end
69
70 %% Jumps
@@ -77,18 +77,18 @@ flowchart TB
77 ## Code
78
79 ```javascript
80 -function Component$0(props$6) {
80 +function Component$0(props$1) {
81 let x$2 = [];
82 - x$2.push(props$6.p0);
83 - let y$8 = x$2;
84 - bb1: if (props$6.p1) {
82 + x$2.push(props$1.p0);
83 + let y$3 = x$2;
84 + bb1: if (props$1.p1) {
85 x$2 = [];
86 }
87
88 - let _$12 = <Component$0 x={x$2}></Component$0>;
88 + let _$4 = <Component$0 x={x$2}></Component$0>;
89
90 - y$8.push(props$6.p2);
91 - return <Component$0 x={x$2} y={y$8}></Component$0>;
90 + y$3.push(props$1.p2);
91 + return <Component$0 x={x$2} y={y$3}></Component$0>;
92 }
93
94 ```
compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md
+24 -24
@@ -21,14 +21,14 @@ function Component(props) {
21
22 ```
23 bb0:
24 - [1] Let mutate x$7[1:2] = Array []
25 - [2] Call mutate x$7.push(read props$6.p0)
26 - [3] Let mutate y$8[3:6] = read x$7
27 - [4] Reassign mutate x$9 = Array []
28 - [5] Let mutate _$10 = JSX <read Component$0 x={freeze x$9} ></read Component$0>
29 - [6] Call mutate y$8.push(read props$6.p1)
30 - [7] Const mutate $11 = JSX <read Component$0 x={read x$9} y={freeze y$8} ></read Component$0>
31 - Return read $11
24 + [1] Let mutate x$2[1:2] = Array []
25 + [2] Call mutate x$2.push(read props$1.p0)
26 + [3] Let mutate y$3[3:6] = read x$2
27 + [4] Reassign mutate x$2 = Array []
28 + [5] Let mutate _$4 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
29 + [6] Call mutate y$3.push(read props$1.p1)
30 + [7] Const mutate $5 = JSX <read Component$0 x={read x$2} y={freeze y$3} ></read Component$0>
31 + Return read $5
32 ```
33
34 ### CFG
@@ -38,15 +38,15 @@ flowchart TB
38 %% Basic Blocks
39 subgraph bb0
40 bb0_instrs["
41 - [1] Let mutate x$7[1:2] = Array []
42 - [2] Call mutate x$7.push(read props$6.p0)
43 - [3] Let mutate y$8[3:6] = read x$7
44 - [4] Reassign mutate x$9 = Array []
45 - [5] Let mutate _$10 = JSX <read Component$0 x={freeze x$9} ></read Component$0>
46 - [6] Call mutate y$8.push(read props$6.p1)
47 - [7] Const mutate $11 = JSX <read Component$0 x={read x$9} y={freeze y$8} ></read Component$0>
41 + [1] Let mutate x$2[1:2] = Array []
42 + [2] Call mutate x$2.push(read props$1.p0)
43 + [3] Let mutate y$3[3:6] = read x$2
44 + [4] Reassign mutate x$2 = Array []
45 + [5] Let mutate _$4 = JSX <read Component$0 x={freeze x$2} ></read Component$0>
46 + [6] Call mutate y$3.push(read props$1.p1)
47 + [7] Const mutate $5 = JSX <read Component$0 x={read x$2} y={freeze y$3} ></read Component$0>
48 "]
49 - bb0_instrs --> bb0_terminal(["Return read $11"])
49 + bb0_instrs --> bb0_terminal(["Return read $5"])
50 end
51
52 %% Jumps
@@ -56,15 +56,15 @@ flowchart TB
56 ## Code
57
58 ```javascript
59 -function Component$0(props$6) {
60 - let x$7 = [];
61 - x$7.push(props$6.p0);
62 - let y$8 = x$7;
63 - x$9 = [];
64 - let _$10 = <Component$0 x={x$9}></Component$0>;
59 +function Component$0(props$1) {
60 + let x$2 = [];
61 + x$2.push(props$1.p0);
62 + let y$3 = x$2;
63 + x$2 = [];
64 + let _$4 = <Component$0 x={x$2}></Component$0>;
65
66 - y$8.push(props$6.p1);
67 - return <Component$0 x={x$9} y={y$8}></Component$0>;
66 + y$3.push(props$1.p1);
67 + return <Component$0 x={x$2} y={y$3}></Component$0>;
68 }
69
70 ```
compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md
+40 -40
@@ -36,40 +36,40 @@ function Component(props) {
36
37 ```
38 bb0:
39 - [1] Let mutate x$7 = undefined
40 - If (read props$6.cond) then:bb2 else:bb10
39 + [1] Let mutate x$2 = undefined
40 + If (read props$1.cond) then:bb2 else:bb10
41 bb2:
42 predecessor blocks: bb0
43 - [2] Const mutate $8 = 2
44 - [3] Const mutate $9 = 1
45 - [4] Const mutate $10 = 0
46 - Switch (read props$6.test)
47 - Case read $10: bb8
48 - Case read $9: bb6
49 - Case read $8: bb4
43 + [2] Const mutate $3 = 2
44 + [3] Const mutate $4 = 1
45 + [4] Const mutate $5 = 0
46 + Switch (read props$1.test)
47 + Case read $5: bb8
48 + Case read $4: bb6
49 + Case read $3: bb4
50 Default: bb4
51 bb8:
52 predecessor blocks: bb2
53 - [5] Reassign mutate x$2 = read props$6.v0
53 + [5] Reassign mutate x$2 = read props$1.v0
54 Goto bb1
55 bb6:
56 predecessor blocks: bb2
57 - [6] Reassign mutate x$2 = read props$6.v1
57 + [6] Reassign mutate x$2 = read props$1.v1
58 Goto bb1
59 bb4:
60 predecessor blocks: bb2
61 - [7] Reassign mutate x$2 = read props$6.v2
61 + [7] Reassign mutate x$2 = read props$1.v2
62 Goto bb1
63 bb10:
64 predecessor blocks: bb0
65 - If (read props$6.cond2) then:bb12 else:bb13
65 + If (read props$1.cond2) then:bb12 else:bb13
66 bb12:
67 predecessor blocks: bb10
68 - [8] Reassign mutate x$2 = read props$6.b
68 + [8] Reassign mutate x$2 = read props$1.b
69 Goto bb1
70 bb13:
71 predecessor blocks: bb10
72 - [9] Reassign mutate x$2 = read props$6.c
72 + [9] Reassign mutate x$2 = read props$1.c
73 Goto bb1
74 bb1:
75 predecessor blocks: bb8 bb6 bb4 bb12 bb13
@@ -84,48 +84,48 @@ flowchart TB
84 %% Basic Blocks
85 subgraph bb0
86 bb0_instrs["
87 - [1] Let mutate x$7 = undefined
87 + [1] Let mutate x$2 = undefined
88 "]
89 - bb0_instrs --> bb0_terminal(["If (read props$6.cond)"])
89 + bb0_instrs --> bb0_terminal(["If (read props$1.cond)"])
90 end
91 subgraph bb2
92 bb2_instrs["
93 - [2] Const mutate $8 = 2
94 - [3] Const mutate $9 = 1
95 - [4] Const mutate $10 = 0
93 + [2] Const mutate $3 = 2
94 + [3] Const mutate $4 = 1
95 + [4] Const mutate $5 = 0
96 "]
97 - bb2_instrs --> bb2_terminal(["Switch (read props$6.test)"])
97 + bb2_instrs --> bb2_terminal(["Switch (read props$1.test)"])
98 end
99 subgraph bb8
100 bb8_instrs["
101 - [5] Reassign mutate x$2 = read props$6.v0
101 + [5] Reassign mutate x$2 = read props$1.v0
102 "]
103 bb8_instrs --> bb8_terminal(["Goto"])
104 end
105 subgraph bb6
106 bb6_instrs["
107 - [6] Reassign mutate x$2 = read props$6.v1
107 + [6] Reassign mutate x$2 = read props$1.v1
108 "]
109 bb6_instrs --> bb6_terminal(["Goto"])
110 end
111 subgraph bb4
112 bb4_instrs["
113 - [7] Reassign mutate x$2 = read props$6.v2
113 + [7] Reassign mutate x$2 = read props$1.v2
114 "]
115 bb4_instrs --> bb4_terminal(["Goto"])
116 end
117 subgraph bb10
118 - bb10_terminal(["If (read props$6.cond2)"])
118 + bb10_terminal(["If (read props$1.cond2)"])
119 end
120 subgraph bb12
121 bb12_instrs["
122 - [8] Reassign mutate x$2 = read props$6.b
122 + [8] Reassign mutate x$2 = read props$1.b
123 "]
124 bb12_instrs --> bb12_terminal(["Goto"])
125 end
126 subgraph bb13
127 bb13_instrs["
128 - [9] Reassign mutate x$2 = read props$6.c
128 + [9] Reassign mutate x$2 = read props$1.c
129 "]
130 bb13_instrs --> bb13_terminal(["Goto"])
131 end
@@ -140,9 +140,9 @@ flowchart TB
140 bb0_terminal -- then --> bb2
141 bb0_terminal -- else --> bb10
142 bb0_terminal -- fallthrough --> bb1
143 - bb2_terminal -- read $10 --> bb8
144 - bb2_terminal -- read $9 --> bb6
145 - bb2_terminal -- read $8 --> bb4
143 + bb2_terminal -- read $5 --> bb8
144 + bb2_terminal -- read $4 --> bb6
145 + bb2_terminal -- read $3 --> bb4
146 bb2_terminal -- default --> bb4
147 bb2_terminal -- fallthrough --> bb1
148 bb8_terminal --> bb1
@@ -159,17 +159,17 @@ flowchart TB
159 ## Code
160
161 ```javascript
162 -function Component$0(props$6) {
163 - let x$7 = undefined;
164 - bb1: if (props$6.cond) {
165 - switch (props$6.test) {
162 +function Component$0(props$1) {
163 + let x$2 = undefined;
164 + bb1: if (props$1.cond) {
165 + switch (props$1.test) {
166 case 0: {
167 - x$2 = props$6.v0;
167 + x$2 = props$1.v0;
168 break bb1;
169 }
170
171 case 1: {
172 - x$2 = props$6.v1;
172 + x$2 = props$1.v1;
173 break bb1;
174 }
175
@@ -177,14 +177,14 @@ function Component$0(props$6) {
177 }
178
179 default: {
180 - x$2 = props$6.v2;
180 + x$2 = props$1.v2;
181 }
182 }
183 } else {
184 - if (props$6.cond2) {
185 - x$2 = props$6.b;
184 + if (props$1.cond2) {
185 + x$2 = props$1.b;
186 } else {
187 - x$2 = props$6.c;
187 + x$2 = props$1.c;
188 }
189 }
190
compiler/forget/src/__tests__/fixtures/hir/simple.expect.md
+20 -20
@@ -15,18 +15,18 @@ function foo(x, y) {
15
16 ```
17 bb0:
18 - If (read x$8) then:bb2 else:bb1
18 + If (read x$1) then:bb2 else:bb1
19 bb2:
20 predecessor blocks: bb0
21 - [1] Const mutate $10 = false
22 - [2] Const mutate $11 = Call read foo$0(read $10, read y$9)
23 - Return freeze $11
21 + [1] Const mutate $3 = false
22 + [2] Const mutate $4 = Call read foo$0(read $3, read y$2)
23 + Return freeze $4
24 bb1:
25 predecessor blocks: bb0
26 - [3] Const mutate $12 = 10
27 - [4] Const mutate $13 = Binary read y$9 * read $12
28 - [5] Const mutate $14 = Array [read $13]
29 - Return freeze $14
26 + [3] Const mutate $5 = 10
27 + [4] Const mutate $6 = Binary read y$2 * read $5
28 + [5] Const mutate $7 = Array [read $6]
29 + Return freeze $7
30 ```
31
32 ### CFG
@@ -35,22 +35,22 @@ bb1:
35 flowchart TB
36 %% Basic Blocks
37 subgraph bb0
38 - bb0_terminal(["If (read x$8)"])
38 + bb0_terminal(["If (read x$1)"])
39 end
40 subgraph bb2
41 bb2_instrs["
42 - [1] Const mutate $10 = false
43 - [2] Const mutate $11 = Call read foo$0(read $10, read y$9)
42 + [1] Const mutate $3 = false
43 + [2] Const mutate $4 = Call read foo$0(read $3, read y$2)
44 "]
45 - bb2_instrs --> bb2_terminal(["Return freeze $11"])
45 + bb2_instrs --> bb2_terminal(["Return freeze $4"])
46 end
47 subgraph bb1
48 bb1_instrs["
49 - [3] Const mutate $12 = 10
50 - [4] Const mutate $13 = Binary read y$9 * read $12
51 - [5] Const mutate $14 = Array [read $13]
49 + [3] Const mutate $5 = 10
50 + [4] Const mutate $6 = Binary read y$2 * read $5
51 + [5] Const mutate $7 = Array [read $6]
52 "]
53 - bb1_instrs --> bb1_terminal(["Return freeze $14"])
53 + bb1_instrs --> bb1_terminal(["Return freeze $7"])
54 end
55
56 %% Jumps
@@ -62,11 +62,11 @@ flowchart TB
62 ## Code
63
64 ```javascript
65 -function foo$0(x$8, y$9) {
66 - bb1: if (x$8) {
67 - return foo$0(false, y$9);
65 +function foo$0(x$1, y$2) {
66 + bb1: if (x$1) {
67 + return foo$0(false, y$2);
68 }
69 - return [y$9 * 10];
69 + return [y$2 * 10];
70 }
71
72 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md
+13 -13
@@ -15,10 +15,10 @@ function Component(props) {
15
16 ```
17 bb0:
18 - [1] Const mutate a$6 = 1
19 - [2] Const mutate b$7 = 2
20 - [3] Const mutate x$8 = Array [read a$6, read b$7]
21 - Return freeze x$8
18 + [1] Const mutate a$2 = 1
19 + [2] Const mutate b$3 = 2
20 + [3] Const mutate x$4 = Array [read a$2, read b$3]
21 + Return freeze x$4
22 ```
23
24 ### CFG
@@ -28,11 +28,11 @@ flowchart TB
28 %% Basic Blocks
29 subgraph bb0
30 bb0_instrs["
31 - [1] Const mutate a$6 = 1
32 - [2] Const mutate b$7 = 2
33 - [3] Const mutate x$8 = Array [read a$6, read b$7]
31 + [1] Const mutate a$2 = 1
32 + [2] Const mutate b$3 = 2
33 + [3] Const mutate x$4 = Array [read a$2, read b$3]
34 "]
35 - bb0_instrs --> bb0_terminal(["Return freeze x$8"])
35 + bb0_instrs --> bb0_terminal(["Return freeze x$4"])
36 end
37
38 %% Jumps
@@ -42,11 +42,11 @@ flowchart TB
42 ## Code
43
44 ```javascript
45 -function Component$0(props$5) {
46 - const a$6 = 1;
47 - const b$7 = 2;
48 - const x$8 = [a$6, b$7];
49 - return x$8;
45 +function Component$0(props$1) {
46 + const a$2 = 1;
47 + const b$3 = 2;
48 + const x$4 = [a$2, b$3];
49 + return x$4;
50 }
51
52 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md
+29 -29
@@ -50,22 +50,22 @@ function foo$0() {
50
51 ```
52 bb0:
53 - [1] Const mutate a$11[1:3] = Array []
54 - [2] Const mutate b$12[2:7] = Object { }
55 - [3] Call mutate foo$4(mutate a$11, mutate b$12)
56 - [4] Const mutate $13 = Call mutate foo$4()
57 - If (read $13) then:bb2 else:bb1
53 + [1] Const mutate a$2[1:3] = Array []
54 + [2] Const mutate b$3[2:7] = Object { }
55 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
56 + [4] Const mutate $7 = Call mutate foo$4()
57 + If (read $7) then:bb2 else:bb1
58 bb2:
59 predecessor blocks: bb0
60 - [5] Const mutate $14 = "div"
61 - [6] Let mutate _$15 = JSX <read $14 a={freeze a$11} ></read $14>
60 + [5] Const mutate $6 = "div"
61 + [6] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
62 Goto bb1
63 bb1:
64 predecessor blocks: bb2 bb0
65 - [7] Call mutate foo$4(read a$11, mutate b$12)
66 - [8] Const mutate $19 = "div"
67 - [9] Const mutate $20 = JSX <read $19 a={freeze a$11} b={freeze b$12} ></read $19>
68 - Return read $20
65 + [7] Call mutate foo$4(read a$2, mutate b$3)
66 + [8] Const mutate $8 = "div"
67 + [9] Const mutate $9 = JSX <read $8 a={freeze a$2} b={freeze b$3} ></read $8>
68 + Return read $9
69 ```
70
71 ### CFG
@@ -75,27 +75,27 @@ flowchart TB
75 %% Basic Blocks
76 subgraph bb0
77 bb0_instrs["
78 - [1] Const mutate a$11[1:3] = Array []
79 - [2] Const mutate b$12[2:7] = Object { }
80 - [3] Call mutate foo$4(mutate a$11, mutate b$12)
81 - [4] Const mutate $13 = Call mutate foo$4()
78 + [1] Const mutate a$2[1:3] = Array []
79 + [2] Const mutate b$3[2:7] = Object { }
80 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
81 + [4] Const mutate $7 = Call mutate foo$4()
82 "]
83 - bb0_instrs --> bb0_terminal(["If (read $13)"])
83 + bb0_instrs --> bb0_terminal(["If (read $7)"])
84 end
85 subgraph bb2
86 bb2_instrs["
87 - [5] Const mutate $14 = 'div'
88 - [6] Let mutate _$15 = JSX <read $14 a={freeze a$11} ></read $14>
87 + [5] Const mutate $6 = 'div'
88 + [6] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
89 "]
90 bb2_instrs --> bb2_terminal(["Goto"])
91 end
92 subgraph bb1
93 bb1_instrs["
94 - [7] Call mutate foo$4(read a$11, mutate b$12)
95 - [8] Const mutate $19 = 'div'
96 - [9] Const mutate $20 = JSX <read $19 a={freeze a$11} b={freeze b$12} ></read $19>
94 + [7] Call mutate foo$4(read a$2, mutate b$3)
95 + [8] Const mutate $8 = 'div'
96 + [9] Const mutate $9 = JSX <read $8 a={freeze a$2} b={freeze b$3} ></read $8>
97 "]
98 - bb1_instrs --> bb1_terminal(["Return read $20"])
98 + bb1_instrs --> bb1_terminal(["Return read $9"])
99 end
100
101 %% Jumps
@@ -108,16 +108,16 @@ flowchart TB
108 ## Code
109
110 ```javascript
111 -function Component$0(props$10) {
112 - const a$11 = [];
113 - const b$12 = {};
114 - foo$4(a$11, b$12);
111 +function Component$0(props$1) {
112 + const a$2 = [];
113 + const b$3 = {};
114 + foo$4(a$2, b$3);
115 bb1: if (foo$4()) {
116 - let _$15 = <div a={a$11}></div>;
116 + let _$5 = <div a={a$2}></div>;
117 }
118
119 - foo$4(a$11, b$12);
120 - return <div a={a$11} b={b$12}></div>;
119 + foo$4(a$2, b$3);
120 + return <div a={a$2} b={b$3}></div>;
121 }
122
123 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md
+26 -26
@@ -47,15 +47,15 @@ function foo$0() {
47
48 ```
49 bb0:
50 - [1] Const mutate a$10[1:3] = Array []
51 - [2] Const mutate b$11[2:6] = Object { }
52 - [3] Call mutate foo$4(mutate a$10, mutate b$11)
53 - [4] Const mutate $12 = "div"
54 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
55 - [6] Call mutate foo$4(read a$10, mutate b$11)
56 - [7] Const mutate $14 = "div"
57 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
58 - Return read $15
50 + [1] Const mutate a$2[1:3] = Array []
51 + [2] Const mutate b$3[2:6] = Object { }
52 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
53 + [4] Const mutate $6 = "div"
54 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
55 + [6] Call mutate foo$4(read a$2, mutate b$3)
56 + [7] Const mutate $7 = "div"
57 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
58 + Return read $8
59 ```
60
61 ### CFG
@@ -65,16 +65,16 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Const mutate a$10[1:3] = Array []
69 - [2] Const mutate b$11[2:6] = Object { }
70 - [3] Call mutate foo$4(mutate a$10, mutate b$11)
71 - [4] Const mutate $12 = 'div'
72 - [5] Let mutate _$13 = JSX <read $12 a={freeze a$10} ></read $12>
73 - [6] Call mutate foo$4(read a$10, mutate b$11)
74 - [7] Const mutate $14 = 'div'
75 - [8] Const mutate $15 = JSX <read $14 a={read a$10} b={freeze b$11} ></read $14>
68 + [1] Const mutate a$2[1:3] = Array []
69 + [2] Const mutate b$3[2:6] = Object { }
70 + [3] Call mutate foo$4(mutate a$2, mutate b$3)
71 + [4] Const mutate $6 = 'div'
72 + [5] Let mutate _$5 = JSX <read $6 a={freeze a$2} ></read $6>
73 + [6] Call mutate foo$4(read a$2, mutate b$3)
74 + [7] Const mutate $7 = 'div'
75 + [8] Const mutate $8 = JSX <read $7 a={read a$2} b={freeze b$3} ></read $7>
76 "]
77 - bb0_instrs --> bb0_terminal(["Return read $15"])
77 + bb0_instrs --> bb0_terminal(["Return read $8"])
78 end
79
80 %% Jumps
@@ -84,14 +84,14 @@ flowchart TB
84 ## Code
85
86 ```javascript
87 -function Component$0(props$9) {
88 - const a$10 = [];
89 - const b$11 = {};
90 - foo$4(a$10, b$11);
91 - let _$13 = <div a={a$10}></div>;
92 -
93 - foo$4(a$10, b$11);
94 - return <div a={a$10} b={b$11}></div>;
87 +function Component$0(props$1) {
88 + const a$2 = [];
89 + const b$3 = {};
90 + foo$4(a$2, b$3);
91 + let _$5 = <div a={a$2}></div>;
92 +
93 + foo$4(a$2, b$3);
94 + return <div a={a$2} b={b$3}></div>;
95 }
96
97 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md
+20 -20
@@ -22,26 +22,26 @@ function foo() {
22 ```
23 bb0:
24 [1] Let mutate x$1 = 1
25 - [2] Let mutate y$8 = 2
26 - [3] Const mutate $9 = 2
27 - [4] Const mutate $10 = Binary read y$8 === read $9
28 - If (read $10) then:bb2 else:bb1
25 + [2] Let mutate y$2 = 2
26 + [3] Const mutate $3 = 2
27 + [4] Const mutate $4 = Binary read y$2 === read $3
28 + If (read $4) then:bb2 else:bb1
29 bb2:
30 predecessor blocks: bb0
31 [5] Reassign mutate x$1 = 3
32 Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb0
35 - [6] Const mutate $12 = 3
36 - [7] Const mutate $14 = Binary read y$8 === read $12
37 - If (read $14) then:bb4 else:bb3
35 + [6] Const mutate $5 = 3
36 + [7] Const mutate $6 = Binary read y$2 === read $5
37 + If (read $6) then:bb4 else:bb3
38 bb4:
39 predecessor blocks: bb1
40 [8] Reassign mutate x$1 = 5
41 Goto bb3
42 bb3:
43 predecessor blocks: bb4 bb1
44 - [9] Reassign mutate y$18 = read x$1
44 + [9] Reassign mutate y$2 = read x$1
45 Return
46 ```
47
@@ -53,11 +53,11 @@ flowchart TB
53 subgraph bb0
54 bb0_instrs["
55 [1] Let mutate x$1 = 1
56 - [2] Let mutate y$8 = 2
57 - [3] Const mutate $9 = 2
58 - [4] Const mutate $10 = Binary read y$8 === read $9
56 + [2] Let mutate y$2 = 2
57 + [3] Const mutate $3 = 2
58 + [4] Const mutate $4 = Binary read y$2 === read $3
59 "]
60 - bb0_instrs --> bb0_terminal(["If (read $10)"])
60 + bb0_instrs --> bb0_terminal(["If (read $4)"])
61 end
62 subgraph bb2
63 bb2_instrs["
@@ -67,10 +67,10 @@ flowchart TB
67 end
68 subgraph bb1
69 bb1_instrs["
70 - [6] Const mutate $12 = 3
71 - [7] Const mutate $14 = Binary read y$8 === read $12
70 + [6] Const mutate $5 = 3
71 + [7] Const mutate $6 = Binary read y$2 === read $5
72 "]
73 - bb1_instrs --> bb1_terminal(["If (read $14)"])
73 + bb1_instrs --> bb1_terminal(["If (read $6)"])
74 end
75 subgraph bb4
76 bb4_instrs["
@@ -80,7 +80,7 @@ flowchart TB
80 end
81 subgraph bb3
82 bb3_instrs["
83 - [9] Reassign mutate y$18 = read x$1
83 + [9] Reassign mutate y$2 = read x$1
84 "]
85 bb3_instrs --> bb3_terminal(["Return"])
86 end
@@ -100,16 +100,16 @@ flowchart TB
100 ```javascript
101 function foo$0() {
102 let x$1 = 1;
103 - let y$8 = 2;
104 - bb1: if (y$8 === 2) {
103 + let y$2 = 2;
104 + bb1: if (y$2 === 2) {
105 x$1 = 3;
106 }
107
108 - bb3: if (y$8 === 3) {
108 + bb3: if (y$2 === 3) {
109 x$1 = 5;
110 }
111
112 - y$18 = x$1;
112 + y$2 = x$1;
113 return;
114 }
115
compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md
+13 -13
@@ -19,17 +19,17 @@ function foo() {
19 ```
20 bb0:
21 [1] Let mutate x$1 = 1
22 - [2] Let mutate y$6 = 2
23 - [3] Const mutate $7 = 2
24 - [4] Const mutate $8 = Binary read y$6 === read $7
25 - If (read $8) then:bb2 else:bb1
22 + [2] Let mutate y$2 = 2
23 + [3] Const mutate $3 = 2
24 + [4] Const mutate $4 = Binary read y$2 === read $3
25 + If (read $4) then:bb2 else:bb1
26 bb2:
27 predecessor blocks: bb0
28 [5] Reassign mutate x$1 = 3
29 Goto bb1
30 bb1:
31 predecessor blocks: bb2 bb0
32 - [6] Reassign mutate y$11 = read x$1
32 + [6] Reassign mutate y$2 = read x$1
33 Return
34 ```
35
@@ -41,11 +41,11 @@ flowchart TB
41 subgraph bb0
42 bb0_instrs["
43 [1] Let mutate x$1 = 1
44 - [2] Let mutate y$6 = 2
45 - [3] Const mutate $7 = 2
46 - [4] Const mutate $8 = Binary read y$6 === read $7
44 + [2] Let mutate y$2 = 2
45 + [3] Const mutate $3 = 2
46 + [4] Const mutate $4 = Binary read y$2 === read $3
47 "]
48 - bb0_instrs --> bb0_terminal(["If (read $8)"])
48 + bb0_instrs --> bb0_terminal(["If (read $4)"])
49 end
50 subgraph bb2
51 bb2_instrs["
@@ -55,7 +55,7 @@ flowchart TB
55 end
56 subgraph bb1
57 bb1_instrs["
58 - [6] Reassign mutate y$11 = read x$1
58 + [6] Reassign mutate y$2 = read x$1
59 "]
60 bb1_instrs --> bb1_terminal(["Return"])
61 end
@@ -72,12 +72,12 @@ flowchart TB
72 ```javascript
73 function foo$0() {
74 let x$1 = 1;
75 - let y$6 = 2;
76 - bb1: if (y$6 === 2) {
75 + let y$2 = 2;
76 + bb1: if (y$2 === 2) {
77 x$1 = 3;
78 }
79
80 - y$11 = x$1;
80 + y$2 = x$1;
81 return;
82 }
83
compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md
+14 -14
@@ -19,25 +19,25 @@ function foo(cond) {
19
20 ```
21 bb0:
22 - [1] Let mutate items$5 = Array []
22 + [1] Let mutate items$2 = Array []
23 Goto bb1
24 bb1:
25 predecessor blocks: bb0 bb4
26 - If (read items$5) then:bb3 else:bb2
26 + If (read items$2) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [2] Let mutate y$7 = 0
30 - If (read cond$4) then:bb5 else:bb4
29 + [2] Let mutate y$3 = 0
30 + If (read cond$1) then:bb5 else:bb4
31 bb5:
32 predecessor blocks: bb3
33 - [3] Reassign mutate y$9 = 1
33 + [3] Reassign mutate y$3 = 1
34 Goto bb4
35 bb4:
36 predecessor blocks: bb5 bb3
37 Goto(Continue) bb1
38 bb2:
39 predecessor blocks: bb1
40 - Return freeze items$5
40 + Return freeze items$2
41 ```
42
43 ### CFG
@@ -47,22 +47,22 @@ flowchart TB
47 %% Basic Blocks
48 subgraph bb0
49 bb0_instrs["
50 - [1] Let mutate items$5 = Array []
50 + [1] Let mutate items$2 = Array []
51 "]
52 bb0_instrs --> bb0_terminal(["Goto"])
53 end
54 subgraph bb1
55 - bb1_terminal(["If (read items$5)"])
55 + bb1_terminal(["If (read items$2)"])
56 end
57 subgraph bb3
58 bb3_instrs["
59 - [2] Let mutate y$7 = 0
59 + [2] Let mutate y$3 = 0
60 "]
61 - bb3_instrs --> bb3_terminal(["If (read cond$4)"])
61 + bb3_instrs --> bb3_terminal(["If (read cond$1)"])
62 end
63 subgraph bb5
64 bb5_instrs["
65 - [3] Reassign mutate y$9 = 1
65 + [3] Reassign mutate y$3 = 1
66 "]
67 bb5_instrs --> bb5_terminal(["Goto"])
68 end
@@ -70,7 +70,7 @@ flowchart TB
70 bb4_terminal(["Goto"])
71 end
72 subgraph bb2
73 - bb2_terminal(["Return freeze items$5"])
73 + bb2_terminal(["Return freeze items$2"])
74 end
75
76 %% Jumps
@@ -87,8 +87,8 @@ flowchart TB
87 ## Code
88
89 ```javascript
90 -function foo$0(cond$4) {
91 - let items$5 = [];
90 +function foo$0(cond$1) {
91 + let items$2 = [];
92 }
93
94 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md
+10 -10
@@ -20,13 +20,13 @@ bb0:
20 Goto bb1
21 bb1:
22 predecessor blocks: bb0 bb4
23 - [2] Const mutate $6 = 10
24 - [3] Const mutate $8 = Binary read x$1 < read $6
25 - If (read $8) then:bb4 else:bb2
23 + [2] Const mutate $3 = 10
24 + [3] Const mutate $4 = Binary read x$1 < read $3
25 + If (read $4) then:bb4 else:bb2
26 bb4:
27 predecessor blocks: bb1
28 - [4] Const mutate $9 = 1
29 - [5] Reassign mutate x$1 = Binary read x$1 + read $9
28 + [4] Const mutate $2 = 1
29 + [5] Reassign mutate x$1 = Binary read x$1 + read $2
30 Goto(Continue) bb1
31 bb2:
32 predecessor blocks: bb1
@@ -46,15 +46,15 @@ flowchart TB
46 end
47 subgraph bb1
48 bb1_instrs["
49 - [2] Const mutate $6 = 10
50 - [3] Const mutate $8 = Binary read x$1 < read $6
49 + [2] Const mutate $3 = 10
50 + [3] Const mutate $4 = Binary read x$1 < read $3
51 "]
52 - bb1_instrs --> bb1_terminal(["If (read $8)"])
52 + bb1_instrs --> bb1_terminal(["If (read $4)"])
53 end
54 subgraph bb4
55 bb4_instrs["
56 - [4] Const mutate $9 = 1
57 - [5] Reassign mutate x$1 = Binary read x$1 + read $9
56 + [4] Const mutate $2 = 1
57 + [5] Reassign mutate x$1 = Binary read x$1 + read $2
58 "]
59 bb4_instrs --> bb4_terminal(["Goto"])
60 end
compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md
+15 -15
@@ -19,16 +19,16 @@ function foo() {
19
20 ```
21 bb0:
22 - [1] Let mutate x$5 = 1
23 - [2] Let mutate y$6 = 2
24 - If (read y$6) then:bb2 else:bb3
22 + [1] Let mutate x$1 = 1
23 + [2] Let mutate y$2 = 2
24 + If (read y$2) then:bb2 else:bb3
25 bb2:
26 predecessor blocks: bb0
27 - [3] Let mutate z$7 = Binary read x$5 + read y$6
27 + [3] Let mutate z$3 = Binary read x$1 + read y$2
28 Goto bb1
29 bb3:
30 predecessor blocks: bb0
31 - [4] Let mutate z$8 = read x$5
31 + [4] Let mutate z$4 = read x$1
32 Goto bb1
33 bb1:
34 predecessor blocks: bb2 bb3
@@ -42,20 +42,20 @@ flowchart TB
42 %% Basic Blocks
43 subgraph bb0
44 bb0_instrs["
45 - [1] Let mutate x$5 = 1
46 - [2] Let mutate y$6 = 2
45 + [1] Let mutate x$1 = 1
46 + [2] Let mutate y$2 = 2
47 "]
48 - bb0_instrs --> bb0_terminal(["If (read y$6)"])
48 + bb0_instrs --> bb0_terminal(["If (read y$2)"])
49 end
50 subgraph bb2
51 bb2_instrs["
52 - [3] Let mutate z$7 = Binary read x$5 + read y$6
52 + [3] Let mutate z$3 = Binary read x$1 + read y$2
53 "]
54 bb2_instrs --> bb2_terminal(["Goto"])
55 end
56 subgraph bb3
57 bb3_instrs["
58 - [4] Let mutate z$8 = read x$5
58 + [4] Let mutate z$4 = read x$1
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
@@ -76,12 +76,12 @@ flowchart TB
76
77 ```javascript
78 function foo$0() {
79 - let x$5 = 1;
80 - let y$6 = 2;
81 - bb1: if (y$6) {
82 - let z$7 = x$5 + y$6;
79 + let x$1 = 1;
80 + let y$2 = 2;
81 + bb1: if (y$2) {
82 + let z$3 = x$1 + y$2;
83 } else {
84 - let z$8 = x$5;
84 + let z$4 = x$1;
85 }
86
87 return;
compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md
+21 -21
@@ -21,27 +21,27 @@ function foo(a, b, c) {
21
22 ```
23 bb0:
24 - [1] Let mutate x$9 = 0
24 + [1] Let mutate x$4 = 0
25 While test=bb1 loop=bb3 fallthrough=bb2
26 bb1:
27 predecessor blocks: bb0 bb5
28 - If (read a$6) then:bb3 else:bb2
28 + If (read a$1) then:bb3 else:bb2
29 bb3:
30 predecessor blocks: bb1
31 While test=bb4 loop=bb6 fallthrough=bb5
32 bb4:
33 predecessor blocks: bb3 bb8
34 - If (read b$7) then:bb6 else:bb5
34 + If (read b$2) then:bb6 else:bb5
35 bb6:
36 predecessor blocks: bb4
37 While test=bb7 loop=bb9 fallthrough=bb8
38 bb7:
39 predecessor blocks: bb6 bb9
40 - If (read c$8) then:bb9 else:bb8
40 + If (read c$3) then:bb9 else:bb8
41 bb9:
42 predecessor blocks: bb7
43 - [2] Const mutate $13 = 1
44 - [3] Binary read x$9 + read $13
43 + [2] Const mutate $5 = 1
44 + [3] Binary read x$4 + read $5
45 Goto(Continue) bb7
46 bb8:
47 predecessor blocks: bb7
@@ -51,7 +51,7 @@ bb5:
51 Goto(Continue) bb1
52 bb2:
53 predecessor blocks: bb1
54 - Return read x$9
54 + Return read x$4
55 ```
56
57 ### CFG
@@ -61,29 +61,29 @@ flowchart TB
61 %% Basic Blocks
62 subgraph bb0
63 bb0_instrs["
64 - [1] Let mutate x$9 = 0
64 + [1] Let mutate x$4 = 0
65 "]
66 bb0_instrs --> bb0_terminal(["While"])
67 end
68 subgraph bb1
69 - bb1_terminal(["If (read a$6)"])
69 + bb1_terminal(["If (read a$1)"])
70 end
71 subgraph bb3
72 bb3_terminal(["While"])
73 end
74 subgraph bb4
75 - bb4_terminal(["If (read b$7)"])
75 + bb4_terminal(["If (read b$2)"])
76 end
77 subgraph bb6
78 bb6_terminal(["While"])
79 end
80 subgraph bb7
81 - bb7_terminal(["If (read c$8)"])
81 + bb7_terminal(["If (read c$3)"])
82 end
83 subgraph bb9
84 bb9_instrs["
85 - [2] Const mutate $13 = 1
86 - [3] Binary read x$9 + read $13
85 + [2] Const mutate $5 = 1
86 + [3] Binary read x$4 + read $5
87 "]
88 bb9_instrs --> bb9_terminal(["Goto"])
89 end
@@ -94,7 +94,7 @@ flowchart TB
94 bb5_terminal(["Goto"])
95 end
96 subgraph bb2
97 - bb2_terminal(["Return read x$9"])
97 + bb2_terminal(["Return read x$4"])
98 end
99
100 %% Jumps
@@ -122,17 +122,17 @@ flowchart TB
122 ## Code
123
124 ```javascript
125 -function foo$0(a$6, b$7, c$8) {
126 - let x$9 = 0;
127 - bb2: while (a$6) {
128 - bb5: while (b$7) {
129 - bb8: while (c$8) {
130 - x$9 + 1;
125 +function foo$0(a$1, b$2, c$3) {
126 + let x$4 = 0;
127 + bb2: while (a$1) {
128 + bb5: while (b$2) {
129 + bb8: while (c$3) {
130 + x$4 + 1;
131 }
132 }
133 }
134
135 - return x$9;
135 + return x$4;
136 }
137
138 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md
+13 -13
@@ -45,10 +45,10 @@ function Foo$0() {
45
46 ```
47 bb0:
48 - [1] Const mutate a$7[1:3] = Array []
49 - [2] Const mutate b$8[2:3] = Object { }
50 - [3] Let mutate c$9 = New mutate Foo$5(mutate a$7, mutate b$8)
51 - Return freeze c$9
48 + [1] Const mutate a$2[1:3] = Array []
49 + [2] Const mutate b$3[2:3] = Object { }
50 + [3] Let mutate c$4 = New mutate Foo$5(mutate a$2, mutate b$3)
51 + Return freeze c$4
52 ```
53
54 ### CFG
@@ -58,11 +58,11 @@ flowchart TB
58 %% Basic Blocks
59 subgraph bb0
60 bb0_instrs["
61 - [1] Const mutate a$7[1:3] = Array []
62 - [2] Const mutate b$8[2:3] = Object { }
63 - [3] Let mutate c$9 = New mutate Foo$5(mutate a$7, mutate b$8)
61 + [1] Const mutate a$2[1:3] = Array []
62 + [2] Const mutate b$3[2:3] = Object { }
63 + [3] Let mutate c$4 = New mutate Foo$5(mutate a$2, mutate b$3)
64 "]
65 - bb0_instrs --> bb0_terminal(["Return freeze c$9"])
65 + bb0_instrs --> bb0_terminal(["Return freeze c$4"])
66 end
67
68 %% Jumps
@@ -72,11 +72,11 @@ flowchart TB
72 ## Code
73
74 ```javascript
75 -function Component$0(props$6) {
76 - const a$7 = [];
77 - const b$8 = {};
78 - let c$9 = new Foo$5(a$7, b$8);
79 - return c$9;
75 +function Component$0(props$1) {
76 + const a$2 = [];
77 + const b$3 = {};
78 + let c$4 = new Foo$5(a$2, b$3);
79 + return c$4;
80 }
81
82 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md
+12 -12
@@ -24,9 +24,9 @@ function foo() {
24 bb0:
25 [1] Let mutate x$1 = 1
26 [2] Let mutate y$2 = 2
27 - [3] Const mutate $8 = 1
28 - [4] Const mutate $9 = Binary read x$1 > read $8
29 - If (read $9) then:bb2 else:bb3
27 + [3] Const mutate $3 = 1
28 + [4] Const mutate $4 = Binary read x$1 > read $3
29 + If (read $4) then:bb2 else:bb3
30 bb2:
31 predecessor blocks: bb0
32 [5] Reassign mutate x$1 = 2
@@ -37,8 +37,8 @@ bb3:
37 Goto bb1
38 bb1:
39 predecessor blocks: bb2 bb3
40 - [7] Let mutate t$14 = Object { x: read x$1, y: read y$2 }
41 - Return freeze t$14
40 + [7] Let mutate t$5 = Object { x: read x$1, y: read y$2 }
41 + Return freeze t$5
42 ```
43
44 ### CFG
@@ -50,10 +50,10 @@ flowchart TB
50 bb0_instrs["
51 [1] Let mutate x$1 = 1
52 [2] Let mutate y$2 = 2
53 - [3] Const mutate $8 = 1
54 - [4] Const mutate $9 = Binary read x$1 > read $8
53 + [3] Const mutate $3 = 1
54 + [4] Const mutate $4 = Binary read x$1 > read $3
55 "]
56 - bb0_instrs --> bb0_terminal(["If (read $9)"])
56 + bb0_instrs --> bb0_terminal(["If (read $4)"])
57 end
58 subgraph bb2
59 bb2_instrs["
@@ -69,9 +69,9 @@ flowchart TB
69 end
70 subgraph bb1
71 bb1_instrs["
72 - [7] Let mutate t$14 = Object { x: read x$1, y: read y$2 }
72 + [7] Let mutate t$5 = Object { x: read x$1, y: read y$2 }
73 "]
74 - bb1_instrs --> bb1_terminal(["Return freeze t$14"])
74 + bb1_instrs --> bb1_terminal(["Return freeze t$5"])
75 end
76
77 %% Jumps
@@ -95,11 +95,11 @@ function foo$0() {
95 y$2 = 3;
96 }
97
98 - let t$14 = {
98 + let t$5 = {
99 x: x$1,
100 y: y$2,
101 };
102 - return t$14;
102 + return t$5;
103 }
104
105 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md
+15 -15
@@ -15,10 +15,10 @@ function Component(props) {
15
16 ```
17 bb0:
18 - [1] Const mutate a$6 = 1
19 - [2] Const mutate b$7 = 2
20 - [3] Const mutate x$8 = Object { a: read a$6, b: read b$7 }
21 - Return freeze x$8
18 + [1] Const mutate a$2 = 1
19 + [2] Const mutate b$3 = 2
20 + [3] Const mutate x$4 = Object { a: read a$2, b: read b$3 }
21 + Return freeze x$4
22 ```
23
24 ### CFG
@@ -28,11 +28,11 @@ flowchart TB
28 %% Basic Blocks
29 subgraph bb0
30 bb0_instrs["
31 - [1] Const mutate a$6 = 1
32 - [2] Const mutate b$7 = 2
33 - [3] Const mutate x$8 = Object { a: read a$6, b: read b$7 }
31 + [1] Const mutate a$2 = 1
32 + [2] Const mutate b$3 = 2
33 + [3] Const mutate x$4 = Object { a: read a$2, b: read b$3 }
34 "]
35 - bb0_instrs --> bb0_terminal(["Return freeze x$8"])
35 + bb0_instrs --> bb0_terminal(["Return freeze x$4"])
36 end
37
38 %% Jumps
@@ -42,14 +42,14 @@ flowchart TB
42 ## Code
43
44 ```javascript
45 -function Component$0(props$5) {
46 - const a$6 = 1;
47 - const b$7 = 2;
48 - const x$8 = {
49 - a: a$6,
50 - b: b$7,
45 +function Component$0(props$1) {
46 + const a$2 = 1;
47 + const b$3 = 2;
48 + const x$4 = {
49 + a: a$2,
50 + b: b$3,
51 };
52 - return x$8;
52 + return x$4;
53 }
54
55 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md
+15 -15
@@ -15,11 +15,11 @@ function foo() {
15
16 ```
17 bb0:
18 - [1] Const mutate x$4 = Array []
19 - [2] Const mutate y$5[2:4] = Object { x: read x$4 }
20 - [3] Const mutate $6[3:4] = Array []
21 - [4] Call mutate y$5.x.push(mutate $6)
22 - Return freeze y$5
18 + [1] Const mutate x$1 = Array []
19 + [2] Const mutate y$2[2:4] = Object { x: read x$1 }
20 + [3] Const mutate $3[3:4] = Array []
21 + [4] Call mutate y$2.x.push(mutate $3)
22 + Return freeze y$2
23 ```
24
25 ### CFG
@@ -29,12 +29,12 @@ flowchart TB
29 %% Basic Blocks
30 subgraph bb0
31 bb0_instrs["
32 - [1] Const mutate x$4 = Array []
33 - [2] Const mutate y$5[2:4] = Object { x: read x$4 }
34 - [3] Const mutate $6[3:4] = Array []
35 - [4] Call mutate y$5.x.push(mutate $6)
32 + [1] Const mutate x$1 = Array []
33 + [2] Const mutate y$2[2:4] = Object { x: read x$1 }
34 + [3] Const mutate $3[3:4] = Array []
35 + [4] Call mutate y$2.x.push(mutate $3)
36 "]
37 - bb0_instrs --> bb0_terminal(["Return freeze y$5"])
37 + bb0_instrs --> bb0_terminal(["Return freeze y$2"])
38 end
39
40 %% Jumps
@@ -45,12 +45,12 @@ flowchart TB
45
46 ```javascript
47 function foo$0() {
48 - const x$4 = [];
49 - const y$5 = {
50 - x: x$4,
48 + const x$1 = [];
49 + const y$2 = {
50 + x: x$1,
51 };
52 - y$5.x.push([]);
53 - return y$5;
52 + y$2.x.push([]);
53 + return y$2;
54 }
55
56 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md
+12 -12
@@ -15,10 +15,10 @@ function foo() {
15
16 ```
17 bb0:
18 - [1] Const mutate x$3 = Array []
19 - [2] Const mutate y$4[2:3] = Object { }
20 - [3] Reassign mutate y$4.x[2:3] = read x$3
21 - Return freeze y$4
18 + [1] Const mutate x$1 = Array []
19 + [2] Const mutate y$2[2:3] = Object { }
20 + [3] Reassign mutate y$2.x[2:3] = read x$1
21 + Return freeze y$2
22 ```
23
24 ### CFG
@@ -28,11 +28,11 @@ flowchart TB
28 %% Basic Blocks
29 subgraph bb0
30 bb0_instrs["
31 - [1] Const mutate x$3 = Array []
32 - [2] Const mutate y$4[2:3] = Object { }
33 - [3] Reassign mutate y$4.x[2:3] = read x$3
31 + [1] Const mutate x$1 = Array []
32 + [2] Const mutate y$2[2:3] = Object { }
33 + [3] Reassign mutate y$2.x[2:3] = read x$1
34 "]
35 - bb0_instrs --> bb0_terminal(["Return freeze y$4"])
35 + bb0_instrs --> bb0_terminal(["Return freeze y$2"])
36 end
37
38 %% Jumps
@@ -43,10 +43,10 @@ flowchart TB
43
44 ```javascript
45 function foo$0() {
46 - const x$3 = [];
47 - const y$4 = {};
48 - y$4.x = x$3;
49 - return y$4;
46 + const x$1 = [];
47 + const y$2 = {};
48 + y$2.x = x$1;
49 + return y$2;
50 }
51
52 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md
+6 -6
@@ -18,9 +18,9 @@ function foo() {
18 ```
19 bb0:
20 [1] Let mutate x$1 = 1
21 - [2] Const mutate $5 = 1
22 - [3] Const mutate $6 = Binary read x$1 === read $5
23 - If (read $6) then:bb2 else:bb1
21 + [2] Const mutate $2 = 1
22 + [3] Const mutate $3 = Binary read x$1 === read $2
23 + If (read $3) then:bb2 else:bb1
24 bb2:
25 predecessor blocks: bb0
26 [4] Reassign mutate x$1 = 2
@@ -38,10 +38,10 @@ flowchart TB
38 subgraph bb0
39 bb0_instrs["
40 [1] Let mutate x$1 = 1
41 - [2] Const mutate $5 = 1
42 - [3] Const mutate $6 = Binary read x$1 === read $5
41 + [2] Const mutate $2 = 1
42 + [3] Const mutate $3 = Binary read x$1 === read $2
43 "]
44 - bb0_instrs --> bb0_terminal(["If (read $6)"])
44 + bb0_instrs --> bb0_terminal(["If (read $3)"])
45 end
46 subgraph bb2
47 bb2_instrs["
compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md
+10 -10
@@ -50,11 +50,11 @@ function log$0() {
50 ```
51 bb0:
52 [1] Let mutate str$2 = ""
53 - If (read cond$5) then:bb2 else:bb3
53 + If (read cond$1) then:bb2 else:bb3
54 bb2:
55 predecessor blocks: bb0
56 - [2] Let mutate str$7 = "other test"
57 - [3] Call mutate log$4(read str$7)
56 + [2] Let mutate str$3 = "other test"
57 + [3] Call mutate log$4(read str$3)
58 Goto bb1
59 bb3:
60 predecessor blocks: bb0
@@ -75,12 +75,12 @@ flowchart TB
75 bb0_instrs["
76 [1] Let mutate str$2 = ''
77 "]
78 - bb0_instrs --> bb0_terminal(["If (read cond$5)"])
78 + bb0_instrs --> bb0_terminal(["If (read cond$1)"])
79 end
80 subgraph bb2
81 bb2_instrs["
82 - [2] Let mutate str$7 = 'other test'
83 - [3] Call mutate log$4(read str$7)
82 + [2] Let mutate str$3 = 'other test'
83 + [3] Call mutate log$4(read str$3)
84 "]
85 bb2_instrs --> bb2_terminal(["Goto"])
86 end
@@ -109,11 +109,11 @@ flowchart TB
109 ## Code
110
111 ```javascript
112 -function Foo$0(cond$5) {
112 +function Foo$0(cond$1) {
113 let str$2 = "";
114 - bb1: if (cond$5) {
115 - let str$7 = "other test";
116 - log$4(str$7);
114 + bb1: if (cond$1) {
115 + let str$3 = "other test";
116 + log$4(str$3);
117 } else {
118 str$2 = "fallthrough test";
119 }
compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md
+13 -13
@@ -20,10 +20,10 @@ function foo() {
20
21 ```
22 bb0:
23 - [1] Let mutate y$5 = 2
24 - [2] Const mutate $6 = 1
25 - [3] Const mutate $7 = Binary read y$5 > read $6
26 - If (read $7) then:bb2 else:bb3
23 + [1] Let mutate y$1 = 2
24 + [2] Const mutate $2 = 1
25 + [3] Const mutate $3 = Binary read y$1 > read $2
26 + If (read $3) then:bb2 else:bb3
27 bb2:
28 predecessor blocks: bb0
29 [4] Reassign mutate y$1 = 1
@@ -34,7 +34,7 @@ bb3:
34 Goto bb1
35 bb1:
36 predecessor blocks: bb2 bb3
37 - [6] Let mutate x$11 = read y$1
37 + [6] Let mutate x$4 = read y$1
38 Return
39 ```
40
@@ -45,11 +45,11 @@ flowchart TB
45 %% Basic Blocks
46 subgraph bb0
47 bb0_instrs["
48 - [1] Let mutate y$5 = 2
49 - [2] Const mutate $6 = 1
50 - [3] Const mutate $7 = Binary read y$5 > read $6
48 + [1] Let mutate y$1 = 2
49 + [2] Const mutate $2 = 1
50 + [3] Const mutate $3 = Binary read y$1 > read $2
51 "]
52 - bb0_instrs --> bb0_terminal(["If (read $7)"])
52 + bb0_instrs --> bb0_terminal(["If (read $3)"])
53 end
54 subgraph bb2
55 bb2_instrs["
@@ -65,7 +65,7 @@ flowchart TB
65 end
66 subgraph bb1
67 bb1_instrs["
68 - [6] Let mutate x$11 = read y$1
68 + [6] Let mutate x$4 = read y$1
69 "]
70 bb1_instrs --> bb1_terminal(["Return"])
71 end
@@ -83,14 +83,14 @@ flowchart TB
83
84 ```javascript
85 function foo$0() {
86 - let y$5 = 2;
87 - bb1: if (y$5 > 1) {
86 + let y$1 = 2;
87 + bb1: if (y$1 > 1) {
88 y$1 = 1;
89 } else {
90 y$1 = 2;
91 }
92
93 - let x$11 = y$1;
93 + let x$4 = y$1;
94 return;
95 }
96
compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md
+6 -6
@@ -13,8 +13,8 @@ function foo() {
13
14 ```
15 bb0:
16 - [1] Let mutate x$3 = 1
17 - [2] Let mutate y$4 = 2
16 + [1] Let mutate x$1 = 1
17 + [2] Let mutate y$2 = 2
18 Return
19 ```
20
@@ -25,8 +25,8 @@ flowchart TB
25 %% Basic Blocks
26 subgraph bb0
27 bb0_instrs["
28 - [1] Let mutate x$3 = 1
29 - [2] Let mutate y$4 = 2
28 + [1] Let mutate x$1 = 1
29 + [2] Let mutate y$2 = 2
30 "]
31 bb0_instrs --> bb0_terminal(["Return"])
32 end
@@ -39,8 +39,8 @@ flowchart TB
39
40 ```javascript
41 function foo$0() {
42 - let x$3 = 1;
43 - let y$4 = 2;
42 + let x$1 = 1;
43 + let y$2 = 2;
44 return;
45 }
46
compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md
+12 -12
@@ -17,12 +17,12 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$4 = 1
21 - [2] Let mutate y$5 = 2
22 - If (read y$5) then:bb2 else:bb1
20 + [1] Let mutate x$1 = 1
21 + [2] Let mutate y$2 = 2
22 + If (read y$2) then:bb2 else:bb1
23 bb2:
24 predecessor blocks: bb0
25 - [3] Let mutate z$6 = Binary read x$4 + read y$5
25 + [3] Let mutate z$3 = Binary read x$1 + read y$2
26 Goto bb1
27 bb1:
28 predecessor blocks: bb2 bb0
@@ -36,14 +36,14 @@ flowchart TB
36 %% Basic Blocks
37 subgraph bb0
38 bb0_instrs["
39 - [1] Let mutate x$4 = 1
40 - [2] Let mutate y$5 = 2
39 + [1] Let mutate x$1 = 1
40 + [2] Let mutate y$2 = 2
41 "]
42 - bb0_instrs --> bb0_terminal(["If (read y$5)"])
42 + bb0_instrs --> bb0_terminal(["If (read y$2)"])
43 end
44 subgraph bb2
45 bb2_instrs["
46 - [3] Let mutate z$6 = Binary read x$4 + read y$5
46 + [3] Let mutate z$3 = Binary read x$1 + read y$2
47 "]
48 bb2_instrs --> bb2_terminal(["Goto"])
49 end
@@ -62,10 +62,10 @@ flowchart TB
62
63 ```javascript
64 function foo$0() {
65 - let x$4 = 1;
66 - let y$5 = 2;
67 - bb1: if (y$5) {
68 - let z$6 = x$4 + y$5;
65 + let x$1 = 1;
66 + let y$2 = 2;
67 + bb1: if (y$2) {
68 + let z$3 = x$1 + y$2;
69 }
70
71 return;
compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md
+38 -38
@@ -28,33 +28,33 @@ function foo() {
28
29 ```
30 bb0:
31 - [1] Let mutate x$10 = 1
32 - [2] Const mutate $11 = 2
33 - [3] Const mutate $12 = Binary read x$10 === read $11
34 - [4] Const mutate $13 = 1
35 - [5] Const mutate $14 = Binary read x$10 === read $13
36 - Switch (read x$10)
37 - Case read $14: bb5
38 - Case read $12: bb3
31 + [1] Let mutate x$1 = 1
32 + [2] Const mutate $4 = 2
33 + [3] Const mutate $5 = Binary read x$1 === read $4
34 + [4] Const mutate $7 = 1
35 + [5] Const mutate $8 = Binary read x$1 === read $7
36 + Switch (read x$1)
37 + Case read $8: bb5
38 + Case read $5: bb3
39 Default: bb2
40 bb5:
41 predecessor blocks: bb0
42 - [6] Const mutate $15 = 1
43 - [7] Reassign mutate x$1 = Binary read x$10 + read $15
42 + [6] Const mutate $6 = 1
43 + [7] Reassign mutate x$1 = Binary read x$1 + read $6
44 Goto bb1
45 bb3:
46 predecessor blocks: bb0
47 - [8] Const mutate $17 = 2
48 - [9] Reassign mutate x$1 = Binary read x$10 + read $17
47 + [8] Const mutate $3 = 2
48 + [9] Reassign mutate x$1 = Binary read x$1 + read $3
49 Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 - [10] Const mutate $19 = 3
53 - [11] Reassign mutate x$1 = Binary read x$10 + read $19
52 + [10] Const mutate $2 = 3
53 + [11] Reassign mutate x$1 = Binary read x$1 + read $2
54 Goto bb1
55 bb1:
56 predecessor blocks: bb5 bb3 bb2
57 - [12] Let mutate y$22 = read x$1
57 + [12] Let mutate y$9 = read x$1
58 Return
59 ```
60
@@ -65,45 +65,45 @@ flowchart TB
65 %% Basic Blocks
66 subgraph bb0
67 bb0_instrs["
68 - [1] Let mutate x$10 = 1
69 - [2] Const mutate $11 = 2
70 - [3] Const mutate $12 = Binary read x$10 === read $11
71 - [4] Const mutate $13 = 1
72 - [5] Const mutate $14 = Binary read x$10 === read $13
68 + [1] Let mutate x$1 = 1
69 + [2] Const mutate $4 = 2
70 + [3] Const mutate $5 = Binary read x$1 === read $4
71 + [4] Const mutate $7 = 1
72 + [5] Const mutate $8 = Binary read x$1 === read $7
73 "]
74 - bb0_instrs --> bb0_terminal(["Switch (read x$10)"])
74 + bb0_instrs --> bb0_terminal(["Switch (read x$1)"])
75 end
76 subgraph bb5
77 bb5_instrs["
78 - [6] Const mutate $15 = 1
79 - [7] Reassign mutate x$1 = Binary read x$10 + read $15
78 + [6] Const mutate $6 = 1
79 + [7] Reassign mutate x$1 = Binary read x$1 + read $6
80 "]
81 bb5_instrs --> bb5_terminal(["Goto"])
82 end
83 subgraph bb3
84 bb3_instrs["
85 - [8] Const mutate $17 = 2
86 - [9] Reassign mutate x$1 = Binary read x$10 + read $17
85 + [8] Const mutate $3 = 2
86 + [9] Reassign mutate x$1 = Binary read x$1 + read $3
87 "]
88 bb3_instrs --> bb3_terminal(["Goto"])
89 end
90 subgraph bb2
91 bb2_instrs["
92 - [10] Const mutate $19 = 3
93 - [11] Reassign mutate x$1 = Binary read x$10 + read $19
92 + [10] Const mutate $2 = 3
93 + [11] Reassign mutate x$1 = Binary read x$1 + read $2
94 "]
95 bb2_instrs --> bb2_terminal(["Goto"])
96 end
97 subgraph bb1
98 bb1_instrs["
99 - [12] Let mutate y$22 = read x$1
99 + [12] Let mutate y$9 = read x$1
100 "]
101 bb1_instrs --> bb1_terminal(["Return"])
102 end
103
104 %% Jumps
105 - bb0_terminal -- read $14 --> bb5
106 - bb0_terminal -- read $12 --> bb3
105 + bb0_terminal -- read $8 --> bb5
106 + bb0_terminal -- read $5 --> bb3
107 bb0_terminal -- default --> bb2
108 bb0_terminal -- fallthrough --> bb1
109 bb5_terminal --> bb1
@@ -116,24 +116,24 @@ flowchart TB
116
117 ```javascript
118 function foo$0() {
119 - let x$10 = 1;
120 - bb1: switch (x$10) {
121 - case x$10 === 1: {
122 - x$1 = x$10 + 1;
119 + let x$1 = 1;
120 + bb1: switch (x$1) {
121 + case x$1 === 1: {
122 + x$1 = x$1 + 1;
123 break bb1;
124 }
125
126 - case x$10 === 2: {
127 - x$1 = x$10 + 2;
126 + case x$1 === 2: {
127 + x$1 = x$1 + 2;
128 break bb1;
129 }
130
131 default: {
132 - x$1 = x$10 + 3;
132 + x$1 = x$1 + 3;
133 }
134 }
135
136 - let y$22 = x$1;
136 + let y$9 = x$1;
137 return;
138 }
139
compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md
+6 -6
@@ -17,9 +17,9 @@ function foo() {
17 ```
18 bb0:
19 [1] Let mutate x$1 = 1
20 - [2] Const mutate $5 = 1
21 - [3] Const mutate $6 = Binary read x$1 === read $5
22 - If (read $6) then:bb2 else:bb1
20 + [2] Const mutate $2 = 1
21 + [3] Const mutate $3 = Binary read x$1 === read $2
22 + If (read $3) then:bb2 else:bb1
23 bb2:
24 predecessor blocks: bb0
25 [4] Reassign mutate x$1 = 2
@@ -37,10 +37,10 @@ flowchart TB
37 subgraph bb0
38 bb0_instrs["
39 [1] Let mutate x$1 = 1
40 - [2] Const mutate $5 = 1
41 - [3] Const mutate $6 = Binary read x$1 === read $5
40 + [2] Const mutate $2 = 1
41 + [3] Const mutate $3 = Binary read x$1 === read $2
42 "]
43 - bb0_instrs --> bb0_terminal(["If (read $6)"])
43 + bb0_instrs --> bb0_terminal(["If (read $3)"])
44 end
45 subgraph bb2
46 bb2_instrs["
compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md
+18 -18
@@ -17,21 +17,21 @@ function foo() {
17
18 ```
19 bb0:
20 - [1] Let mutate x$5 = 1
20 + [1] Let mutate x$1 = 1
21 While test=bb1 loop=bb3 fallthrough=bb2
22 bb1:
23 predecessor blocks: bb0 bb3
24 - [2] Const mutate $6 = 10
25 - [3] Const mutate $8 = Binary read x$5 < read $6
26 - If (read $8) then:bb3 else:bb2
24 + [2] Const mutate $3 = 10
25 + [3] Const mutate $4 = Binary read x$1 < read $3
26 + If (read $4) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [4] Const mutate $9 = 1
30 - [5] Binary read x$5 + read $9
29 + [4] Const mutate $2 = 1
30 + [5] Binary read x$1 + read $2
31 Goto(Continue) bb1
32 bb2:
33 predecessor blocks: bb1
34 - Return read x$5
34 + Return read x$1
35 ```
36
37 ### CFG
@@ -41,26 +41,26 @@ flowchart TB
41 %% Basic Blocks
42 subgraph bb0
43 bb0_instrs["
44 - [1] Let mutate x$5 = 1
44 + [1] Let mutate x$1 = 1
45 "]
46 bb0_instrs --> bb0_terminal(["While"])
47 end
48 subgraph bb1
49 bb1_instrs["
50 - [2] Const mutate $6 = 10
51 - [3] Const mutate $8 = Binary read x$5 < read $6
50 + [2] Const mutate $3 = 10
51 + [3] Const mutate $4 = Binary read x$1 < read $3
52 "]
53 - bb1_instrs --> bb1_terminal(["If (read $8)"])
53 + bb1_instrs --> bb1_terminal(["If (read $4)"])
54 end
55 subgraph bb3
56 bb3_instrs["
57 - [4] Const mutate $9 = 1
58 - [5] Binary read x$5 + read $9
57 + [4] Const mutate $2 = 1
58 + [5] Binary read x$1 + read $2
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
62 subgraph bb2
63 - bb2_terminal(["Return read x$5"])
63 + bb2_terminal(["Return read x$1"])
64 end
65
66 %% Jumps
@@ -77,12 +77,12 @@ flowchart TB
77
78 ```javascript
79 function foo$0() {
80 - let x$5 = 1;
81 - bb2: while (x$5 < 10) {
82 - x$5 + 1;
80 + let x$1 = 1;
81 + bb2: while (x$1 < 10) {
82 + x$1 + 1;
83 }
84
85 - return x$5;
85 + return x$1;
86 }
87
88 ```
compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md
+10 -10
@@ -21,13 +21,13 @@ bb0:
21 While test=bb1 loop=bb3 fallthrough=bb2
22 bb1:
23 predecessor blocks: bb0 bb3
24 - [2] Const mutate $6 = 10
25 - [3] Const mutate $8 = Binary read x$1 < read $6
26 - If (read $8) then:bb3 else:bb2
24 + [2] Const mutate $3 = 10
25 + [3] Const mutate $4 = Binary read x$1 < read $3
26 + If (read $4) then:bb3 else:bb2
27 bb3:
28 predecessor blocks: bb1
29 - [4] Const mutate $9 = 1
30 - [5] Reassign mutate x$1 = Binary read x$1 + read $9
29 + [4] Const mutate $2 = 1
30 + [5] Reassign mutate x$1 = Binary read x$1 + read $2
31 Goto(Continue) bb1
32 bb2:
33 predecessor blocks: bb1
@@ -47,15 +47,15 @@ flowchart TB
47 end
48 subgraph bb1
49 bb1_instrs["
50 - [2] Const mutate $6 = 10
51 - [3] Const mutate $8 = Binary read x$1 < read $6
50 + [2] Const mutate $3 = 10
51 + [3] Const mutate $4 = Binary read x$1 < read $3
52 "]
53 - bb1_instrs --> bb1_terminal(["If (read $8)"])
53 + bb1_instrs --> bb1_terminal(["If (read $4)"])
54 end
55 subgraph bb3
56 bb3_instrs["
57 - [4] Const mutate $9 = 1
58 - [5] Reassign mutate x$1 = Binary read x$1 + read $9
57 + [4] Const mutate $2 = 1
58 + [5] Reassign mutate x$1 = Binary read x$1 + read $2
59 "]
60 bb3_instrs --> bb3_terminal(["Goto"])
61 end
compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md
+36 -36
@@ -32,31 +32,31 @@ function Component(props) {
32
33 ```
34 bb0:
35 - [1] Let mutate x$10[1:6] = Array []
35 + [1] Let mutate x$2[1:6] = Array []
36 [2] Let mutate y$3 = undefined
37 - [3] Const mutate $12 = false
38 - [4] Const mutate $13 = true
39 - [5] Const mutate $14 = 1
40 - Switch (read props$9.p0)
41 - Case read $14: bb1
42 - Case read $13: bb6
37 + [3] Const mutate $4 = false
38 + [4] Const mutate $5 = true
39 + [5] Const mutate $6 = 1
40 + Switch (read props$1.p0)
41 + Case read $6: bb1
42 + Case read $5: bb6
43 Default: bb1
44 - Case read $12: bb2
44 + Case read $4: bb2
45 bb6:
46 predecessor blocks: bb0
47 - [6] Call mutate x$10.push(read props$9.p2)
47 + [6] Call mutate x$2.push(read props$1.p2)
48 [7] Reassign mutate y$3 = Array []
49 Goto bb1
50 bb2:
51 predecessor blocks: bb0
52 - [8] Reassign mutate y$3 = read x$10
52 + [8] Reassign mutate y$3 = read x$2
53 Goto bb1
54 bb1:
55 predecessor blocks: bb0 bb6 bb2
56 - [9] Const mutate child$19 = JSX <read Component$0 data={freeze x$10} ></read Component$0>
57 - [10] Call read y$3.push(read props$9.p4)
58 - [11] Const mutate $22 = JSX <read Component$0 data={freeze y$3} >{read child$19}</read Component$0>
59 - Return read $22
56 + [9] Const mutate child$7 = JSX <read Component$0 data={freeze x$2} ></read Component$0>
57 + [10] Call read y$3.push(read props$1.p4)
58 + [11] Const mutate $8 = JSX <read Component$0 data={freeze y$3} >{read child$7}</read Component$0>
59 + Return read $8
60 ```
61
62 ### CFG
@@ -66,41 +66,41 @@ flowchart TB
66 %% Basic Blocks
67 subgraph bb0
68 bb0_instrs["
69 - [1] Let mutate x$10[1:6] = Array []
69 + [1] Let mutate x$2[1:6] = Array []
70 [2] Let mutate y$3 = undefined
71 - [3] Const mutate $12 = false
72 - [4] Const mutate $13 = true
73 - [5] Const mutate $14 = 1
71 + [3] Const mutate $4 = false
72 + [4] Const mutate $5 = true
73 + [5] Const mutate $6 = 1
74 "]
75 - bb0_instrs --> bb0_terminal(["Switch (read props$9.p0)"])
75 + bb0_instrs --> bb0_terminal(["Switch (read props$1.p0)"])
76 end
77 subgraph bb6
78 bb6_instrs["
79 - [6] Call mutate x$10.push(read props$9.p2)
79 + [6] Call mutate x$2.push(read props$1.p2)
80 [7] Reassign mutate y$3 = Array []
81 "]
82 bb6_instrs --> bb6_terminal(["Goto"])
83 end
84 subgraph bb2
85 bb2_instrs["
86 - [8] Reassign mutate y$3 = read x$10
86 + [8] Reassign mutate y$3 = read x$2
87 "]
88 bb2_instrs --> bb2_terminal(["Goto"])
89 end
90 subgraph bb1
91 bb1_instrs["
92 - [9] Const mutate child$19 = JSX <read Component$0 data={freeze x$10} ></read Component$0>
93 - [10] Call read y$3.push(read props$9.p4)
94 - [11] Const mutate $22 = JSX <read Component$0 data={freeze y$3} >{read child$19}</read Component$0>
92 + [9] Const mutate child$7 = JSX <read Component$0 data={freeze x$2} ></read Component$0>
93 + [10] Call read y$3.push(read props$1.p4)
94 + [11] Const mutate $8 = JSX <read Component$0 data={freeze y$3} >{read child$7}</read Component$0>
95 "]
96 - bb1_instrs --> bb1_terminal(["Return read $22"])
96 + bb1_instrs --> bb1_terminal(["Return read $8"])
97 end
98
99 %% Jumps
100 - bb0_terminal -- read $14 --> bb1
101 - bb0_terminal -- read $13 --> bb6
100 + bb0_terminal -- read $6 --> bb1
101 + bb0_terminal -- read $5 --> bb6
102 bb0_terminal -- default --> bb1
103 - bb0_terminal -- read $12 --> bb2
103 + bb0_terminal -- read $4 --> bb2
104 bb0_terminal -- fallthrough --> bb1
105 bb6_terminal --> bb1
106 bb2_terminal --> bb1
@@ -110,16 +110,16 @@ flowchart TB
110 ## Code
111
112 ```javascript
113 -function Component$0(props$9) {
114 - let x$10 = [];
113 +function Component$0(props$1) {
114 + let x$2 = [];
115 let y$3 = undefined;
116 - bb1: switch (props$9.p0) {
116 + bb1: switch (props$1.p0) {
117 case 1: {
118 break bb1;
119 }
120
121 case true: {
122 - x$10.push(props$9.p2);
122 + x$2.push(props$1.p2);
123 y$3 = [];
124 break bb1;
125 }
@@ -129,13 +129,13 @@ function Component$0(props$9) {
129 }
130
131 case false: {
132 - y$3 = x$10;
132 + y$3 = x$2;
133 }
134 }
135
136 - const child$19 = <Component$0 data={x$10}></Component$0>;
137 - y$3.push(props$9.p4);
138 - return <Component$0 data={y$3}>{child$19}</Component$0>;
136 + const child$7 = <Component$0 data={x$2}></Component$0>;
137 + y$3.push(props$1.p4);
138 + return <Component$0 data={y$3}>{child$7}</Component$0>;
139 }
140
141 ```
compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md
+49 -49
@@ -36,44 +36,44 @@ function foo(x) {
36
37 ```
38 bb0:
39 - [1] Let mutate y$10 = undefined
40 - [2] Const mutate $11 = 5
41 - [3] Const mutate $12 = 4
42 - [4] Const mutate $13 = 3
43 - [5] Const mutate $14 = 2
44 - [6] Const mutate $15 = 1
45 - [7] Const mutate $16 = 0
46 - Switch (read x$9)
47 - Case read $16: bb10
48 - Case read $15: bb9
49 - Case read $14: bb1
50 - Case read $13: bb5
51 - Case read $12: bb4
52 - Case read $11: bb3
39 + [1] Let mutate y$2 = undefined
40 + [2] Const mutate $3 = 5
41 + [3] Const mutate $4 = 4
42 + [4] Const mutate $5 = 3
43 + [5] Const mutate $6 = 2
44 + [6] Const mutate $7 = 1
45 + [7] Const mutate $8 = 0
46 + Switch (read x$1)
47 + Case read $8: bb10
48 + Case read $7: bb9
49 + Case read $6: bb1
50 + Case read $5: bb5
51 + Case read $4: bb4
52 + Case read $3: bb3
53 Default: bb2
54 bb10:
55 predecessor blocks: bb0
56 - [8] Reassign mutate y$17 = 0
56 + [8] Reassign mutate y$2 = 0
57 Goto bb9
58 bb9:
59 predecessor blocks: bb10 bb0
60 - [9] Reassign mutate y$18 = 1
60 + [9] Reassign mutate y$2 = 1
61 Goto bb1
62 bb5:
63 predecessor blocks: bb0
64 - [10] Reassign mutate y$19 = 3
64 + [10] Reassign mutate y$2 = 3
65 Goto bb1
66 bb4:
67 predecessor blocks: bb0
68 - [11] Reassign mutate y$20 = 4
68 + [11] Reassign mutate y$2 = 4
69 Goto bb3
70 bb3:
71 predecessor blocks: bb4 bb0
72 - [12] Reassign mutate y$21 = 5
72 + [12] Reassign mutate y$2 = 5
73 Goto bb2
74 bb2:
75 predecessor blocks: bb3 bb0
76 - [13] Reassign mutate y$22 = 0
76 + [13] Reassign mutate y$2 = 0
77 Goto bb1
78 bb1:
79 predecessor blocks: bb9 bb0 bb5 bb2
@@ -87,49 +87,49 @@ flowchart TB
87 %% Basic Blocks
88 subgraph bb0
89 bb0_instrs["
90 - [1] Let mutate y$10 = undefined
91 - [2] Const mutate $11 = 5
92 - [3] Const mutate $12 = 4
93 - [4] Const mutate $13 = 3
94 - [5] Const mutate $14 = 2
95 - [6] Const mutate $15 = 1
96 - [7] Const mutate $16 = 0
90 + [1] Let mutate y$2 = undefined
91 + [2] Const mutate $3 = 5
92 + [3] Const mutate $4 = 4
93 + [4] Const mutate $5 = 3
94 + [5] Const mutate $6 = 2
95 + [6] Const mutate $7 = 1
96 + [7] Const mutate $8 = 0
97 "]
98 - bb0_instrs --> bb0_terminal(["Switch (read x$9)"])
98 + bb0_instrs --> bb0_terminal(["Switch (read x$1)"])
99 end
100 subgraph bb10
101 bb10_instrs["
102 - [8] Reassign mutate y$17 = 0
102 + [8] Reassign mutate y$2 = 0
103 "]
104 bb10_instrs --> bb10_terminal(["Goto"])
105 end
106 subgraph bb9
107 bb9_instrs["
108 - [9] Reassign mutate y$18 = 1
108 + [9] Reassign mutate y$2 = 1
109 "]
110 bb9_instrs --> bb9_terminal(["Goto"])
111 end
112 subgraph bb5
113 bb5_instrs["
114 - [10] Reassign mutate y$19 = 3
114 + [10] Reassign mutate y$2 = 3
115 "]
116 bb5_instrs --> bb5_terminal(["Goto"])
117 end
118 subgraph bb4
119 bb4_instrs["
120 - [11] Reassign mutate y$20 = 4
120 + [11] Reassign mutate y$2 = 4
121 "]
122 bb4_instrs --> bb4_terminal(["Goto"])
123 end
124 subgraph bb3
125 bb3_instrs["
126 - [12] Reassign mutate y$21 = 5
126 + [12] Reassign mutate y$2 = 5
127 "]
128 bb3_instrs --> bb3_terminal(["Goto"])
129 end
130 subgraph bb2
131 bb2_instrs["
132 - [13] Reassign mutate y$22 = 0
132 + [13] Reassign mutate y$2 = 0
133 "]
134 bb2_instrs --> bb2_terminal(["Goto"])
135 end
@@ -138,12 +138,12 @@ flowchart TB
138 end
139
140 %% Jumps
141 - bb0_terminal -- read $16 --> bb10
142 - bb0_terminal -- read $15 --> bb9
143 - bb0_terminal -- read $14 --> bb1
144 - bb0_terminal -- read $13 --> bb5
145 - bb0_terminal -- read $12 --> bb4
146 - bb0_terminal -- read $11 --> bb3
141 + bb0_terminal -- read $8 --> bb10
142 + bb0_terminal -- read $7 --> bb9
143 + bb0_terminal -- read $6 --> bb1
144 + bb0_terminal -- read $5 --> bb5
145 + bb0_terminal -- read $4 --> bb4
146 + bb0_terminal -- read $3 --> bb3
147 bb0_terminal -- default --> bb2
148 bb0_terminal -- fallthrough --> bb1
149 bb10_terminal --> bb9
@@ -158,15 +158,15 @@ flowchart TB
158 ## Code
159
160 ```javascript
161 -function foo$0(x$9) {
162 - let y$10 = undefined;
163 - bb1: switch (x$9) {
161 +function foo$0(x$1) {
162 + let y$2 = undefined;
163 + bb1: switch (x$1) {
164 case 0: {
165 - y$17 = 0;
165 + y$2 = 0;
166 }
167
168 case 1: {
169 - y$18 = 1;
169 + y$2 = 1;
170 break bb1;
171 }
172
@@ -175,20 +175,20 @@ function foo$0(x$9) {
175 }
176
177 case 3: {
178 - y$19 = 3;
178 + y$2 = 3;
179 break bb1;
180 }
181
182 case 4: {
183 - y$20 = 4;
183 + y$2 = 4;
184 }
185
186 case 5: {
187 - y$21 = 5;
187 + y$2 = 5;
188 }
189
190 default: {
191 - y$22 = 0;
191 + y$2 = 0;
192 }
193 }
194
compiler/forget/src/__tests__/fixtures/hir/switch.expect.md
+38 -38
@@ -28,30 +28,30 @@ function Component(props) {
28
29 ```
30 bb0:
31 - [1] Let mutate x$9[1:6] = Array []
31 + [1] Let mutate x$2[1:6] = Array []
32 [2] Let mutate y$3 = undefined
33 - [3] Const mutate $11 = false
34 - [4] Const mutate $12 = true
35 - Switch (read props$8.p0)
36 - Case read $12: bb4
37 - Case read $11: bb2
33 + [3] Const mutate $4 = false
34 + [4] Const mutate $5 = true
35 + Switch (read props$1.p0)
36 + Case read $5: bb4
37 + Case read $4: bb2
38 Default: bb1
39 bb4:
40 predecessor blocks: bb0
41 - [5] Call mutate x$9.push(read props$8.p2)
42 - [6] Call mutate x$9.push(read props$8.p3)
43 - [7] Reassign mutate y$13 = Array []
41 + [5] Call mutate x$2.push(read props$1.p2)
42 + [6] Call mutate x$2.push(read props$1.p3)
43 + [7] Reassign mutate y$3 = Array []
44 Goto bb2
45 bb2:
46 predecessor blocks: bb4 bb0
47 - [8] Reassign mutate y$3 = read x$9
47 + [8] Reassign mutate y$3 = read x$2
48 Goto bb1
49 bb1:
50 predecessor blocks: bb2 bb0
51 - [9] Const mutate child$19 = JSX <read Component$0 data={freeze x$9} ></read Component$0>
52 - [10] Call read y$3.push(read props$8.p4)
53 - [11] Const mutate $23 = JSX <read Component$0 data={read y$3} >{read child$19}</read Component$0>
54 - Return read $23
51 + [9] Const mutate child$6 = JSX <read Component$0 data={freeze x$2} ></read Component$0>
52 + [10] Call read y$3.push(read props$1.p4)
53 + [11] Const mutate $7 = JSX <read Component$0 data={read y$3} >{read child$6}</read Component$0>
54 + Return read $7
55 ```
56
57 ### CFG
@@ -61,39 +61,39 @@ flowchart TB
61 %% Basic Blocks
62 subgraph bb0
63 bb0_instrs["
64 - [1] Let mutate x$9[1:6] = Array []
64 + [1] Let mutate x$2[1:6] = Array []
65 [2] Let mutate y$3 = undefined
66 - [3] Const mutate $11 = false
67 - [4] Const mutate $12 = true
66 + [3] Const mutate $4 = false
67 + [4] Const mutate $5 = true
68 "]
69 - bb0_instrs --> bb0_terminal(["Switch (read props$8.p0)"])
69 + bb0_instrs --> bb0_terminal(["Switch (read props$1.p0)"])
70 end
71 subgraph bb4
72 bb4_instrs["
73 - [5] Call mutate x$9.push(read props$8.p2)
74 - [6] Call mutate x$9.push(read props$8.p3)
75 - [7] Reassign mutate y$13 = Array []
73 + [5] Call mutate x$2.push(read props$1.p2)
74 + [6] Call mutate x$2.push(read props$1.p3)
75 + [7] Reassign mutate y$3 = Array []
76 "]
77 bb4_instrs --> bb4_terminal(["Goto"])
78 end
79 subgraph bb2
80 bb2_instrs["
81 - [8] Reassign mutate y$3 = read x$9
81 + [8] Reassign mutate y$3 = read x$2
82 "]
83 bb2_instrs --> bb2_terminal(["Goto"])
84 end
85 subgraph bb1
86 bb1_instrs["
87 - [9] Const mutate child$19 = JSX <read Component$0 data={freeze x$9} ></read Component$0>
88 - [10] Call read y$3.push(read props$8.p4)
89 - [11] Const mutate $23 = JSX <read Component$0 data={read y$3} >{read child$19}</read Component$0>
87 + [9] Const mutate child$6 = JSX <read Component$0 data={freeze x$2} ></read Component$0>
88 + [10] Call read y$3.push(read props$1.p4)
89 + [11] Const mutate $7 = JSX <read Component$0 data={read y$3} >{read child$6}</read Component$0>
90 "]
91 - bb1_instrs --> bb1_terminal(["Return read $23"])
91 + bb1_instrs --> bb1_terminal(["Return read $7"])
92 end
93
94 %% Jumps
95 - bb0_terminal -- read $12 --> bb4
96 - bb0_terminal -- read $11 --> bb2
95 + bb0_terminal -- read $5 --> bb4
96 + bb0_terminal -- read $4 --> bb2
97 bb0_terminal -- default --> bb1
98 bb0_terminal -- fallthrough --> bb1
99 bb4_terminal --> bb2
@@ -104,24 +104,24 @@ flowchart TB
104 ## Code
105
106 ```javascript
107 -function Component$0(props$8) {
108 - let x$9 = [];
107 +function Component$0(props$1) {
108 + let x$2 = [];
109 let y$3 = undefined;
110 - bb1: switch (props$8.p0) {
110 + bb1: switch (props$1.p0) {
111 case true: {
112 - x$9.push(props$8.p2);
113 - x$9.push(props$8.p3);
114 - y$13 = [];
112 + x$2.push(props$1.p2);
113 + x$2.push(props$1.p3);
114 + y$3 = [];
115 }
116
117 case false: {
118 - y$3 = x$9;
118 + y$3 = x$2;
119 }
120 }
121
122 - const child$19 = <Component$0 data={x$9}></Component$0>;
123 - y$3.push(props$8.p4);
124 - return <Component$0 data={y$3}>{child$19}</Component$0>;
122 + const child$6 = <Component$0 data={x$2}></Component$0>;
123 + y$3.push(props$1.p4);
124 + return <Component$0 data={y$3}>{child$6}</Component$0>;
125 }
126
127 ```
compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md
+7 -7
@@ -18,10 +18,10 @@ bb0:
18 While test=bb1 loop=bb2 fallthrough=bb2
19 bb1:
20 predecessor blocks: bb0
21 - If (read a$3) then:bb2 else:bb2
21 + If (read a$1) then:bb2 else:bb2
22 bb2:
23 predecessor blocks: bb1
24 - Return read b$4
24 + Return read b$2
25 ```
26
27 ### CFG
@@ -33,10 +33,10 @@ flowchart TB
33 bb0_terminal(["While"])
34 end
35 subgraph bb1
36 - bb1_terminal(["If (read a$3)"])
36 + bb1_terminal(["If (read a$1)"])
37 end
38 subgraph bb2
39 - bb2_terminal(["Return read b$4"])
39 + bb2_terminal(["Return read b$2"])
40 end
41
42 %% Jumps
@@ -51,11 +51,11 @@ flowchart TB
51 ## Code
52
53 ```javascript
54 -function foo$0(a$3, b$4) {
55 - bb2: while (a$3) {
54 +function foo$0(a$1, b$2) {
55 + bb2: while (a$1) {
56 break;
57 }
58 - return b$4;
58 + return b$2;
59 }
60
61 ```
compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md
+13 -13
@@ -22,20 +22,20 @@ bb0:
22 While test=bb1 loop=bb3 fallthrough=bb2
23 bb1:
24 predecessor blocks: bb0 bb5 bb4
25 - If (read a$5) then:bb3 else:bb2
25 + If (read a$1) then:bb3 else:bb2
26 bb3:
27 predecessor blocks: bb1
28 - If (read b$6) then:bb5 else:bb4
28 + If (read b$2) then:bb5 else:bb4
29 bb5:
30 predecessor blocks: bb3
31 Goto(Continue) bb1
32 bb4:
33 predecessor blocks: bb3
34 - [1] Call read c$7()
34 + [1] Call read c$3()
35 Goto(Continue) bb1
36 bb2:
37 predecessor blocks: bb1
38 - [2] Call read d$8()
38 + [2] Call read d$4()
39 Return
40 ```
41
@@ -48,23 +48,23 @@ flowchart TB
48 bb0_terminal(["While"])
49 end
50 subgraph bb1
51 - bb1_terminal(["If (read a$5)"])
51 + bb1_terminal(["If (read a$1)"])
52 end
53 subgraph bb3
54 - bb3_terminal(["If (read b$6)"])
54 + bb3_terminal(["If (read b$2)"])
55 end
56 subgraph bb5
57 bb5_terminal(["Goto"])
58 end
59 subgraph bb4
60 bb4_instrs["
61 - [1] Call read c$7()
61 + [1] Call read c$3()
62 "]
63 bb4_instrs --> bb4_terminal(["Goto"])
64 end
65 subgraph bb2
66 bb2_instrs["
67 - [2] Call read d$8()
67 + [2] Call read d$4()
68 "]
69 bb2_instrs --> bb2_terminal(["Return"])
70 end
@@ -85,15 +85,15 @@ flowchart TB
85 ## Code
86
87 ```javascript
88 -function foo$0(a$5, b$6, c$7, d$8) {
89 - bb2: while (a$5) {
90 - bb4: if (b$6) {
88 +function foo$0(a$1, b$2, c$3, d$4) {
89 + bb2: while (a$1) {
90 + bb4: if (b$2) {
91 continue;
92 }
93 - c$7();
93 + c$3();
94 }
95
96 - d$8();
96 + d$4();
97 return;
98 }
99