From 4385a283e4dce84029b1da51ce615e832e89f95c Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 22 Dec 2022 10:23:11 -0800 Subject: [PATCH] Ensure non-conflicting names in output, wo suffixes by default --- compiler/forget/src/CompilerPipeline.ts | 2 + compiler/forget/src/HIR/Codegen.ts | 2 +- .../src/ReactiveScopes/RenameVariables.ts | 194 ++++++++++++++++++ compiler/forget/src/ReactiveScopes/index.ts | 1 + .../_bug_conditional-break-labeled.expect.md | 14 +- .../_bug_expression-with-assignment.expect.md | 20 +- .../alias-nested-member-path-mutate.expect.md | 14 +- .../hir/alias-nested-member-path.expect.md | 40 ++-- .../fixtures/hir/alias-while.expect.md | 52 ++--- .../hir/assignment-variations.expect.md | 28 +-- .../src/__tests__/fixtures/hir/call.expect.md | 44 ++-- .../fixtures/hir/complex-while.expect.md | 8 +- .../fixtures/hir/component.expect.md | 90 ++++---- .../fixtures/hir/conditional-break.expect.md | 154 +++++++------- .../hir/conditional-on-mutable.expect.md | 104 +++++----- .../fixtures/hir/constructor.expect.md | 44 ++-- .../hir/dependencies-outputs.expect.md | 28 +-- .../fixtures/hir/dependencies.expect.md | 32 +-- .../fixtures/hir/extend-scopes-if.expect.md | 16 +- .../fixtures/hir/frozen-after-alias.expect.md | 20 +- .../fixtures/hir/hook-call.expect.md | 54 ++--- .../hir/hooks-freeze-arguments.expect.md | 22 +- ...reeze-possibly-mutable-arguments.expect.md | 92 ++++----- .../hir/independent-across-if.expect.md | 56 ++--- .../fixtures/hir/independent.expect.md | 50 ++--- ...endently-memoize-object-property.expect.md | 44 ++-- .../hir/interdependent-across-if.expect.md | 58 +++--- .../fixtures/hir/interdependent.expect.md | 52 ++--- .../fixtures/hir/inverted-if.expect.md | 10 +- .../__tests__/fixtures/hir/issue852.expect.md | 22 +- .../fixtures/hir/jsx-fragment.expect.md | 44 ++-- .../fixtures/hir/logical-expression.expect.md | 118 +++++------ .../hir/mutable-lifetime-loops.expect.md | 106 +++++----- .../mutable-lifetime-with-aliasing.expect.md | 44 ++-- .../hir/mutable-liverange-loop.expect.md | 34 +-- ...g-scopes-interleaved-by-terminal.expect.md | 12 +- .../overlapping-scopes-interleaved.expect.md | 10 +- .../hir/overlapping-scopes-shadowed.expect.md | 10 +- ...ng-scopes-shadowing-within-block.expect.md | 60 +++--- .../hir/overlapping-scopes-while.expect.md | 12 +- .../overlapping-scopes-within-block.expect.md | 34 +-- .../hir/property-assignment.expect.md | 46 ++--- .../hir/reactive-scope-grouping.expect.md | 26 +-- .../fixtures/hir/reactive-scopes-if.expect.md | 56 ++--- .../fixtures/hir/reactive-scopes.expect.md | 38 ++-- .../hir/reassignment-conditional.expect.md | 90 ++++---- .../reassignment-separate-scopes.expect.md | 142 ++++++------- .../fixtures/hir/reassignment.expect.md | 68 +++--- .../fixtures/hir/reverse-postorder.expect.md | 122 +++++------ .../fixtures/hir/simple-alias.expect.md | 48 ++--- .../__tests__/fixtures/hir/simple.expect.md | 28 +-- .../hir/ssa-arrayexpression.expect.md | 16 +- .../fixtures/hir/ssa-call-jsx-2.expect.md | 54 ++--- .../fixtures/hir/ssa-call-jsx.expect.md | 44 ++-- .../hir/ssa-complex-multiple-if.expect.md | 68 +++--- .../hir/ssa-complex-single-if.expect.md | 40 ++-- .../fixtures/hir/ssa-for-of.expect.md | 4 +- .../hir/ssa-for-trivial-update.expect.md | 16 +- .../__tests__/fixtures/hir/ssa-for.expect.md | 16 +- .../fixtures/hir/ssa-if-else.expect.md | 12 +- .../fixtures/hir/ssa-multiple-phis.expect.md | 112 +++++----- .../ssa-nested-loops-no-reassign.expect.md | 14 +- .../hir/ssa-nested-partial-phi.expect.md | 44 ++-- .../ssa-nested-partial-reassignment.expect.md | 68 +++--- .../fixtures/hir/ssa-newexpression.expect.md | 18 +- .../hir/ssa-objectexpression-phi.expect.md | 80 ++++---- .../hir/ssa-objectexpression.expect.md | 20 +- ...a-property-alias-alias-mutate-if.expect.md | 30 +-- .../hir/ssa-property-alias-if.expect.md | 38 ++-- .../ssa-property-alias-mutate-if.expect.md | 28 +-- ...-property-alias-mutate-inside-if.expect.md | 34 +-- .../hir/ssa-property-alias-mutate.expect.md | 20 +- .../fixtures/hir/ssa-property-call.expect.md | 28 +-- .../hir/ssa-property-mutate-2.expect.md | 18 +- .../hir/ssa-property-mutate-alias.expect.md | 20 +- .../hir/ssa-property-mutate.expect.md | 18 +- .../fixtures/hir/ssa-property.expect.md | 26 +-- .../fixtures/hir/ssa-reassign.expect.md | 28 +-- .../fixtures/hir/ssa-return.expect.md | 38 ++-- .../fixtures/hir/ssa-shadowing.expect.md | 56 ++--- .../fixtures/hir/ssa-sibling-phis.expect.md | 108 +++++----- .../fixtures/hir/ssa-simple-phi.expect.md | 50 ++--- .../fixtures/hir/ssa-simple.expect.md | 6 +- .../fixtures/hir/ssa-single-if.expect.md | 10 +- .../fixtures/hir/ssa-switch.expect.md | 66 +++--- .../fixtures/hir/ssa-throw.expect.md | 38 ++-- .../hir/ssa-while-no-reassign.expect.md | 10 +- .../fixtures/hir/ssa-while.expect.md | 16 +- .../hir/switch-non-final-default.expect.md | 104 +++++----- .../hir/switch-with-fallthrough.expect.md | 42 ++-- .../__tests__/fixtures/hir/switch.expect.md | 96 ++++----- .../hir/transitive-alias-fields.expect.md | 18 +- .../type-args-test-binary-operator.expect.md | 6 +- .../hir/type-binary-operator.expect.md | 22 +- .../fixtures/hir/type-field-load.expect.md | 12 +- .../type-test-field-load-binary-op.expect.md | 48 ++--- .../hir/type-test-field-store.expect.md | 22 +- .../hir/type-test-polymorphic.expect.md | 44 ++-- .../hir/type-test-primitive.expect.md | 6 +- .../type-test-return-type-inference.expect.md | 24 +-- .../fixtures/hir/while-break.expect.md | 6 +- .../hir/while-conditional-continue.expect.md | 10 +- compiler/forget/test262 | 2 +- 103 files changed, 2243 insertions(+), 2046 deletions(-) create mode 100644 compiler/forget/src/ReactiveScopes/RenameVariables.ts diff --git a/compiler/forget/src/CompilerPipeline.ts b/compiler/forget/src/CompilerPipeline.ts index 3532f92eef..6cd73a4158 100644 --- a/compiler/forget/src/CompilerPipeline.ts +++ b/compiler/forget/src/CompilerPipeline.ts @@ -24,6 +24,7 @@ import { propagateScopeDependencies, pruneUnusedLabels, pruneUnusedScopes, + renameVariables, } from "./ReactiveScopes"; import { eliminateRedundantPhi, enterSSA, leaveSSA } from "./SSA"; import { logHIRFunction } from "./Utils/logger"; @@ -71,6 +72,7 @@ export default function ( flattenReactiveLoops(reactiveFunction); propagateScopeDependencies(reactiveFunction); pruneUnusedScopes(reactiveFunction); + renameVariables(reactiveFunction); const scopes = printReactiveFunction(reactiveFunction); const ast = codegenReactiveFunction(reactiveFunction); diff --git a/compiler/forget/src/HIR/Codegen.ts b/compiler/forget/src/HIR/Codegen.ts index ba0cc9ec54..d84100543f 100644 --- a/compiler/forget/src/HIR/Codegen.ts +++ b/compiler/forget/src/HIR/Codegen.ts @@ -542,7 +542,7 @@ export function codegenPlace(temp: Temporaries, place: Place): t.Expression { export function convertIdentifier(identifier: Identifier): t.Identifier { if (identifier.name !== null) { - return t.identifier(`${identifier.name}$${identifier.id}`); + return t.identifier(`${identifier.name}`); } return t.identifier(`t${identifier.id}`); } diff --git a/compiler/forget/src/ReactiveScopes/RenameVariables.ts b/compiler/forget/src/ReactiveScopes/RenameVariables.ts new file mode 100644 index 0000000000..f62ade7926 --- /dev/null +++ b/compiler/forget/src/ReactiveScopes/RenameVariables.ts @@ -0,0 +1,194 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { + Identifier, + IdentifierId, + ReactiveBlock, + ReactiveFunction, + ReactiveTerminal, + ReactiveValueBlock, +} from "../HIR/HIR"; +import { + eachInstructionOperand, + eachInstructionValueOperand, +} from "../HIR/visitors"; +import { invariant } from "../Utils/CompilerError"; +import { assertExhaustive } from "../Utils/utils"; + +/** + * Ensures that each named variable in the given function has a unique name + * that does not conflict with any other variables in the same block scope. + * Note that the scoping is based on the final inferred blocks, not the + * block scopes that were present in the original source. Thus variables + * that shadowed in the original source may end up with unique names in the + * output, if Forget would merge those two blocks into a single scope. + */ +export function renameVariables(fn: ReactiveFunction): void { + const scopes = new Scopes(); + scopes.enter(() => { + if (fn.id !== null) { + scopes.visit(fn.id); + } + for (const param of fn.params) { + scopes.visit(param.identifier); + } + visitBlock(scopes, fn.body); + }); +} + +function visitBlock(scopes: Scopes, block: ReactiveBlock): void { + scopes.enter(() => visitBlockInner(scopes, block)); +} + +function visitBlockInner(scopes: Scopes, block: ReactiveBlock): void { + for (const stmt of block) { + switch (stmt.kind) { + case "instruction": { + for (const operand of eachInstructionOperand(stmt.instruction)) { + scopes.visit(operand.identifier); + } + if (stmt.instruction.lvalue !== null) { + scopes.visit(stmt.instruction.lvalue.place.identifier); + } + break; + } + case "scope": { + // NOTE: we intentionally don't enter new block scope here, + // since the outputs of the scope will be in the outer block + visitBlockInner(scopes, stmt.instructions); + break; + } + case "terminal": { + visitTerminal(scopes, stmt.terminal); + break; + } + } + } +} + +function visitValueBlock(scopes: Scopes, block: ReactiveValueBlock): void { + for (const stmt of block.instructions) { + invariant( + stmt.kind === "instruction", + "Value blocks may only contain instructions" + ); + for (const operand of eachInstructionValueOperand(stmt.instruction.value)) { + scopes.visit(operand.identifier); + } + if (stmt.instruction.lvalue !== null) { + scopes.visit(stmt.instruction.lvalue.place.identifier); + } + } + if (block.value !== null) { + for (const operand of eachInstructionValueOperand(block.value)) { + scopes.visit(operand.identifier); + } + } +} + +export function visitTerminal( + scopes: Scopes, + terminal: ReactiveTerminal +): void { + switch (terminal.kind) { + case "return": { + if (terminal.value !== null) { + scopes.visit(terminal.value.identifier); + } + break; + } + case "throw": { + scopes.visit(terminal.value.identifier); + break; + } + case "break": + case "continue": { + break; + } + case "for": { + scopes.enter(() => { + visitValueBlock(scopes, terminal.init); + visitValueBlock(scopes, terminal.test); + visitValueBlock(scopes, terminal.update); + visitBlock(scopes, terminal.loop); + }); + break; + } + case "while": { + visitValueBlock(scopes, terminal.test); + visitBlock(scopes, terminal.loop); + break; + } + case "if": { + scopes.visit(terminal.test.identifier); + visitBlock(scopes, terminal.consequent); + if (terminal.alternate !== null) { + visitBlock(scopes, terminal.alternate); + } + break; + } + case "switch": { + scopes.visit(terminal.test.identifier); + for (const case_ of terminal.cases) { + if (case_.test !== null) { + scopes.visit(case_.test.identifier); + } + if (case_.block !== undefined) { + visitBlock(scopes, case_.block); + } + } + break; + } + default: { + assertExhaustive( + terminal, + `Unexpected terminal kind '${(terminal as any).kind}'` + ); + } + } +} + +class Scopes { + #nextId: number = 0; + #seen: Set = new Set(); + #stack: Array> = [new Map()]; + + visit(identifier: Identifier): void { + if (identifier.name === null || this.#seen.has(identifier.id)) { + return; + } + this.#seen.add(identifier.id); + let name = identifier.name; + let previous = this.#lookup(name); + while (previous !== null) { + name = `${identifier.name}$${this.#nextId++}`; + previous = this.#lookup(name); + } + identifier.name = name; + this.#stack.at(-1)!.set(name, identifier.id); + } + + #lookup(name: string): IdentifierId | null { + for (let i = this.#stack.length - 1; i >= 0; i--) { + const scope = this.#stack[i]!; + const entry = scope.get(name); + if (entry !== undefined) { + return entry; + } + } + return null; + } + + enter(fn: () => void): void { + const next = new Map(); + this.#stack.push(next); + fn(); + const last = this.#stack.pop(); + invariant(last === next, "Mismatch push/pop calls"); + } +} diff --git a/compiler/forget/src/ReactiveScopes/index.ts b/compiler/forget/src/ReactiveScopes/index.ts index 8491e3b914..acc1f021f9 100644 --- a/compiler/forget/src/ReactiveScopes/index.ts +++ b/compiler/forget/src/ReactiveScopes/index.ts @@ -14,3 +14,4 @@ export { printReactiveFunction } from "./PrintReactiveFunction"; export { propagateScopeDependencies } from "./PropagateScopeDependencies"; export { pruneUnusedLabels } from "./PruneUnusedLabels"; export { pruneUnusedScopes } from "./PruneUnusedScopes"; +export { renameVariables } from "./RenameVariables"; diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md index ab354c4b22..0511d9c238 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md @@ -57,15 +57,15 @@ function Component( ## Code ```javascript -function Component$0(props$3) { - const a$4 = []; - a$4.push(props$3.a); - if (props$3.b) { - a$4.push(props$3.d); - return a$4; +function Component(props) { + const a = []; + a.push(props.a); + if (props.b) { + a.push(props.d); + return a; } - a$4.push(props$3.c); + a.push(props.c); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md index a99015a7f6..0ec94a3e82 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug_expression-with-assignment.expect.md @@ -16,9 +16,9 @@ function f() { ``` bb0: [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate x$5:TPrimitive = 2 - [3] Const mutate $6:TPrimitive = Binary read x$5:TPrimitive + read x$5:TPrimitive - [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$5:TPrimitive + [2] Const mutate x$0$5:TPrimitive = 2 + [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive + [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive [5] Return read $7:TPrimitive ``` @@ -28,9 +28,9 @@ bb0: function f( ) { [1] Const mutate x$4:TPrimitive = 1 - [2] Const mutate x$5:TPrimitive = 2 - [3] Const mutate $6:TPrimitive = Binary read x$5:TPrimitive + read x$5:TPrimitive - [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$5:TPrimitive + [2] Const mutate x$0$5:TPrimitive = 2 + [3] Const mutate $6:TPrimitive = Binary read x$0$5:TPrimitive + read x$0$5:TPrimitive + [4] Const mutate $7:TPrimitive = Binary read $6:TPrimitive + read x$0$5:TPrimitive return read $7:TPrimitive } @@ -39,10 +39,10 @@ function f( ## Code ```javascript -function f$0() { - const x$4 = 1; - const x$5 = 2; - return x$5 + x$5 + x$5; +function f() { + const x = 1; + const x$0 = 2; + return x$0 + x$0 + x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md index 82990ba470..ed9bdb7c5a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path-mutate.expect.md @@ -45,13 +45,13 @@ function component( ## Code ```javascript -function component$0() { - const z$5 = []; - const y$6 = {}; - y$6.z = z$5; - const x$7 = {}; - x$7.y = y$6; - mutate$4(x$7.y.z); +function component() { + const z = []; + const y = {}; + y.z = z; + const x = {}; + x.y = y; + mutate(x.y.z); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md index fcb1cae51e..78cfb7633c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-nested-member-path.expect.md @@ -49,41 +49,41 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let z$4; + let z; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - z$4 = []; - $[0] = z$4; + z = []; + $[0] = z; } else { - z$4 = $[0]; + z = $[0]; } - const c_1 = $[1] !== z$4; - let y$5; + const c_1 = $[1] !== z; + let y; if (c_1) { - y$5 = {}; - y$5.z = z$4; - $[1] = z$4; - $[2] = y$5; + y = {}; + y.z = z; + $[1] = z; + $[2] = y; } else { - y$5 = $[2]; + y = $[2]; } - const c_3 = $[3] !== y$5; - let x$6; + const c_3 = $[3] !== y; + let x; if (c_3) { - x$6 = {}; - x$6.y = y$5; - $[3] = y$5; - $[4] = x$6; + x = {}; + x.y = y; + $[3] = y; + $[4] = x; } else { - x$6 = $[4]; + x = $[4]; } - return x$6; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md index c0c11f8efb..e9959003b5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/alias-while.expect.md @@ -81,39 +81,39 @@ function foo( ## Code ```javascript -function foo$0(cond$7) { +function foo(cond) { const $ = React.useMemoCache(); - const c_0 = $[0] !== cond$7; - let a$8; - let b$9; - let c$10; + const c_0 = $[0] !== cond; + let a; + let b; + let c; if (c_0) { - a$8 = {}; - b$9 = {}; - c$10 = {}; + a = {}; + b = {}; + c = {}; - while (cond$7) { - const z$13 = a$8; - a$8 = b$9; - b$9 = c$10; - c$10 = z$13; - mutate$6(a$8, b$9); + while (cond) { + const z = a; + a = b; + b = c; + c = z; + mutate(a, b); } - $[0] = cond$7; - $[1] = a$8; - $[2] = b$9; - $[3] = c$10; + $[0] = cond; + $[1] = a; + $[2] = b; + $[3] = c; } else { - a$8 = $[1]; - b$9 = $[2]; - c$10 = $[3]; + a = $[1]; + b = $[2]; + c = $[3]; } - a$8; - b$9; - c$10; - return a$8; + a; + b; + c; + return a; } ``` @@ -139,7 +139,7 @@ function mutate( ## Code ```javascript -function mutate$0(x$3, y$4) {} +function mutate(x, y) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md index a65ad7961e..d5ee6d83c0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/assignment-variations.expect.md @@ -22,11 +22,11 @@ function g(a) { bb0: [1] Const mutate x$5:TPrimitive = 1 [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate x$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive + [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive [4] Const mutate $8:TPrimitive = 1 - [5] Const mutate x$9:TPrimitive = Binary read x$7:TPrimitive + read $8:TPrimitive + [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive [6] Const mutate $10:TPrimitive = 1 - [7] Const mutate x$11:TPrimitive = Binary read x$9:TPrimitive >>> read $10:TPrimitive + [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive [8] Return ``` @@ -37,11 +37,11 @@ function f( ) { [1] Const mutate x$5:TPrimitive = 1 [2] Const mutate $6:TPrimitive = 1 - [3] Const mutate x$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive + [3] Const mutate x$0$7:TPrimitive = Binary read x$5:TPrimitive + read $6:TPrimitive [4] Const mutate $8:TPrimitive = 1 - [5] Const mutate x$9:TPrimitive = Binary read x$7:TPrimitive + read $8:TPrimitive + [5] Const mutate x$1$9:TPrimitive = Binary read x$0$7:TPrimitive + read $8:TPrimitive [6] Const mutate $10:TPrimitive = 1 - [7] Const mutate x$11:TPrimitive = Binary read x$9:TPrimitive >>> read $10:TPrimitive + [7] Const mutate x$2$11:TPrimitive = Binary read x$1$9:TPrimitive >>> read $10:TPrimitive return } @@ -50,11 +50,11 @@ function f( ## Code ```javascript -function f$0() { - const x$5 = 1; - const x$7 = x$5 + 1; - const x$9 = x$7 + 1; - const x$11 = x$9 >>> 1; +function f() { + const x = 1; + const x$0 = x + 1; + const x$1 = x$0 + 1; + const x$2 = x$1 >>> 1; } ``` @@ -89,9 +89,9 @@ function g( ## Code ```javascript -function g$0(a$5) { - a$5.c.b = a$5.b.c + 1; - a$5.c.b = a$5.b.c * 2; +function g(a) { + a.c.b = a.b.c + 1; + a.c.b = a.b.c * 2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md index 8f9472bbd7..829d041c0c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md @@ -35,7 +35,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -79,39 +79,39 @@ function Component( ## Code ```javascript -function Component$0(props$9) { +function Component(props) { const $ = React.useMemoCache(); - let a$10; - let b$11; + let a; + let b; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$10 = []; - b$11 = {}; - foo$4(a$10, b$11); + a = []; + b = {}; + foo(a, b); - const _$13 =
; + const _ =
; - foo$4(b$11); - $[0] = a$10; - $[1] = b$11; + foo(b); + $[0] = a; + $[1] = b; } else { - a$10 = $[0]; - b$11 = $[1]; + a = $[0]; + b = $[1]; } - const c_2 = $[2] !== a$10; - const c_3 = $[3] !== b$11; - let t4$15; + const c_2 = $[2] !== a; + const c_3 = $[3] !== b; + let t4; if (c_2 || c_3) { - t4$15 =
; - $[2] = a$10; - $[3] = b$11; - $[4] = t4$15; + t4 =
; + $[2] = a; + $[3] = b; + $[4] = t4; } else { - t4$15 = $[4]; + t4 = $[4]; } - return t4$15; + return t4; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md index bc73a27367..ea2162539c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/complex-while.expect.md @@ -61,10 +61,10 @@ function foo( ## Code ```javascript -function foo$0(a$4, b$5, c$6) { - if (a$4) { - while (b$5) { - if (c$6) { +function foo(a, b, c) { + if (a) { + while (b) { + if (c) { break; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md index ea3bc8646a..3c7ffce948 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md @@ -174,86 +174,86 @@ function Component( ## Code ```javascript -function Component$0(props$29) { +function Component(props) { const $ = React.useMemoCache(); - const items$30 = props$29.items; - const maxItems$31 = props$29.maxItems; - const c_0 = $[0] !== maxItems$31; - const c_1 = $[1] !== items$30.length; - const c_2 = $[2] !== items$30; - let renderedItems$32; + const items = props.items; + const maxItems = props.maxItems; + const c_0 = $[0] !== maxItems; + const c_1 = $[1] !== items.length; + const c_2 = $[2] !== items; + let renderedItems; if (c_0 || c_1 || c_2) { - renderedItems$32 = []; - const seen$33 = new Set$5(); - const c_4 = $[4] !== maxItems$31; - let max$35; + renderedItems = []; + const seen = new Set(); + const c_4 = $[4] !== maxItems; + let max; if (c_4) { - max$35 = Math$7.max(0, maxItems$31); - $[4] = maxItems$31; - $[5] = max$35; + max = Math.max(0, maxItems); + $[4] = maxItems; + $[5] = max; } else { - max$35 = $[5]; + max = $[5]; } - for (let i$36 = 0; i$36 < items$30.length; i$36 = i$36 + 1, i$36) { - const item$40 = items$30.at(i$36); + for (let i = 0; i < items.length; i = i + 1, i) { + const item = items.at(i); - if (item$40 == null) { + if (item == null) { } else { } - if (seen$33.has(item$40)) { + if (seen.has(item)) { continue; } - seen$33.add(item$40); - renderedItems$32.push(
{item$40}
); + seen.add(item); + renderedItems.push(
{item}
); - if (renderedItems$32.length >= max$35) { + if (renderedItems.length >= max) { break; } } - $[0] = maxItems$31; - $[1] = items$30.length; - $[2] = items$30; - $[3] = renderedItems$32; + $[0] = maxItems; + $[1] = items.length; + $[2] = items; + $[3] = renderedItems; } else { - renderedItems$32 = $[3]; + renderedItems = $[3]; } - const count$66 = renderedItems$32.length; - const c_6 = $[6] !== count$66; - let t7$71; + const count = renderedItems.length; + const c_6 = $[6] !== count; + let t7; if (c_6) { - t7$71 =

{count$66} Items

; - $[6] = count$66; - $[7] = t7$71; + t7 =

{count} Items

; + $[6] = count; + $[7] = t7; } else { - t7$71 = $[7]; + t7 = $[7]; } - const c_8 = $[8] !== t7$71; - const c_9 = $[9] !== renderedItems$32; - let t10$74; + const c_8 = $[8] !== t7; + const c_9 = $[9] !== renderedItems; + let t10; if (c_8 || c_9) { - t10$74 = ( + t10 = (
- {t7$71} - {renderedItems$32} + {t7} + {renderedItems}
); - $[8] = t7$71; - $[9] = renderedItems$32; - $[10] = t10$74; + $[8] = t7; + $[9] = renderedItems; + $[10] = t10; } else { - t10$74 = $[10]; + t10 = $[10]; } - return t10$74; + return t10; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md index 43813732c8..c6cbd8ea7d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md @@ -114,30 +114,30 @@ function Component( ## Code ```javascript -function Component$0(props$4) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$4.a; - const c_1 = $[1] !== props$4.b; - const c_2 = $[2] !== props$4.d; - let a_DEBUG$5; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.d; + let a_DEBUG; if (c_0 || c_1 || c_2) { - a_DEBUG$5 = []; - a_DEBUG$5.push(props$4.a); + a_DEBUG = []; + a_DEBUG.push(props.a); - if (props$4.b) { + if (props.b) { return null; } - a_DEBUG$5.push(props$4.d); - $[0] = props$4.a; - $[1] = props$4.b; - $[2] = props$4.d; - $[3] = a_DEBUG$5; + a_DEBUG.push(props.d); + $[0] = props.a; + $[1] = props.b; + $[2] = props.d; + $[3] = a_DEBUG; } else { - a_DEBUG$5 = $[3]; + a_DEBUG = $[3]; } - return a_DEBUG$5; + return a_DEBUG; } ``` @@ -180,32 +180,32 @@ function Component( ## Code ```javascript -function Component$0(props$3) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$3.a; - const c_1 = $[1] !== props$3.b; - const c_2 = $[2] !== props$3.c; - const c_3 = $[3] !== props$3.d; - let a$4; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.c; + const c_3 = $[3] !== props.d; + let a; if (c_0 || c_1 || c_2 || c_3) { - a$4 = []; - a$4.push(props$3.a); + a = []; + a.push(props.a); - if (props$3.b) { - a$4.push(props$3.c); + if (props.b) { + a.push(props.c); } - a$4.push(props$3.d); - $[0] = props$3.a; - $[1] = props$3.b; - $[2] = props$3.c; - $[3] = props$3.d; - $[4] = a$4; + a.push(props.d); + $[0] = props.a; + $[1] = props.b; + $[2] = props.c; + $[3] = props.d; + $[4] = a; } else { - a$4 = $[4]; + a = $[4]; } - return a$4; + return a; } ``` @@ -251,33 +251,33 @@ function Component( ## Code ```javascript -function Component$0(props$4) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$4.a; - const c_1 = $[1] !== props$4.b; - const c_2 = $[2] !== props$4.c; - const c_3 = $[3] !== props$4.d; - let a$5; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.c; + const c_3 = $[3] !== props.d; + let a; if (c_0 || c_1 || c_2 || c_3) { - a$5 = []; - a$5.push(props$4.a); + a = []; + a.push(props.a); - if (props$4.b) { - a$5.push(props$4.c); + if (props.b) { + a.push(props.c); return null; } - a$5.push(props$4.d); - $[0] = props$4.a; - $[1] = props$4.b; - $[2] = props$4.c; - $[3] = props$4.d; - $[4] = a$5; + a.push(props.d); + $[0] = props.a; + $[1] = props.b; + $[2] = props.c; + $[3] = props.d; + $[4] = a; } else { - a$5 = $[4]; + a = $[4]; } - return a$5; + return a; } ``` @@ -321,33 +321,33 @@ function Component( ## Code ```javascript -function Component$0(props$3) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$3.a; - const c_1 = $[1] !== props$3.b; - const c_2 = $[2] !== props$3.c; - const c_3 = $[3] !== props$3.d; - let a$4; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.c; + const c_3 = $[3] !== props.d; + let a; if (c_0 || c_1 || c_2 || c_3) { - a$4 = []; - a$4.push(props$3.a); + a = []; + a.push(props.a); - if (props$3.b) { - a$4.push(props$3.c); - return a$4; + if (props.b) { + a.push(props.c); + return a; } - a$4.push(props$3.d); - $[0] = props$3.a; - $[1] = props$3.b; - $[2] = props$3.c; - $[3] = props$3.d; - $[4] = a$4; + a.push(props.d); + $[0] = props.a; + $[1] = props.b; + $[2] = props.c; + $[3] = props.d; + $[4] = a; } else { - a$4 = $[4]; + a = $[4]; } - return a$4; + return a; } ``` @@ -388,15 +388,15 @@ function Component( ## Code ```javascript -function Component$0(props$3) { - const a$4 = []; - a$4.push(props$3.a); - if (props$3.b) { - a$4.push(props$3.d); - return a$4; +function Component(props) { + const a = []; + a.push(props.a); + if (props.b) { + a.push(props.d); + return a; } - a$4.push(props$3.c); + a.push(props.c); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md index 4ac13e8503..7762fd9d94 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md @@ -82,46 +82,46 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$6.p0; - const c_1 = $[1] !== props$6.p1; - const c_2 = $[2] !== props$6.p2; - let a$7; + const c_0 = $[0] !== props.p0; + const c_1 = $[1] !== props.p1; + const c_2 = $[2] !== props.p2; + let a; if (c_0 || c_1 || c_2) { - a$7 = []; - const b$8 = []; + a = []; + const b = []; - if (b$8) { - a$7.push(props$6.p0); + if (b) { + a.push(props.p0); } - if (props$6.p1) { - b$8.push(props$6.p2); + if (props.p1) { + b.push(props.p2); } - $[0] = props$6.p0; - $[1] = props$6.p1; - $[2] = props$6.p2; - $[3] = a$7; + $[0] = props.p0; + $[1] = props.p1; + $[2] = props.p2; + $[3] = a; } else { - a$7 = $[3]; + a = $[3]; } - const c_4 = $[4] !== a$7; - const c_5 = $[5] !== b$8; - let t6$16; + const c_4 = $[4] !== a; + const c_5 = $[5] !== b; + let t6; if (c_4 || c_5) { - t6$16 = ; - $[4] = a$7; - $[5] = b$8; - $[6] = t6$16; + t6 = ; + $[4] = a; + $[5] = b; + $[6] = t6; } else { - t6$16 = $[6]; + t6 = $[6]; } - return t6$16; + return t6; } ``` @@ -178,46 +178,46 @@ function Component( ## Code ```javascript -function Component$0(props$8) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$8.p0; - const c_1 = $[1] !== props$8.p1; - const c_2 = $[2] !== props$8.p2; - let a$9; + const c_0 = $[0] !== props.p0; + const c_1 = $[1] !== props.p1; + const c_2 = $[2] !== props.p2; + let a; if (c_0 || c_1 || c_2) { - a$9 = []; - const b$10 = []; + a = []; + const b = []; - if (mayMutate$4(b$10)) { - a$9.push(props$8.p0); + if (mayMutate(b)) { + a.push(props.p0); } - if (props$8.p1) { - b$10.push(props$8.p2); + if (props.p1) { + b.push(props.p2); } - $[0] = props$8.p0; - $[1] = props$8.p1; - $[2] = props$8.p2; - $[3] = a$9; + $[0] = props.p0; + $[1] = props.p1; + $[2] = props.p2; + $[3] = a; } else { - a$9 = $[3]; + a = $[3]; } - const c_4 = $[4] !== a$9; - const c_5 = $[5] !== b$10; - let t6$19; + const c_4 = $[4] !== a; + const c_5 = $[5] !== b; + let t6; if (c_4 || c_5) { - t6$19 = ; - $[4] = a$9; - $[5] = b$10; - $[6] = t6$19; + t6 = ; + $[4] = a; + $[5] = b; + $[6] = t6; } else { - t6$19 = $[6]; + t6 = $[6]; } - return t6$19; + return t6; } ``` @@ -241,7 +241,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` ## HIR @@ -264,7 +264,7 @@ function mayMutate( ## Code ```javascript -function mayMutate$0() {} +function mayMutate() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md index e4e1bb0b7a..e15a4a369a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/constructor.expect.md @@ -35,7 +35,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` ## HIR @@ -79,39 +79,39 @@ function Component( ## Code ```javascript -function Component$0(props$9) { +function Component(props) { const $ = React.useMemoCache(); - let a$10; - let b$11; + let a; + let b; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$10 = []; - b$11 = {}; - new Foo$4(a$10, b$11); + a = []; + b = {}; + new Foo(a, b); - const _$13 =
; + const _ =
; - new Foo$4(b$11); - $[0] = a$10; - $[1] = b$11; + new Foo(b); + $[0] = a; + $[1] = b; } else { - a$10 = $[0]; - b$11 = $[1]; + a = $[0]; + b = $[1]; } - const c_2 = $[2] !== a$10; - const c_3 = $[3] !== b$11; - let t4$15; + const c_2 = $[2] !== a; + const c_3 = $[3] !== b; + let t4; if (c_2 || c_3) { - t4$15 =
; - $[2] = a$10; - $[3] = b$11; - $[4] = t4$15; + t4 =
; + $[2] = a; + $[3] = b; + $[4] = t4; } else { - t4$15 = $[4]; + t4 = $[4]; } - return t4$15; + return t4; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md index 60a4daa58a..39dc5b9e48 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md @@ -72,28 +72,28 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7) { +function foo(a, b) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$6; - let x$8; + const c_0 = $[0] !== a; + let x; if (c_0) { - x$8 = []; - x$8.push(a$6); - $[0] = a$6; - $[1] = x$8; + x = []; + x.push(a); + $[0] = a; + $[1] = x; } else { - x$8 = $[1]; + x = $[1]; } -
{x$8}
; - const y$10 = []; +
{x}
; + const y = []; - if (x$8.length) { - y$10.push(x$8); + if (x.length) { + y.push(x); } - if (b$7) { - y$10.push(b$7); + if (b) { + y.push(b); } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md index dc440be7e6..72c5198e5c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md @@ -71,32 +71,32 @@ function foo( ## Code ```javascript -function foo$0(x$6, y$7, z$8) { +function foo(x, y, z) { const $ = React.useMemoCache(); - const items$9 = [z$8]; - items$9.push(x$6); - const c_0 = $[0] !== x$6; - const c_1 = $[1] !== y$7; - let items2$10; + const items = [z]; + items.push(x); + const c_0 = $[0] !== x; + const c_1 = $[1] !== y; + let items2; if (c_0 || c_1) { - items2$10 = []; + items2 = []; - if (x$6) { - items2$10.push(y$7); + if (x) { + items2.push(y); } - $[0] = x$6; - $[1] = y$7; - $[2] = items2$10; + $[0] = x; + $[1] = y; + $[2] = items2; } else { - items2$10 = $[2]; + items2 = $[2]; } - if (y$7) { - items$9.push(x$6); + if (y) { + items.push(x); } - return items2$10; + return items2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md index 88247e997b..c38ef51abe 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md @@ -77,18 +77,18 @@ function foo( ## Code ```javascript -function foo$0(a$7, b$8, c$9) { - const x$10 = []; - if (a$7) { - if (b$8) { - if (c$9) { - x$10.push(0); +function foo(a, b, c) { + const x = []; + if (a) { + if (b) { + if (c) { + x.push(0); } } } - if (a$7.length) { - return a$7; + if (a.length) { + return a; } return null; diff --git a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md index 59c100efcd..55e112ab7f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/frozen-after-alias.expect.md @@ -44,19 +44,19 @@ function Component( ## Code ```javascript -function Component$0() { +function Component() { const $ = React.useMemoCache(); - let a$5; + let a; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$5 = []; - $[0] = a$5; + a = []; + $[0] = a; } else { - a$5 = $[0]; + a = $[0]; } - const b$6 = a$5; - useFreeze$3(a$5); - foo$4(b$6); + const b = a; + useFreeze(a); + foo(b); } ``` @@ -80,7 +80,7 @@ function useFreeze( ## Code ```javascript -function useFreeze$0() {} +function useFreeze() {} ``` ## HIR @@ -104,7 +104,7 @@ function foo( ## Code ```javascript -function foo$0(x$2) {} +function foo(x) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md index d47421d761..095ccfdf63 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hook-call.expect.md @@ -39,7 +39,7 @@ function useFreeze( ## Code ```javascript -function useFreeze$0() {} +function useFreeze() {} ``` ## HIR @@ -62,7 +62,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -106,47 +106,47 @@ function Component( ## Code ```javascript -function Component$0(props$10) { +function Component(props) { const $ = React.useMemoCache(); - let x$11; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$11 = []; - $[0] = x$11; + x = []; + $[0] = x; } else { - x$11 = $[0]; + x = $[0]; } - const c_1 = $[1] !== x$11; - let y$12; + const c_1 = $[1] !== x; + let y; if (c_1) { - y$12 = useFreeze$3(x$11); - $[1] = x$11; - $[2] = y$12; + y = useFreeze(x); + $[1] = x; + $[2] = y; } else { - y$12 = $[2]; + y = $[2]; } - foo$5(y$12, x$11); - const c_3 = $[3] !== x$11; - const c_4 = $[4] !== y$12; - let t5$16; + foo(y, x); + const c_3 = $[3] !== x; + const c_4 = $[4] !== y; + let t5; if (c_3 || c_4) { - t5$16 = ( - - {x$11} - {y$12} - + t5 = ( + + {x} + {y} + ); - $[3] = x$11; - $[4] = y$12; - $[5] = t5$16; + $[3] = x; + $[4] = y; + $[5] = t5; } else { - t5$16 = $[5]; + t5 = $[5]; } - return t5$16; + return t5; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md index e19cf748f1..6965ec423d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-arguments.expect.md @@ -45,20 +45,20 @@ function Component( ## Code ```javascript -function Component$0() { +function Component() { const $ = React.useMemoCache(); - let a$4; + let a; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$4 = []; - $[0] = a$4; + a = []; + $[0] = a; } else { - a$4 = $[0]; + a = $[0]; } - useFreeze$2(a$4); - useFreeze$2(a$4); - call$3(a$4); - return a$4; + useFreeze(a); + useFreeze(a); + call(a); + return a; } ``` @@ -83,7 +83,7 @@ function useFreeze( ## Code ```javascript -function useFreeze$0(x$2) {} +function useFreeze(x) {} ``` ## HIR @@ -107,7 +107,7 @@ function call( ## Code ```javascript -function call$0(x$2) {} +function call(x) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md index b0093d2ba7..5acaf748ef 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/hooks-freeze-possibly-mutable-arguments.expect.md @@ -29,24 +29,24 @@ bb0: [1] Const mutate cond$8 = read props$7.cond [2] Const mutate x$9 = read props$7.x [3] Const mutate a$10:TPrimitive = undefined - [4] Let mutate a$14_@0[4:9] = undefined + [4] Let mutate a$0$14_@0[4:9] = undefined [4] If (read cond$8) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Const mutate a$11 = read x$9 - [6] Reassign mutate a$14_@0[4:9] = read a$11 + [5] Const mutate a$1$11 = read x$9 + [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11 [6] Goto bb1 bb3: predecessor blocks: bb0 - [7] Const mutate a$12_@1 = Array [] - [8] Reassign mutate a$14_@0[4:9] = read a$12_@1 + [7] Const mutate a$2$12_@1 = Array [] + [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1 [8] Goto bb1 bb1: predecessor blocks: bb2 bb3 - [9] Call read useFreeze$5:TFunction(freeze a$14_@0) - [10] Call read useFreeze$5:TFunction(read a$14_@0) - [11] Call mutate call$6:TFunction(read a$14_@0) - [12] Return read a$14_@0 + [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0) + [10] Call read useFreeze$5:TFunction(read a$0$14_@0) + [11] Call mutate call$6:TFunction(read a$0$14_@0) + [12] Return read a$0$14_@0 ``` ## Reactive Scopes @@ -58,22 +58,22 @@ function Component( [1] Const mutate cond$8 = read props$7.cond [2] Const mutate x$9 = read props$7.x [3] Const mutate a$10:TPrimitive = undefined - scope @0 [4:9] deps=[read cond$8, read x$9] out=[a$14_@0] { - [4] Let mutate a$14_@0[4:9] = undefined + scope @0 [4:9] deps=[read cond$8, read x$9] out=[a$0$14_@0] { + [4] Let mutate a$0$14_@0[4:9] = undefined if (read cond$8) { - [5] Const mutate a$11 = read x$9 - [6] Reassign mutate a$14_@0[4:9] = read a$11 + [5] Const mutate a$1$11 = read x$9 + [6] Reassign mutate a$0$14_@0[4:9] = read a$1$11 } else { - scope @1 [7:8] deps=[] out=[a$12_@1] { - [7] Const mutate a$12_@1 = Array [] + scope @1 [7:8] deps=[] out=[a$2$12_@1] { + [7] Const mutate a$2$12_@1 = Array [] } - [8] Reassign mutate a$14_@0[4:9] = read a$12_@1 + [8] Reassign mutate a$0$14_@0[4:9] = read a$2$12_@1 } } - [9] Call read useFreeze$5:TFunction(freeze a$14_@0) - [10] Call read useFreeze$5:TFunction(read a$14_@0) - [11] Call mutate call$6:TFunction(read a$14_@0) - return read a$14_@0 + [9] Call read useFreeze$5:TFunction(freeze a$0$14_@0) + [10] Call read useFreeze$5:TFunction(read a$0$14_@0) + [11] Call mutate call$6:TFunction(read a$0$14_@0) + return read a$0$14_@0 } ``` @@ -81,44 +81,44 @@ function Component( ## Code ```javascript -function Component$0(props$7) { +function Component(props) { const $ = React.useMemoCache(); - const cond$8 = props$7.cond; - const x$9 = props$7.x; - const a$10 = undefined; - const c_0 = $[0] !== cond$8; - const c_1 = $[1] !== x$9; - let a$14; + const cond = props.cond; + const x = props.x; + const a = undefined; + const c_0 = $[0] !== cond; + const c_1 = $[1] !== x; + let a$0; if (c_0 || c_1) { - a$14 = undefined; + a$0 = undefined; - if (cond$8) { - const a$11 = x$9; - a$14 = a$11; + if (cond) { + const a$1 = x; + a$0 = a$1; } else { - let a$12; + let a$2; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - a$12 = []; - $[3] = a$12; + a$2 = []; + $[3] = a$2; } else { - a$12 = $[3]; + a$2 = $[3]; } - a$14 = a$12; + a$0 = a$2; } - $[0] = cond$8; - $[1] = x$9; - $[2] = a$14; + $[0] = cond; + $[1] = x; + $[2] = a$0; } else { - a$14 = $[2]; + a$0 = $[2]; } - useFreeze$5(a$14); - useFreeze$5(a$14); - call$6(a$14); - return a$14; + useFreeze(a$0); + useFreeze(a$0); + call(a$0); + return a$0; } ``` @@ -143,7 +143,7 @@ function useFreeze( ## Code ```javascript -function useFreeze$0(x$2) {} +function useFreeze(x) {} ``` ## HIR @@ -167,7 +167,7 @@ function call( ## Code ```javascript -function call$0(x$2) {} +function call(x) {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md index d9b5bd443c..5a9f3abe0b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent-across-if.expect.md @@ -53,7 +53,7 @@ function compute( ## Code ```javascript -function compute$0() {} +function compute() {} ``` ## HIR @@ -76,7 +76,7 @@ function mutate( ## Code ```javascript -function mutate$0() {} +function mutate() {} ``` ## HIR @@ -99,7 +99,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -122,7 +122,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` ## HIR @@ -168,43 +168,43 @@ function Component( ## Code ```javascript -function Component$0(props$8) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$8.a; - const c_1 = $[1] !== props$8.b; - const c_2 = $[2] !== props$8.c; - let a$9; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.c; + let a; if (c_0 || c_1 || c_2) { - a$9 = compute$2(props$8.a); - const b$10 = compute$2(props$8.b); + a = compute(props.a); + const b = compute(props.b); - if (props$8.c) { - mutate$5(a$9); - mutate$5(b$10); + if (props.c) { + mutate(a); + mutate(b); } - $[0] = props$8.a; - $[1] = props$8.b; - $[2] = props$8.c; - $[3] = a$9; + $[0] = props.a; + $[1] = props.b; + $[2] = props.c; + $[3] = a; } else { - a$9 = $[3]; + a = $[3]; } - const c_4 = $[4] !== a$9; - const c_5 = $[5] !== b$10; - let t6$14; + const c_4 = $[4] !== a; + const c_5 = $[5] !== b; + let t6; if (c_4 || c_5) { - t6$14 = ; - $[4] = a$9; - $[5] = b$10; - $[6] = t6$14; + t6 = ; + $[4] = a; + $[5] = b; + $[6] = t6; } else { - t6$14 = $[6]; + t6 = $[6]; } - return t6$14; + return t6; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md index 0b5a7088ce..79d2c04984 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independent.expect.md @@ -57,43 +57,43 @@ function Component( ## Code ```javascript -function Component$0(props$7) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$7.a; - let a$8; + const c_0 = $[0] !== props.a; + let a; if (c_0) { - a$8 = compute$2(props$7.a); - $[0] = props$7.a; - $[1] = a$8; + a = compute(props.a); + $[0] = props.a; + $[1] = a; } else { - a$8 = $[1]; + a = $[1]; } - const c_2 = $[2] !== props$7.b; - let b$9; + const c_2 = $[2] !== props.b; + let b; if (c_2) { - b$9 = compute$2(props$7.b); - $[2] = props$7.b; - $[3] = b$9; + b = compute(props.b); + $[2] = props.b; + $[3] = b; } else { - b$9 = $[3]; + b = $[3]; } - const c_4 = $[4] !== a$8; - const c_5 = $[5] !== b$9; - let t6$10; + const c_4 = $[4] !== a; + const c_5 = $[5] !== b; + let t6; if (c_4 || c_5) { - t6$10 = ; - $[4] = a$8; - $[5] = b$9; - $[6] = t6$10; + t6 = ; + $[4] = a; + $[5] = b; + $[6] = t6; } else { - t6$10 = $[6]; + t6 = $[6]; } - return t6$10; + return t6; } ``` @@ -117,7 +117,7 @@ function compute( ## Code ```javascript -function compute$0() {} +function compute() {} ``` ## HIR @@ -140,7 +140,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -163,7 +163,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md index 16edfe5dcc..8fbf3c8d5d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/independently-memoize-object-property.expect.md @@ -45,39 +45,39 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7, c$8) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$6; - const c_1 = $[1] !== b$7; - const c_2 = $[2] !== c$8; - let x$9; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + let x; if (c_0 || c_1 || c_2) { - x$9 = { - a: a$6, + x = { + a: a, }; - const c_4 = $[4] !== b$7; - const c_5 = $[5] !== c$8; - let t6$10; + const c_4 = $[4] !== b; + const c_5 = $[5] !== c; + let t6; if (c_4 || c_5) { - t6$10 = [b$7, c$8]; - $[4] = b$7; - $[5] = c$8; - $[6] = t6$10; + t6 = [b, c]; + $[4] = b; + $[5] = c; + $[6] = t6; } else { - t6$10 = $[6]; + t6 = $[6]; } - x$9.y = t6$10; - $[0] = a$6; - $[1] = b$7; - $[2] = c$8; - $[3] = x$9; + x.y = t6; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = x; } else { - x$9 = $[3]; + x = $[3]; } - return x$9; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md index 4013924b82..e88775a717 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent-across-if.expect.md @@ -47,7 +47,7 @@ function compute( ## Code ```javascript -function compute$0() {} +function compute() {} ``` ## HIR @@ -70,7 +70,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -93,7 +93,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` ## HIR @@ -137,45 +137,45 @@ function Component( ## Code ```javascript -function Component$0(props$8) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$8.a; - const c_1 = $[1] !== props$8.b; - const c_2 = $[2] !== props$8.c; - let a$9; - let b$10; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + const c_2 = $[2] !== props.c; + let a; + let b; if (c_0 || c_1 || c_2) { - a$9 = compute$2(props$8.a); - b$10 = compute$2(props$8.b); + a = compute(props.a); + b = compute(props.b); - if (props$8.c) { - foo$5(a$9, b$10); + if (props.c) { + foo(a, b); } - $[0] = props$8.a; - $[1] = props$8.b; - $[2] = props$8.c; - $[3] = a$9; - $[4] = b$10; + $[0] = props.a; + $[1] = props.b; + $[2] = props.c; + $[3] = a; + $[4] = b; } else { - a$9 = $[3]; - b$10 = $[4]; + a = $[3]; + b = $[4]; } - const c_5 = $[5] !== a$9; - const c_6 = $[6] !== b$10; - let t7$14; + const c_5 = $[5] !== a; + const c_6 = $[6] !== b; + let t7; if (c_5 || c_6) { - t7$14 = ; - $[5] = a$9; - $[6] = b$10; - $[7] = t7$14; + t7 = ; + $[5] = a; + $[6] = b; + $[7] = t7; } else { - t7$14 = $[7]; + t7 = $[7]; } - return t7$14; + return t7; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md index cb7f26ce3e..1fb0c418f9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/interdependent.expect.md @@ -57,39 +57,39 @@ function Component( ## Code ```javascript -function Component$0(props$8) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$8.a; - const c_1 = $[1] !== props$8.b; - let a$9; - let b$10; + const c_0 = $[0] !== props.a; + const c_1 = $[1] !== props.b; + let a; + let b; if (c_0 || c_1) { - a$9 = compute$2(props$8.a); - b$10 = compute$2(props$8.b); - foo$5(a$9, b$10); - $[0] = props$8.a; - $[1] = props$8.b; - $[2] = a$9; - $[3] = b$10; + a = compute(props.a); + b = compute(props.b); + foo(a, b); + $[0] = props.a; + $[1] = props.b; + $[2] = a; + $[3] = b; } else { - a$9 = $[2]; - b$10 = $[3]; + a = $[2]; + b = $[3]; } - const c_4 = $[4] !== a$9; - const c_5 = $[5] !== b$10; - let t6$11; + const c_4 = $[4] !== a; + const c_5 = $[5] !== b; + let t6; if (c_4 || c_5) { - t6$11 = ; - $[4] = a$9; - $[5] = b$10; - $[6] = t6$11; + t6 = ; + $[4] = a; + $[5] = b; + $[6] = t6; } else { - t6$11 = $[6]; + t6 = $[6]; } - return t6$11; + return t6; } ``` @@ -113,7 +113,7 @@ function compute( ## Code ```javascript -function compute$0() {} +function compute() {} ``` ## HIR @@ -136,7 +136,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -159,7 +159,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md index 668911db0e..028b9b0be3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md @@ -54,11 +54,11 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6, c$7) { - const y$8 = []; - if (a$5) { - if (b$6) { - y$8.push(c$7); +function foo(a, b, c) { + const y = []; + if (a) { + if (b) { + y.push(c); } } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md index 3a11ccefdd..3fc9d52004 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/issue852.expect.md @@ -42,23 +42,23 @@ function Component( ## Code ```javascript -function Component$0(c$6) { +function Component(c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== c$6; - let x$7; + const c_0 = $[0] !== c; + let x; if (c_0) { - x$7 = { - c: c$6, + x = { + c: c, }; - mutate$3(x$7); - $[0] = c$6; - $[1] = x$7; + mutate(x); + $[0] = c; + $[1] = x; } else { - x$7 = $[1]; + x = $[1]; } - const a$8 = x$7; - const b$9 = a$8; + const a = x; + const b = a; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md index 39d7756bf0..960209fbd4 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/jsx-fragment.expect.md @@ -64,46 +64,46 @@ function Foo( ## Code ```javascript -function Foo$0(props$13) { +function Foo(props) { const $ = React.useMemoCache(); - let t0$20; + let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$20 = <>Text; - $[0] = t0$20; + t0 = <>Text; + $[0] = t0; } else { - t0$20 = $[0]; + t0 = $[0]; } - const c_1 = $[1] !== t0$20; - let t2$22; + const c_1 = $[1] !== t0; + let t2; if (c_1) { - t2$22 =
{t0$20}
; - $[1] = t0$20; - $[2] = t2$22; + t2 =
{t0}
; + $[1] = t0; + $[2] = t2; } else { - t2$22 = $[2]; + t2 = $[2]; } - const c_3 = $[3] !== props$13.greeting; - const c_4 = $[4] !== t2$22; - let t5$24; + const c_3 = $[3] !== props.greeting; + const c_4 = $[4] !== t2; + let t5; if (c_3 || c_4) { - t5$24 = ( + t5 = ( <> - Hello {props$13.greeting} - {t2$22} + Hello {props.greeting} + {t2} ); - $[3] = props$13.greeting; - $[4] = t2$22; - $[5] = t5$24; + $[3] = props.greeting; + $[4] = t2; + $[5] = t5; } else { - t5$24 = $[5]; + t5 = $[5]; } - return t5$24; + return t5; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md index 48e2cee21b..d8cc5cf75d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md @@ -69,44 +69,44 @@ function And( ## Code ```javascript -function And$0() { +function And() { const $ = React.useMemoCache(); - let t0$5; + let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$5 = f$1(); - $[0] = t0$5; + t0 = f(); + $[0] = t0; } else { - t0$5 = $[0]; + t0 = $[0]; } - const c_1 = $[1] !== t0$5; - let t2$8; + const c_1 = $[1] !== t0; + let t2; if (c_1) { - t2$8 = undefined; + t2 = undefined; - if (t0$5) { - let t3$6; + if (t0) { + let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - t3$6 = g$4(); - $[3] = t3$6; + t3 = g(); + $[3] = t3; } else { - t3$6 = $[3]; + t3 = $[3]; } - t2$8 = t3$6; + t2 = t3; } else { - t2$8 = t0$5; + t2 = t0; } - $[1] = t0$5; - $[2] = t2$8; + $[1] = t0; + $[2] = t2; } else { - t2$8 = $[2]; + t2 = $[2]; } - return t2$8; + return t2; } ``` @@ -160,44 +160,44 @@ function Or( ## Code ```javascript -function Or$0() { +function Or() { const $ = React.useMemoCache(); - let t0$5; + let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$5 = f$1(); - $[0] = t0$5; + t0 = f(); + $[0] = t0; } else { - t0$5 = $[0]; + t0 = $[0]; } - const c_1 = $[1] !== t0$5; - let t2$8; + const c_1 = $[1] !== t0; + let t2; if (c_1) { - t2$8 = undefined; + t2 = undefined; - if (t0$5) { - t2$8 = t0$5; + if (t0) { + t2 = t0; } else { - let t3$7; + let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - t3$7 = g$4(); - $[3] = t3$7; + t3 = g(); + $[3] = t3; } else { - t3$7 = $[3]; + t3 = $[3]; } - t2$8 = t3$7; + t2 = t3; } - $[1] = t0$5; - $[2] = t2$8; + $[1] = t0; + $[2] = t2; } else { - t2$8 = $[2]; + t2 = $[2]; } - return t2$8; + return t2; } ``` @@ -256,44 +256,44 @@ function QuestionQuestion( ## Code ```javascript -function QuestionQuestion$0(props$8) { +function QuestionQuestion(props) { const $ = React.useMemoCache(); - let t0$9; + let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$9 = f$2(); - $[0] = t0$9; + t0 = f(); + $[0] = t0; } else { - t0$9 = $[0]; + t0 = $[0]; } - const c_1 = $[1] !== t0$9; - let t2$14; + const c_1 = $[1] !== t0; + let t2; if (c_1) { - t2$14 = undefined; + t2 = undefined; - if (t0$9 != null) { - t2$14 = t0$9; + if (t0 != null) { + t2 = t0; } else { - let t3$13; + let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - t3$13 = g$7(); - $[3] = t3$13; + t3 = g(); + $[3] = t3; } else { - t3$13 = $[3]; + t3 = $[3]; } - t2$14 = t3$13; + t2 = t3; } - $[1] = t0$9; - $[2] = t2$14; + $[1] = t0; + $[2] = t2; } else { - t2$14 = $[2]; + t2 = $[2]; } - return t2$14; + return t2; } ``` @@ -317,7 +317,7 @@ function f( ## Code ```javascript -function f$0() {} +function f() {} ``` ## HIR @@ -340,7 +340,7 @@ function g( ## Code ```javascript -function g$0() {} +function g() {} ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md index aa50d69ab5..0b815fd0fa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md @@ -61,7 +61,7 @@ function mutate( ## Code ```javascript -function mutate$0(x$3, y$4) {} +function mutate(x, y) {} ``` ## HIR @@ -85,7 +85,7 @@ function cond( ## Code ```javascript -function cond$0(x$2) {} +function cond(x) {} ``` ## HIR @@ -96,10 +96,10 @@ bb0: [2] Let mutate b$14_@0:TObject[1:23] = Object { } [3] Let mutate c$15_@0:TObject[1:23] = Object { } [4] Let mutate d$16_@0:TObject[1:23] = Object { } - [5] Let mutate a$30_@0[1:23] = read a$13_@0:TObject - [5] Let mutate b$31_@0[1:23] = read b$14_@0:TObject - [5] Let mutate c$32_@0[1:23] = read c$15_@0:TObject - [5] Let mutate d$33_@0[1:23] = read d$16_@0:TObject + [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject + [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject + [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject + [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject [5] While test=bb1 loop=bb3 fallthrough=bb2 bb1: predecessor blocks: bb0 bb4 @@ -114,30 +114,30 @@ bb3: [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0 [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject) [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject) - [15] Reassign mutate a$30_@0[1:23] = read a$13_@0:TObject - [15] Reassign mutate b$31_@0[1:23] = read b$14_@0:TObject - [15] Reassign mutate c$32_@0[1:23] = read c$15_@0:TObject - [15] Reassign mutate d$33_@0[1:23] = read d$16_@0:TObject + [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject + [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject + [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject + [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject [15] If (read $29_@0) then:bb2 else:bb4 fallthrough=bb4 bb4: predecessor blocks: bb3 [16] Goto(Continue) bb1 bb2: predecessor blocks: bb3 bb1 - [17] If (read a$30_@0) then:bb7 else:bb7 fallthrough=bb7 + [17] If (read a$0$30_@0) then:bb7 else:bb7 fallthrough=bb7 bb7: predecessor blocks: bb2 - [18] If (read b$31_@0) then:bb9 else:bb9 fallthrough=bb9 + [18] If (read b$1$31_@0) then:bb9 else:bb9 fallthrough=bb9 bb9: predecessor blocks: bb7 - [19] If (read c$32_@0) then:bb11 else:bb11 fallthrough=bb11 + [19] If (read c$2$32_@0) then:bb11 else:bb11 fallthrough=bb11 bb11: predecessor blocks: bb9 - [20] If (read d$33_@0) then:bb13 else:bb13 fallthrough=bb13 + [20] If (read d$3$33_@0) then:bb13 else:bb13 fallthrough=bb13 bb13: predecessor blocks: bb11 [21] Const mutate $34:TPrimitive = null - [22] Call mutate mutate$7:TFunction(mutate d$33_@0, read $34:TPrimitive) + [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive) [23] Return ``` @@ -151,10 +151,10 @@ function Component( [2] Let mutate b$14_@0:TObject[1:23] = Object { } [3] Let mutate c$15_@0:TObject[1:23] = Object { } [4] Let mutate d$16_@0:TObject[1:23] = Object { } - [5] Let mutate a$30_@0[1:23] = read a$13_@0:TObject - [5] Let mutate b$31_@0[1:23] = read b$14_@0:TObject - [5] Let mutate c$32_@0[1:23] = read c$15_@0:TObject - [5] Let mutate d$33_@0[1:23] = read d$16_@0:TObject + [5] Let mutate a$0$30_@0[1:23] = read a$13_@0:TObject + [5] Let mutate b$1$31_@0[1:23] = read b$14_@0:TObject + [5] Let mutate c$2$32_@0[1:23] = read c$15_@0:TObject + [5] Let mutate d$3$33_@0[1:23] = read d$16_@0:TObject while ( [6] Const mutate $17:TPrimitive = true read $17:TPrimitive @@ -166,24 +166,24 @@ function Component( [12] Reassign mutate d$16_@0:TObject[1:23] = read z$19_@0 [13] Call mutate mutate$7:TFunction(mutate a$13_@0:TObject, mutate b$14_@0:TObject) [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$13_@0:TObject) - [15] Reassign mutate a$30_@0[1:23] = read a$13_@0:TObject - [15] Reassign mutate b$31_@0[1:23] = read b$14_@0:TObject - [15] Reassign mutate c$32_@0[1:23] = read c$15_@0:TObject - [15] Reassign mutate d$33_@0[1:23] = read d$16_@0:TObject + [15] Reassign mutate a$0$30_@0[1:23] = read a$13_@0:TObject + [15] Reassign mutate b$1$31_@0[1:23] = read b$14_@0:TObject + [15] Reassign mutate c$2$32_@0[1:23] = read c$15_@0:TObject + [15] Reassign mutate d$3$33_@0[1:23] = read d$16_@0:TObject if (read $29_@0) { break } } - if (read a$30_@0) { + if (read a$0$30_@0) { } - if (read b$31_@0) { + if (read b$1$31_@0) { } - if (read c$32_@0) { + if (read c$2$32_@0) { } - if (read d$33_@0) { + if (read d$3$33_@0) { } [21] Const mutate $34:TPrimitive = null - [22] Call mutate mutate$7:TFunction(mutate d$33_@0, read $34:TPrimitive) + [22] Call mutate mutate$7:TFunction(mutate d$3$33_@0, read $34:TPrimitive) return } @@ -192,45 +192,45 @@ function Component( ## Code ```javascript -function Component$0(props$12) { - let a$13 = {}; - let b$14 = {}; - let c$15 = {}; - let d$16 = {}; - let a$30 = a$13; - let b$31 = b$14; - let c$32 = c$15; - let d$33 = d$16; +function Component(props) { + let a = {}; + let b = {}; + let c = {}; + let d = {}; + let a$0 = a; + let b$1 = b; + let c$2 = c; + let d$3 = d; while (true) { - const z$19 = a$13; - a$13 = b$14; - b$14 = c$15; - c$15 = d$16; - d$16 = z$19; - mutate$7(a$13, b$14); - a$30 = a$13; - b$31 = b$14; - c$32 = c$15; - d$33 = d$16; + const z = a; + a = b; + b = c; + c = d; + d = z; + mutate(a, b); + a$0 = a; + b$1 = b; + c$2 = c; + d$3 = d; - if (cond$8(a$13)) { + if (cond(a)) { break; } } - if (a$30) { + if (a$0) { } - if (b$31) { + if (b$1) { } - if (c$32) { + if (c$2) { } - if (d$33) { + if (d$3) { } - mutate$7(d$33, null); + mutate(d$3, null); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md index 6227fc14be..965d1fe686 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-with-aliasing.expect.md @@ -57,7 +57,7 @@ function mutate( ## Code ```javascript -function mutate$0(x$3, y$4) {} +function mutate(x, y) {} ``` ## HIR @@ -128,49 +128,49 @@ function Component( ## Code ```javascript -function Component$0(props$10) { +function Component(props) { const $ = React.useMemoCache(); - let a$11; + let a; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$11 = {}; - $[0] = a$11; + a = {}; + $[0] = a; } else { - a$11 = $[0]; + a = $[0]; } - const b$12 = [a$11]; - let c$13; + const b = [a]; + let c; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - c$13 = {}; - $[1] = c$13; + c = {}; + $[1] = c; } else { - c$13 = $[1]; + c = $[1]; } - const d$14 = { - c: c$13, + const d = { + c: c, }; - const x$15 = {}; - x$15.b = b$12; - const y$16 = mutate$7(x$15, d$14); + const x = {}; + x.b = b; + const y = mutate(x, d); - if (a$11) { + if (a) { } - if (b$12) { + if (b) { } - if (c$13) { + if (c) { } - if (d$14) { + if (d) { } - if (y$16) { + if (y) { } - mutate$7(x$15, null); + mutate(x, null); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md index 5a5f15346c..b95ca4cd22 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-liverange-loop.expect.md @@ -54,7 +54,7 @@ function mutate( ## Code ```javascript -function mutate$0() {} +function mutate() {} ``` ## HIR @@ -77,7 +77,7 @@ function cond( ## Code ```javascript -function cond$0() {} +function cond() {} ``` ## HIR @@ -160,41 +160,41 @@ function Component( ## Code ```javascript -function Component$0(props$11) { +function Component(props) { const $ = React.useMemoCache(); - const a$12 = {}; - const b$13 = {}; - let c$14; + const a = {}; + const b = {}; + let c; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - c$14 = {}; - $[0] = c$14; + c = {}; + $[0] = c; } else { - c$14 = $[0]; + c = $[0]; } - const d$15 = {}; + const d = {}; while (true) { - mutate$6(a$12, b$13); + mutate(a, b); - if (cond$7(a$12)) { + if (cond(a)) { break; } } - if (a$12) { + if (a) { } - if (b$13) { + if (b) { } - if (c$14) { + if (c) { } - if (d$15) { + if (d) { } - mutate$6(d$15, null); + mutate(d, null); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md index 17c229a6ad..793c59f9f9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md @@ -51,14 +51,14 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7, c$8) { - const x$9 = []; - const y$10 = []; - if (x$9) { +function foo(a, b, c) { + const x = []; + const y = []; + if (x) { } - y$10.push(a$6); - x$9.push(b$7); + y.push(a); + x.push(b); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md index 5d7e91787f..ebf6f52890 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md @@ -41,11 +41,11 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6) { - const x$7 = []; - const y$8 = []; - x$7.push(a$5); - y$8.push(b$6); +function foo(a, b) { + const x = []; + const y = []; + x.push(a); + y.push(b); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md index e81d70c5ed..8202126f02 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md @@ -41,11 +41,11 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6) { - const x$7 = []; - const y$8 = []; - y$8.push(b$6); - x$7.push(a$5); +function foo(a, b) { + const x = []; + const y = []; + y.push(b); + x.push(a); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md index 55326469ea..ec18e3e0f8 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md @@ -74,57 +74,57 @@ function foo( ## Code ```javascript -function foo$0(a$8, b$9, c$10) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$8; - const c_1 = $[1] !== b$9; - const c_2 = $[2] !== c$10; - let x$11; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + let x; if (c_0 || c_1 || c_2) { - x$11 = []; + x = []; - if (a$8) { - const c_4 = $[4] !== b$9; - const c_5 = $[5] !== c$10; - let y$12; + if (a) { + const c_4 = $[4] !== b; + const c_5 = $[5] !== c; + let y; if (c_4 || c_5) { - y$12 = []; + y = []; - if (b$9) { - y$12.push(c$10); + if (b) { + y.push(c); } - $[4] = b$9; - $[5] = c$10; - $[6] = y$12; + $[4] = b; + $[5] = c; + $[6] = y; } else { - y$12 = $[6]; + y = $[6]; } - const c_7 = $[7] !== y$12; - let t8$15; + const c_7 = $[7] !== y; + let t8; if (c_7) { - t8$15 =
{y$12}
; - $[7] = y$12; - $[8] = t8$15; + t8 =
{y}
; + $[7] = y; + $[8] = t8; } else { - t8$15 = $[8]; + t8 = $[8]; } - x$11.push(t8$15); + x.push(t8); } - $[0] = a$8; - $[1] = b$9; - $[2] = c$10; - $[3] = x$11; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = x; } else { - x$11 = $[3]; + x = $[3]; } - return x$11; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md index d69d9df00c..858af61ab3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md @@ -57,12 +57,12 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7, c$8) { - const x$9 = []; - const y$10 = []; - while (c$8) { - y$10.push(b$7); - x$9.push(a$6); +function foo(a, b, c) { + const x = []; + const y = []; + while (c) { + y.push(b); + x.push(a); } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md index 2fe44aa306..ef76736c90 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md @@ -66,34 +66,34 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7, c$8) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$6; - const c_1 = $[1] !== b$7; - const c_2 = $[2] !== c$8; - let x$9; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + let x; if (c_0 || c_1 || c_2) { - x$9 = []; + x = []; - if (a$6) { - const y$10 = []; + if (a) { + const y = []; - if (b$7) { - y$10.push(c$8); + if (b) { + y.push(c); } - x$9.push(y$10); + x.push(y); } - $[0] = a$6; - $[1] = b$7; - $[2] = c$8; - $[3] = x$9; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = x; } else { - x$9 = $[3]; + x = $[3]; } - return x$9; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md index 0f844de5dc..60e9fd1b74 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/property-assignment.expect.md @@ -50,39 +50,39 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$6.p0; - let x$7; - let child$9; + const c_0 = $[0] !== props.p0; + let x; + let child; if (c_0) { - x$7 = {}; - const y$8 = []; - x$7.y = y$8; - child$9 = ; - x$7.y.push(props$6.p0); - $[0] = props$6.p0; - $[1] = x$7; - $[2] = child$9; + x = {}; + const y = []; + x.y = y; + child = ; + x.y.push(props.p0); + $[0] = props.p0; + $[1] = x; + $[2] = child; } else { - x$7 = $[1]; - child$9 = $[2]; + x = $[1]; + child = $[2]; } - const c_3 = $[3] !== x$7; - const c_4 = $[4] !== child$9; - let t5$10; + const c_3 = $[3] !== x; + const c_4 = $[4] !== child; + let t5; if (c_3 || c_4) { - t5$10 = {child$9}; - $[3] = x$7; - $[4] = child$9; - $[5] = t5$10; + t5 = {child}; + $[3] = x; + $[4] = child; + $[5] = t5; } else { - t5$10 = $[5]; + t5 = $[5]; } - return t5$10; + return t5; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md index 67162e5f64..11359cfefa 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md @@ -48,29 +48,29 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$4; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$4 = {}; - let y$5; + x = {}; + let y; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - y$5 = []; - const z$6 = {}; - y$5.push(z$6); - $[1] = y$5; + y = []; + const z = {}; + y.push(z); + $[1] = y; } else { - y$5 = $[1]; + y = $[1]; } - x$4.y = y$5; - $[0] = x$4; + x.y = y; + $[0] = x; } else { - x$4 = $[0]; + x = $[0]; } - return x$4; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md index 527c8fc99f..21e3179cbb 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md @@ -71,53 +71,53 @@ function foo( ## Code ```javascript -function foo$0(a$8, b$9, c$10) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$8; - const c_1 = $[1] !== b$9; - const c_2 = $[2] !== c$10; - let x$11; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + let x; if (c_0 || c_1 || c_2) { - x$11 = []; + x = []; - if (a$8) { - const c_4 = $[4] !== b$9; - let y$12; + if (a) { + const c_4 = $[4] !== b; + let y; if (c_4) { - y$12 = []; - y$12.push(b$9); - $[4] = b$9; - $[5] = y$12; + y = []; + y.push(b); + $[4] = b; + $[5] = y; } else { - y$12 = $[5]; + y = $[5]; } - const c_6 = $[6] !== y$12; - let t7$14; + const c_6 = $[6] !== y; + let t7; if (c_6) { - t7$14 =
{y$12}
; - $[6] = y$12; - $[7] = t7$14; + t7 =
{y}
; + $[6] = y; + $[7] = t7; } else { - t7$14 = $[7]; + t7 = $[7]; } - x$11.push(t7$14); + x.push(t7); } else { - x$11.push(c$10); + x.push(c); } - $[0] = a$8; - $[1] = b$9; - $[2] = c$10; - $[3] = x$11; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = x; } else { - x$11 = $[3]; + x = $[3]; } - return x$11; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md index c08e0b62da..aacd0263ba 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md @@ -66,39 +66,39 @@ function f( ## Code ```javascript -function f$0(a$8, b$9) { +function f(a, b) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$8.length; - const c_1 = $[1] !== b$9; - let x$10; + const c_0 = $[0] !== a.length; + const c_1 = $[1] !== b; + let x; if (c_0 || c_1) { - x$10 = []; + x = []; - if (a$8.length === 1) { - if (b$9) { - x$10.push(b$9); + if (a.length === 1) { + if (b) { + x.push(b); } } - $[0] = a$8.length; - $[1] = b$9; - $[2] = x$10; + $[0] = a.length; + $[1] = b; + $[2] = x; } else { - x$10 = $[2]; + x = $[2]; } - const c_3 = $[3] !== x$10; - let t4$15; + const c_3 = $[3] !== x; + let t4; if (c_3) { - t4$15 =
{x$10}
; - $[3] = x$10; - $[4] = t4$15; + t4 =
{x}
; + $[3] = x; + $[4] = t4; } else { - t4$15 = $[4]; + t4 = $[4]; } - return t4$15; + return t4; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md index c9c17c41b0..079007660e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md @@ -26,18 +26,18 @@ bb0: [1] Const mutate x$7_@0[1:3] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) [3] Const mutate y$8 = read x$7_@0 - [4] Let mutate x$11_@1[1:7] = read x$7_@0 + [4] Let mutate x$0$11_@1[1:7] = read x$7_@0 [4] If (read props$6.p1) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Const mutate x$9_@2 = Array [] - [6] Reassign mutate x$11_@1[1:7] = read x$9_@2 + [5] Const mutate x$1$9_@2 = Array [] + [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2 [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Const mutate _$12_@3 = JSX + [7] Const mutate _$12_@3 = JSX [8] Call read y$8.push(read props$6.p2) - [9] Const mutate t7$15_@4 = JSX + [9] Const mutate t7$15_@4 = JSX [10] Return read t7$15_@4 ``` @@ -52,19 +52,19 @@ function Component( [2] Call mutate x$7_@0.push(read props$6.p0) } [3] Const mutate y$8 = read x$7_@0 - scope @1 [1:7] deps=[read props$6.p1] out=[x$11_@1] { - [4] Let mutate x$11_@1[1:7] = read x$7_@0 + scope @1 [1:7] deps=[read props$6.p1] out=[x$0$11_@1] { + [4] Let mutate x$0$11_@1[1:7] = read x$7_@0 if (read props$6.p1) { - scope @2 [5:6] deps=[] out=[x$9_@2] { - [5] Const mutate x$9_@2 = Array [] + scope @2 [5:6] deps=[] out=[x$1$9_@2] { + [5] Const mutate x$1$9_@2 = Array [] } - [6] Reassign mutate x$11_@1[1:7] = read x$9_@2 + [6] Reassign mutate x$0$11_@1[1:7] = read x$1$9_@2 } } - [7] Const mutate _$12_@3 = JSX + [7] Const mutate _$12_@3 = JSX [8] Call read y$8.push(read props$6.p2) - scope @4 [9:10] deps=[read x$11_@1, read y$8] out=[$15_@4] { - [9] Const mutate $15_@4 = JSX + scope @4 [9:10] deps=[read x$0$11_@1, read y$8] out=[$15_@4] { + [9] Const mutate $15_@4 = JSX } return read $15_@4 } @@ -74,62 +74,62 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$6.p0; - let x$7; + const c_0 = $[0] !== props.p0; + let x; if (c_0) { - x$7 = []; - x$7.push(props$6.p0); - $[0] = props$6.p0; - $[1] = x$7; + x = []; + x.push(props.p0); + $[0] = props.p0; + $[1] = x; } else { - x$7 = $[1]; + x = $[1]; } - const y$8 = x$7; - const c_2 = $[2] !== props$6.p1; - let x$11; + const y = x; + const c_2 = $[2] !== props.p1; + let x$0; if (c_2) { - x$11 = x$7; + x$0 = x; - if (props$6.p1) { - let x$9; + if (props.p1) { + let x$1; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { - x$9 = []; - $[4] = x$9; + x$1 = []; + $[4] = x$1; } else { - x$9 = $[4]; + x$1 = $[4]; } - x$11 = x$9; + x$0 = x$1; } - $[2] = props$6.p1; - $[3] = x$11; + $[2] = props.p1; + $[3] = x$0; } else { - x$11 = $[3]; + x$0 = $[3]; } - const _$12 = ; + const _ = ; - y$8.push(props$6.p2); - const c_5 = $[5] !== x$11; - const c_6 = $[6] !== y$8; - let t7$15; + y.push(props.p2); + const c_5 = $[5] !== x$0; + const c_6 = $[6] !== y; + let t7; if (c_5 || c_6) { - t7$15 = ; - $[5] = x$11; - $[6] = y$8; - $[7] = t7$15; + t7 = ; + $[5] = x$0; + $[6] = y; + $[7] = t7; } else { - t7$15 = $[7]; + t7 = $[7]; } - return t7$15; + return t7; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md index efd857524d..596040b3bb 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md @@ -45,22 +45,22 @@ bb1: [5] Const mutate $17:TPrimitive = "div" [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} [7] Const mutate $20:TPrimitive = 0 - [8] Let mutate x$30_@2[8:15] = undefined + [8] Let mutate x$0$30_@2[8:15] = undefined [8] Switch (read b$14) Case read $20:TPrimitive: bb5 Default: bb4 Fallthrough: bb3 bb5: predecessor blocks: bb1 - [9] Const mutate x$22_@3[9:11] = Array [] - [10] Call mutate x$22_@3.push(read b$14) - [11] Reassign mutate x$30_@2[8:15] = read x$22_@3 + [9] Const mutate x$1$22_@3[9:11] = Array [] + [10] Call mutate x$1$22_@3.push(read b$14) + [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3 [11] Goto bb3 bb4: predecessor blocks: bb1 - [12] Const mutate x$23_@4[12:14] = Array [] - [13] Call mutate x$23_@4.push(read c$15) - [14] Reassign mutate x$30_@2[8:15] = read x$23_@4 + [12] Const mutate x$2$23_@4[12:14] = Array [] + [13] Call mutate x$2$23_@4.push(read c$15) + [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4 [14] Goto bb3 bb3: predecessor blocks: bb5 bb4 @@ -68,7 +68,7 @@ bb3: [16] Const mutate $26:TPrimitive = "\n " [17] Const mutate $27:TPrimitive = "\n " [18] Const mutate $28:TPrimitive = "\n " - [19] Const mutate t13$31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$30_@2}{read $28:TPrimitive} + [19] Const mutate t13$31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive} [20] Return read t13$31_@5 ``` @@ -91,23 +91,23 @@ function foo( [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} } [7] Const mutate $20:TPrimitive = 0 - scope @2 [8:15] deps=[read b$14, read c$15] out=[x$30_@2] { - [8] Let mutate x$30_@2[8:15] = undefined + scope @2 [8:15] deps=[read b$14, read c$15] out=[x$0$30_@2] { + [8] Let mutate x$0$30_@2[8:15] = undefined switch (read b$14) { case read $20:TPrimitive: { - scope @3 [9:11] deps=[read b$14] out=[x$22_@3] { - [9] Const mutate x$22_@3[9:11] = Array [] - [10] Call mutate x$22_@3.push(read b$14) + scope @3 [9:11] deps=[read b$14] out=[x$1$22_@3] { + [9] Const mutate x$1$22_@3[9:11] = Array [] + [10] Call mutate x$1$22_@3.push(read b$14) } - [11] Reassign mutate x$30_@2[8:15] = read x$22_@3 + [11] Reassign mutate x$0$30_@2[8:15] = read x$1$22_@3 break bb3 } default: { - scope @4 [12:14] deps=[read c$15] out=[x$23_@4] { - [12] Const mutate x$23_@4[12:14] = Array [] - [13] Call mutate x$23_@4.push(read c$15) + scope @4 [12:14] deps=[read c$15] out=[x$2$23_@4] { + [12] Const mutate x$2$23_@4[12:14] = Array [] + [13] Call mutate x$2$23_@4.push(read c$15) } - [14] Reassign mutate x$30_@2[8:15] = read x$23_@4 + [14] Reassign mutate x$0$30_@2[8:15] = read x$2$23_@4 } } } @@ -115,8 +115,8 @@ function foo( [16] Const mutate $26:TPrimitive = "\n " [17] Const mutate $27:TPrimitive = "\n " [18] Const mutate $28:TPrimitive = "\n " - scope @5 [19:20] deps=[read y$19_@1, freeze x$30_@2] out=[$31_@5] { - [19] Const mutate $31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$30_@2}{read $28:TPrimitive} + scope @5 [19:20] deps=[read y$19_@1, freeze x$0$30_@2] out=[$31_@5] { + [19] Const mutate $31_@5 = JSX {read $26:TPrimitive}{read y$19_@1}{read $27:TPrimitive}{freeze x$0$30_@2}{read $28:TPrimitive} } return read $31_@5 } @@ -126,102 +126,102 @@ function foo( ## Code ```javascript -function foo$0(a$13, b$14, c$15) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$13; - let x$16; + const c_0 = $[0] !== a; + let x; if (c_0) { - x$16 = []; + x = []; - if (a$13) { - x$16.push(a$13); + if (a) { + x.push(a); } - $[0] = a$13; - $[1] = x$16; + $[0] = a; + $[1] = x; } else { - x$16 = $[1]; + x = $[1]; } - const c_2 = $[2] !== x$16; - let y$19; + const c_2 = $[2] !== x; + let y; if (c_2) { - y$19 =
{x$16}
; - $[2] = x$16; - $[3] = y$19; + y =
{x}
; + $[2] = x; + $[3] = y; } else { - y$19 = $[3]; + y = $[3]; } - const c_4 = $[4] !== b$14; - const c_5 = $[5] !== c$15; - let x$30; + const c_4 = $[4] !== b; + const c_5 = $[5] !== c; + let x$0; if (c_4 || c_5) { - x$30 = undefined; + x$0 = undefined; - bb3: switch (b$14) { + bb3: switch (b) { case 0: { - const c_7 = $[7] !== b$14; - let x$22; + const c_7 = $[7] !== b; + let x$1; if (c_7) { - x$22 = []; - x$22.push(b$14); - $[7] = b$14; - $[8] = x$22; + x$1 = []; + x$1.push(b); + $[7] = b; + $[8] = x$1; } else { - x$22 = $[8]; + x$1 = $[8]; } - x$30 = x$22; + x$0 = x$1; break bb3; } default: { - const c_9 = $[9] !== c$15; - let x$23; + const c_9 = $[9] !== c; + let x$2; if (c_9) { - x$23 = []; - x$23.push(c$15); - $[9] = c$15; - $[10] = x$23; + x$2 = []; + x$2.push(c); + $[9] = c; + $[10] = x$2; } else { - x$23 = $[10]; + x$2 = $[10]; } - x$30 = x$23; + x$0 = x$2; } } - $[4] = b$14; - $[5] = c$15; - $[6] = x$30; + $[4] = b; + $[5] = c; + $[6] = x$0; } else { - x$30 = $[6]; + x$0 = $[6]; } - const c_11 = $[11] !== y$19; - const c_12 = $[12] !== x$30; - let t13$31; + const c_11 = $[11] !== y; + const c_12 = $[12] !== x$0; + let t13; if (c_11 || c_12) { - t13$31 = ( + t13 = (
- {y$19} - {x$30} + {y} + {x$0}
); - $[11] = y$19; - $[12] = x$30; - $[13] = t13$31; + $[11] = y; + $[12] = x$0; + $[13] = t13; } else { - t13$31 = $[13]; + t13 = $[13]; } - return t13$31; + return t13; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md index d57c004ec9..4c23f0d107 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md @@ -24,10 +24,10 @@ bb0: [1] Const mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) [3] Const mutate y$8_@0[1:7] = read x$7_@0 - [4] Const mutate x$9_@1 = Array [] - [5] Const mutate _$10_@2 = JSX + [4] Const mutate x$0$9_@1 = Array [] + [5] Const mutate _$10_@2 = JSX [6] Call mutate y$8_@0.push(read props$6.p1) - [7] Const mutate t6$11_@3 = JSX + [7] Const mutate t6$11_@3 = JSX [8] Return read t6$11_@3 ``` @@ -41,14 +41,14 @@ function Component( [1] Const mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) [3] Const mutate y$8_@0[1:7] = read x$7_@0 - scope @1 [4:5] deps=[] out=[x$9_@1] { - [4] Const mutate x$9_@1 = Array [] + scope @1 [4:5] deps=[] out=[x$0$9_@1] { + [4] Const mutate x$0$9_@1 = Array [] } - [5] Const mutate _$10_@2 = JSX + [5] Const mutate _$10_@2 = JSX [6] Call mutate y$8_@0.push(read props$6.p1) } - scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0] out=[$11_@3] { - [7] Const mutate $11_@3 = JSX + scope @3 [7:8] deps=[read x$0$9_@1, freeze y$8_@0] out=[$11_@3] { + [7] Const mutate $11_@3 = JSX } return read $11_@3 } @@ -58,48 +58,48 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$6.p0; - const c_1 = $[1] !== props$6.p1; - let y$8; + const c_0 = $[0] !== props.p0; + const c_1 = $[1] !== props.p1; + let y; if (c_0 || c_1) { - const x$7 = []; - x$7.push(props$6.p0); - y$8 = x$7; - let x$9; + const x = []; + x.push(props.p0); + y = x; + let x$0; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - x$9 = []; - $[3] = x$9; + x$0 = []; + $[3] = x$0; } else { - x$9 = $[3]; + x$0 = $[3]; } - const _$10 = ; + const _ = ; - y$8.push(props$6.p1); - $[0] = props$6.p0; - $[1] = props$6.p1; - $[2] = y$8; + y.push(props.p1); + $[0] = props.p0; + $[1] = props.p1; + $[2] = y; } else { - y$8 = $[2]; + y = $[2]; } - const c_4 = $[4] !== x$9; - const c_5 = $[5] !== y$8; - let t6$11; + const c_4 = $[4] !== x$0; + const c_5 = $[5] !== y; + let t6; if (c_4 || c_5) { - t6$11 = ; - $[4] = x$9; - $[5] = y$8; - $[6] = t6$11; + t6 = ; + $[4] = x$0; + $[5] = y; + $[6] = t6; } else { - t6$11 = $[6]; + t6 = $[6]; } - return t6$11; + return t6; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md index 183ad86d07..0110dc6044 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reverse-postorder.expect.md @@ -37,7 +37,7 @@ function Component(props) { ``` bb0: [1] Const mutate x$7:TPrimitive = undefined - [2] Let mutate x$16_@0[2:18] = undefined + [2] Let mutate x$0$16_@0[2:18] = undefined [2] If (read props$6.cond) then:bb2 else:bb10 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -52,35 +52,35 @@ bb2: Fallthrough: bb1 bb8: predecessor blocks: bb2 - [7] Const mutate x$11 = read props$6.v0 - [8] Reassign mutate x$16_@0[2:18] = read x$11 + [7] Const mutate x$1$11 = read props$6.v0 + [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11 [8] Goto bb1 bb6: predecessor blocks: bb2 - [9] Const mutate x$12 = read props$6.v1 - [10] Reassign mutate x$16_@0[2:18] = read x$12 + [9] Const mutate x$2$12 = read props$6.v1 + [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12 [10] Goto bb1 bb4: predecessor blocks: bb2 - [11] Const mutate x$13 = read props$6.v2 - [12] Reassign mutate x$16_@0[2:18] = read x$13 + [11] Const mutate x$3$13 = read props$6.v2 + [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13 [12] Goto bb1 bb10: predecessor blocks: bb0 [13] If (read props$6.cond2) then:bb12 else:bb13 fallthrough=bb1 bb12: predecessor blocks: bb10 - [14] Const mutate x$14 = read props$6.b - [15] Reassign mutate x$16_@0[2:18] = read x$14 + [14] Const mutate x$4$14 = read props$6.b + [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14 [15] Goto bb1 bb13: predecessor blocks: bb10 - [16] Const mutate x$15 = read props$6.c - [17] Reassign mutate x$16_@0[2:18] = read x$15 + [16] Const mutate x$5$15 = read props$6.c + [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15 [17] Goto bb1 bb1: predecessor blocks: bb8 bb6 bb4 bb12 bb13 - [18] read x$16_@0 + [18] read x$0$16_@0 [19] Return ``` @@ -91,41 +91,41 @@ function Component( props, ) { [1] Const mutate x$7:TPrimitive = undefined - scope @0 [2:18] deps=[read props$6.cond, read props$6.test, read props$6.v0, read props$6.v1, read props$6.v2, read props$6.cond2, read props$6.b, read props$6.c] out=[x$16_@0] { - [2] Let mutate x$16_@0[2:18] = undefined + scope @0 [2:18] deps=[read props$6.cond, read props$6.test, read props$6.v0, read props$6.v1, read props$6.v2, read props$6.cond2, read props$6.b, read props$6.c] out=[x$0$16_@0] { + [2] Let mutate x$0$16_@0[2:18] = undefined if (read props$6.cond) { [3] Const mutate $8:TPrimitive = 2 [4] Const mutate $9:TPrimitive = 1 [5] Const mutate $10:TPrimitive = 0 switch (read props$6.test) { case read $10:TPrimitive: { - [7] Const mutate x$11 = read props$6.v0 - [8] Reassign mutate x$16_@0[2:18] = read x$11 + [7] Const mutate x$1$11 = read props$6.v0 + [8] Reassign mutate x$0$16_@0[2:18] = read x$1$11 break bb1 } case read $9:TPrimitive: { - [9] Const mutate x$12 = read props$6.v1 - [10] Reassign mutate x$16_@0[2:18] = read x$12 + [9] Const mutate x$2$12 = read props$6.v1 + [10] Reassign mutate x$0$16_@0[2:18] = read x$2$12 break bb1 } case read $8:TPrimitive: { } default: { - [11] Const mutate x$13 = read props$6.v2 - [12] Reassign mutate x$16_@0[2:18] = read x$13 + [11] Const mutate x$3$13 = read props$6.v2 + [12] Reassign mutate x$0$16_@0[2:18] = read x$3$13 } } } else { if (read props$6.cond2) { - [14] Const mutate x$14 = read props$6.b - [15] Reassign mutate x$16_@0[2:18] = read x$14 + [14] Const mutate x$4$14 = read props$6.b + [15] Reassign mutate x$0$16_@0[2:18] = read x$4$14 } else { - [16] Const mutate x$15 = read props$6.c - [17] Reassign mutate x$16_@0[2:18] = read x$15 + [16] Const mutate x$5$15 = read props$6.c + [17] Reassign mutate x$0$16_@0[2:18] = read x$5$15 } } } - [18] read x$16_@0 + [18] read x$0$16_@0 return } @@ -134,32 +134,32 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - const x$7 = undefined; - const c_0 = $[0] !== props$6.cond; - const c_1 = $[1] !== props$6.test; - const c_2 = $[2] !== props$6.v0; - const c_3 = $[3] !== props$6.v1; - const c_4 = $[4] !== props$6.v2; - const c_5 = $[5] !== props$6.cond2; - const c_6 = $[6] !== props$6.b; - const c_7 = $[7] !== props$6.c; - let x$16; + const x = undefined; + const c_0 = $[0] !== props.cond; + const c_1 = $[1] !== props.test; + const c_2 = $[2] !== props.v0; + const c_3 = $[3] !== props.v1; + const c_4 = $[4] !== props.v2; + const c_5 = $[5] !== props.cond2; + const c_6 = $[6] !== props.b; + const c_7 = $[7] !== props.c; + let x$0; if (c_0 || c_1 || c_2 || c_3 || c_4 || c_5 || c_6 || c_7) { - x$16 = undefined; + x$0 = undefined; - bb1: if (props$6.cond) { - switch (props$6.test) { + bb1: if (props.cond) { + switch (props.test) { case 0: { - const x$11 = props$6.v0; - x$16 = x$11; + const x$1 = props.v0; + x$0 = x$1; break bb1; } case 1: { - const x$12 = props$6.v1; - x$16 = x$12; + const x$2 = props.v1; + x$0 = x$2; break bb1; } @@ -167,34 +167,34 @@ function Component$0(props$6) { } default: { - const x$13 = props$6.v2; - x$16 = x$13; + const x$3 = props.v2; + x$0 = x$3; } } } else { - if (props$6.cond2) { - const x$14 = props$6.b; - x$16 = x$14; + if (props.cond2) { + const x$4 = props.b; + x$0 = x$4; } else { - const x$15 = props$6.c; - x$16 = x$15; + const x$5 = props.c; + x$0 = x$5; } } - $[0] = props$6.cond; - $[1] = props$6.test; - $[2] = props$6.v0; - $[3] = props$6.v1; - $[4] = props$6.v2; - $[5] = props$6.cond2; - $[6] = props$6.b; - $[7] = props$6.c; - $[8] = x$16; + $[0] = props.cond; + $[1] = props.test; + $[2] = props.v0; + $[3] = props.v1; + $[4] = props.v2; + $[5] = props.cond2; + $[6] = props.b; + $[7] = props.c; + $[8] = x$0; } else { - x$16 = $[8]; + x$0 = $[8]; } - x$16; + x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md index ed88bc2df3..004d2dafa9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/simple-alias.expect.md @@ -36,7 +36,7 @@ function mutate( ## Code ```javascript -function mutate$0() {} +function mutate() {} ``` ## HIR @@ -46,11 +46,11 @@ bb0: [1] Const mutate a$5_@0:TObject = Object { } [2] Const mutate b$6_@1:TObject[2:8] = Object { } [3] Const mutate c$7_@1:TObject[2:8] = Object { } - [4] Const mutate a$8_@1:TObject[2:8] = read b$6_@1:TObject - [5] Const mutate b$9_@1:TObject[2:8] = read c$7_@1:TObject - [6] Const mutate c$10_@1:TObject[2:8] = read a$8_@1:TObject - [7] Call mutate mutate$4:TFunction(mutate a$8_@1:TObject, mutate b$9_@1:TObject) - [8] Return freeze c$10_@1:TObject + [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject + [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject + [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject + [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject) + [8] Return freeze c$2$10_@1:TObject ``` ## Reactive Scopes @@ -59,15 +59,15 @@ bb0: function foo( ) { [1] Const mutate a$5_@0:TObject = Object { } - scope @1 [2:8] deps=[] out=[c$10_@1] { + scope @1 [2:8] deps=[] out=[c$2$10_@1] { [2] Const mutate b$6_@1:TObject[2:8] = Object { } [3] Const mutate c$7_@1:TObject[2:8] = Object { } - [4] Const mutate a$8_@1:TObject[2:8] = read b$6_@1:TObject - [5] Const mutate b$9_@1:TObject[2:8] = read c$7_@1:TObject - [6] Const mutate c$10_@1:TObject[2:8] = read a$8_@1:TObject - [7] Call mutate mutate$4:TFunction(mutate a$8_@1:TObject, mutate b$9_@1:TObject) + [4] Const mutate a$0$8_@1:TObject[2:8] = read b$6_@1:TObject + [5] Const mutate b$1$9_@1:TObject[2:8] = read c$7_@1:TObject + [6] Const mutate c$2$10_@1:TObject[2:8] = read a$0$8_@1:TObject + [7] Call mutate mutate$4:TFunction(mutate a$0$8_@1:TObject, mutate b$1$9_@1:TObject) } - return freeze c$10_@1:TObject + return freeze c$2$10_@1:TObject } ``` @@ -75,23 +75,23 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const a$5 = {}; - let c$10; + const a = {}; + let c$2; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const b$6 = {}; - const c$7 = {}; - const a$8 = b$6; - const b$9 = c$7; - c$10 = a$8; - mutate$4(a$8, b$9); - $[0] = c$10; + const b = {}; + const c = {}; + const a$0 = b; + const b$1 = c; + c$2 = a$0; + mutate(a$0, b$1); + $[0] = c$2; } else { - c$10 = $[0]; + c$2 = $[0]; } - return c$10; + return c$2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md index a319cf386f..d502de0c4d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/simple.expect.md @@ -56,33 +56,33 @@ function foo( ## Code ```javascript -function foo$0(x$8, y$9) { +function foo(x, y) { const $ = React.useMemoCache(); - if (x$8) { - const c_0 = $[0] !== y$9; - let t1$11; + if (x) { + const c_0 = $[0] !== y; + let t1; if (c_0) { - t1$11 = foo$0(false, y$9); - $[0] = y$9; - $[1] = t1$11; + t1 = foo(false, y); + $[0] = y; + $[1] = t1; } else { - t1$11 = $[1]; + t1 = $[1]; } - return t1$11; + return t1; } - let t2$14; + let t2; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { - t2$14 = [y$9 * 10]; - $[2] = t2$14; + t2 = [y * 10]; + $[2] = t2; } else { - t2$14 = $[2]; + t2 = $[2]; } - return t2$14; + return t2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md index 737e69e017..90bdf9d70d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-arrayexpression.expect.md @@ -40,19 +40,19 @@ function Component( ## Code ```javascript -function Component$0(props$5) { +function Component(props) { const $ = React.useMemoCache(); - const a$6 = 1; - const b$7 = 2; - let x$8; + const a = 1; + const b = 2; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$8 = [a$6, b$7]; - $[0] = x$8; + x = [a, b]; + $[0] = x; } else { - x$8 = $[0]; + x = $[0]; } - return x$8; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md index dc0a28821c..dbebc5ff8b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx-2.expect.md @@ -38,7 +38,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -94,49 +94,49 @@ function Component( ## Code ```javascript -function Component$0(props$10) { +function Component(props) { const $ = React.useMemoCache(); - let a$11; - let b$12; + let a; + let b; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$11 = []; - b$12 = {}; - foo$4(a$11, b$12); - let t2$13; + a = []; + b = {}; + foo(a, b); + let t2; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { - t2$13 = foo$4(); - $[2] = t2$13; + t2 = foo(); + $[2] = t2; } else { - t2$13 = $[2]; + t2 = $[2]; } - if (t2$13) { - const _$15 =
; + if (t2) { + const _ =
; } - foo$4(a$11, b$12); - $[0] = a$11; - $[1] = b$12; + foo(a, b); + $[0] = a; + $[1] = b; } else { - a$11 = $[0]; - b$12 = $[1]; + a = $[0]; + b = $[1]; } - const c_3 = $[3] !== a$11; - const c_4 = $[4] !== b$12; - let t5$20; + const c_3 = $[3] !== a; + const c_4 = $[4] !== b; + let t5; if (c_3 || c_4) { - t5$20 =
; - $[3] = a$11; - $[4] = b$12; - $[5] = t5$20; + t5 =
; + $[3] = a; + $[4] = b; + $[5] = t5; } else { - t5$20 = $[5]; + t5 = $[5]; } - return t5$20; + return t5; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md index 00a9e96439..7a4cbdd8b1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-call-jsx.expect.md @@ -35,7 +35,7 @@ function foo( ## Code ```javascript -function foo$0() {} +function foo() {} ``` ## HIR @@ -79,39 +79,39 @@ function Component( ## Code ```javascript -function Component$0(props$9) { +function Component(props) { const $ = React.useMemoCache(); - let a$10; - let b$11; + let a; + let b; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$10 = []; - b$11 = {}; - foo$4(a$10, b$11); + a = []; + b = {}; + foo(a, b); - const _$13 =
; + const _ =
; - foo$4(a$10, b$11); - $[0] = a$10; - $[1] = b$11; + foo(a, b); + $[0] = a; + $[1] = b; } else { - a$10 = $[0]; - b$11 = $[1]; + a = $[0]; + b = $[1]; } - const c_2 = $[2] !== a$10; - const c_3 = $[3] !== b$11; - let t4$15; + const c_2 = $[2] !== a; + const c_3 = $[3] !== b; + let t4; if (c_2 || c_3) { - t4$15 =
; - $[2] = a$10; - $[3] = b$11; - $[4] = t4$15; + t4 =
; + $[2] = a; + $[3] = b; + $[4] = t4; } else { - t4$15 = $[4]; + t4 = $[4]; } - return t4$15; + return t4; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md index 74e735bf2a..2aa86039c7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-multiple-if.expect.md @@ -25,27 +25,27 @@ bb0: [2] Const mutate y$8:TPrimitive = 2 [3] Const mutate $9:TPrimitive = 2 [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive - [5] Let mutate x$17_@0[1:8] = read x$7:TPrimitive + [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive [5] If (read $10:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [6] Const mutate x$11:TPrimitive = 3 - [7] Reassign mutate x$17_@0[1:8] = read x$11:TPrimitive + [6] Const mutate x$1$11:TPrimitive = 3 + [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive [7] Goto bb1 bb1: predecessor blocks: bb2 bb0 [8] Const mutate $12:TPrimitive = 3 [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive - [10] Let mutate x$16_@1[1:13] = read x$17_@0 + [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0 [10] If (read $14:TPrimitive) then:bb4 else:bb3 fallthrough=bb3 bb4: predecessor blocks: bb1 - [11] Const mutate x$15:TPrimitive = 5 - [12] Reassign mutate x$16_@1[1:13] = read x$15:TPrimitive + [11] Const mutate x$3$15:TPrimitive = 5 + [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive [12] Goto bb3 bb3: predecessor blocks: bb4 bb1 - [13] Const mutate y$18 = read x$16_@1 + [13] Const mutate y$4$18 = read x$2$16_@1 [14] Return ``` @@ -58,23 +58,23 @@ function foo( [2] Const mutate y$8:TPrimitive = 2 [3] Const mutate $9:TPrimitive = 2 [4] Const mutate $10:TPrimitive = Binary read y$8:TPrimitive === read $9:TPrimitive - scope @0 [1:8] deps=[] out=[x$17_@0] { - [5] Let mutate x$17_@0[1:8] = read x$7:TPrimitive + scope @0 [1:8] deps=[] out=[x$0$17_@0] { + [5] Let mutate x$0$17_@0[1:8] = read x$7:TPrimitive if (read $10:TPrimitive) { - [6] Const mutate x$11:TPrimitive = 3 - [7] Reassign mutate x$17_@0[1:8] = read x$11:TPrimitive + [6] Const mutate x$1$11:TPrimitive = 3 + [7] Reassign mutate x$0$17_@0[1:8] = read x$1$11:TPrimitive } } [8] Const mutate $12:TPrimitive = 3 [9] Const mutate $14:TPrimitive = Binary read y$8:TPrimitive === read $12:TPrimitive - scope @1 [1:13] deps=[] out=[x$16_@1] { - [10] Let mutate x$16_@1[1:13] = read x$17_@0 + scope @1 [1:13] deps=[] out=[x$2$16_@1] { + [10] Let mutate x$2$16_@1[1:13] = read x$0$17_@0 if (read $14:TPrimitive) { - [11] Const mutate x$15:TPrimitive = 5 - [12] Reassign mutate x$16_@1[1:13] = read x$15:TPrimitive + [11] Const mutate x$3$15:TPrimitive = 5 + [12] Reassign mutate x$2$16_@1[1:13] = read x$3$15:TPrimitive } } - [13] Const mutate y$18 = read x$16_@1 + [13] Const mutate y$4$18 = read x$2$16_@1 return } @@ -83,40 +83,40 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$7 = 1; - const y$8 = 2; - let x$17; + const x = 1; + const y = 2; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$17 = x$7; + x$0 = x; - if (y$8 === 2) { - const x$11 = 3; - x$17 = x$11; + if (y === 2) { + const x$1 = 3; + x$0 = x$1; } - $[0] = x$17; + $[0] = x$0; } else { - x$17 = $[0]; + x$0 = $[0]; } - let x$16; + let x$2; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - x$16 = x$17; + x$2 = x$0; - if (y$8 === 3) { - const x$15 = 5; - x$16 = x$15; + if (y === 3) { + const x$3 = 5; + x$2 = x$3; } - $[1] = x$16; + $[1] = x$2; } else { - x$16 = $[1]; + x$2 = $[1]; } - const y$18 = x$16; + const y$4 = x$2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md index e46d89d905..7f0e1fd414 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-complex-single-if.expect.md @@ -22,16 +22,16 @@ bb0: [2] Const mutate y$6:TPrimitive = 2 [3] Const mutate $7:TPrimitive = 2 [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive - [5] Let mutate x$10_@0[1:8] = read x$5:TPrimitive + [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive [5] If (read $8:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [6] Const mutate x$9:TPrimitive = 3 - [7] Reassign mutate x$10_@0[1:8] = read x$9:TPrimitive + [6] Const mutate x$1$9:TPrimitive = 3 + [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive [7] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [8] Const mutate y$11 = read x$10_@0 + [8] Const mutate y$2$11 = read x$0$10_@0 [9] Return ``` @@ -44,14 +44,14 @@ function foo( [2] Const mutate y$6:TPrimitive = 2 [3] Const mutate $7:TPrimitive = 2 [4] Const mutate $8:TPrimitive = Binary read y$6:TPrimitive === read $7:TPrimitive - scope @0 [1:8] deps=[] out=[x$10_@0] { - [5] Let mutate x$10_@0[1:8] = read x$5:TPrimitive + scope @0 [1:8] deps=[] out=[x$0$10_@0] { + [5] Let mutate x$0$10_@0[1:8] = read x$5:TPrimitive if (read $8:TPrimitive) { - [6] Const mutate x$9:TPrimitive = 3 - [7] Reassign mutate x$10_@0[1:8] = read x$9:TPrimitive + [6] Const mutate x$1$9:TPrimitive = 3 + [7] Reassign mutate x$0$10_@0[1:8] = read x$1$9:TPrimitive } } - [8] Const mutate y$11 = read x$10_@0 + [8] Const mutate y$2$11 = read x$0$10_@0 return } @@ -60,25 +60,25 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$5 = 1; - const y$6 = 2; - let x$10; + const x = 1; + const y = 2; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$10 = x$5; + x$0 = x; - if (y$6 === 2) { - const x$9 = 3; - x$10 = x$9; + if (y === 2) { + const x$1 = 3; + x$0 = x$1; } - $[0] = x$10; + $[0] = x$0; } else { - x$10 = $[0]; + x$0 = $[0]; } - const y$11 = x$10; + const y$2 = x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md index 212d9c28a5..845b3c6af5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-of.expect.md @@ -54,8 +54,8 @@ function foo( ## Code ```javascript -function foo$0(cond$4) { - const items$5 = []; +function foo(cond) { + const items = []; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md index 5b0f7ea58d..afc446bc04 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for-trivial-update.expect.md @@ -69,22 +69,22 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$6; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$6 = 1; + x = 1; - for (const i$7 = 0; i$7 < 10; i$7) { - x$6 = x$6 + 1; + for (const i = 0; i < 10; i) { + x = x + 1; } - $[0] = x$6; + $[0] = x; } else { - x$6 = $[0]; + x = $[0]; } - return x$6; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md index f33849d38d..9e89ca3e98 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-for.expect.md @@ -73,22 +73,22 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$7; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$7 = 1; + x = 1; - for (let i$8 = 0; i$8 < 10; i$8 = i$8 + 1, i$8) { - x$7 = x$7 + 1; + for (let i = 0; i < 10; i = i + 1, i) { + x = x + 1; } - $[0] = x$7; + $[0] = x; } else { - x$7 = $[0]; + x = $[0]; } - return x$7; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md index 7142853232..7398d125a5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-if-else.expect.md @@ -55,13 +55,13 @@ function foo( ## Code ```javascript -function foo$0() { - const x$5 = 1; - const y$6 = 2; - if (y$6) { - const z$7 = x$5 + y$6; +function foo() { + const x = 1; + const y = 2; + if (y) { + const z = x + y; } else { - const z$8 = x$5; + const z = x; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md index 1afaabca82..a21674776e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-multiple-phis.expect.md @@ -30,7 +30,7 @@ function foo(a, b, c, d) { bb0: [1] Const mutate x$13:TPrimitive = 0 [2] Const mutate $14:TPrimitive = true - [3] Let mutate x$23_@0[3:20] = undefined + [3] Let mutate x$0$23_@0[3:20] = undefined [3] If (read $14:TPrimitive) then:bb2 else:bb6 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -38,18 +38,18 @@ bb2: [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3 bb4: predecessor blocks: bb2 - [6] Const mutate x$16 = read a$9 - [7] Reassign mutate x$23_@0[3:20] = read x$16 + [6] Const mutate x$1$16 = read a$9 + [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16 [7] Goto bb3 bb5: predecessor blocks: bb2 - [8] Const mutate x$17 = read b$10 - [9] Reassign mutate x$23_@0[3:20] = read x$17 + [8] Const mutate x$2$17 = read b$10 + [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17 [9] Goto bb3 bb3: predecessor blocks: bb4 bb5 - [10] read x$18 - [11] Reassign mutate x$23_@0[3:20] = read x$18 + [10] read x$3$18 + [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18 [11] Goto bb1 bb6: predecessor blocks: bb0 @@ -57,22 +57,22 @@ bb6: [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7 bb8: predecessor blocks: bb6 - [14] Const mutate x$20 = read c$11 - [15] Reassign mutate x$23_@0[3:20] = read x$20 + [14] Const mutate x$4$20 = read c$11 + [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20 [15] Goto bb7 bb9: predecessor blocks: bb6 - [16] Const mutate x$21 = read d$12 - [17] Reassign mutate x$23_@0[3:20] = read x$21 + [16] Const mutate x$5$21 = read d$12 + [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21 [17] Goto bb7 bb7: predecessor blocks: bb8 bb9 - [18] read x$22 - [19] Reassign mutate x$23_@0[3:20] = read x$22 + [18] read x$6$22 + [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22 [19] Goto bb1 bb1: predecessor blocks: bb3 bb7 - [20] Return read x$23_@0 + [20] Return read x$0$23_@0 ``` ## Reactive Scopes @@ -86,33 +86,33 @@ function foo( ) { [1] Const mutate x$13:TPrimitive = 0 [2] Const mutate $14:TPrimitive = true - scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] out=[x$23_@0] { - [3] Let mutate x$23_@0[3:20] = undefined + scope @0 [3:20] deps=[read a$9, read b$10, read c$11, read d$12] out=[x$0$23_@0] { + [3] Let mutate x$0$23_@0[3:20] = undefined if (read $14:TPrimitive) { [4] Const mutate $15:TPrimitive = true if (read $15:TPrimitive) { - [6] Const mutate x$16 = read a$9 - [7] Reassign mutate x$23_@0[3:20] = read x$16 + [6] Const mutate x$1$16 = read a$9 + [7] Reassign mutate x$0$23_@0[3:20] = read x$1$16 } else { - [8] Const mutate x$17 = read b$10 - [9] Reassign mutate x$23_@0[3:20] = read x$17 + [8] Const mutate x$2$17 = read b$10 + [9] Reassign mutate x$0$23_@0[3:20] = read x$2$17 } - [10] read x$18 - [11] Reassign mutate x$23_@0[3:20] = read x$18 + [10] read x$3$18 + [11] Reassign mutate x$0$23_@0[3:20] = read x$3$18 } else { [12] Const mutate $19:TPrimitive = true if (read $19:TPrimitive) { - [14] Const mutate x$20 = read c$11 - [15] Reassign mutate x$23_@0[3:20] = read x$20 + [14] Const mutate x$4$20 = read c$11 + [15] Reassign mutate x$0$23_@0[3:20] = read x$4$20 } else { - [16] Const mutate x$21 = read d$12 - [17] Reassign mutate x$23_@0[3:20] = read x$21 + [16] Const mutate x$5$21 = read d$12 + [17] Reassign mutate x$0$23_@0[3:20] = read x$5$21 } - [18] read x$22 - [19] Reassign mutate x$23_@0[3:20] = read x$22 + [18] read x$6$22 + [19] Reassign mutate x$0$23_@0[3:20] = read x$6$22 } } - return read x$23_@0 + return read x$0$23_@0 } ``` @@ -120,51 +120,51 @@ function foo( ## Code ```javascript -function foo$0(a$9, b$10, c$11, d$12) { +function foo(a, b, c, d) { const $ = React.useMemoCache(); - const x$13 = 0; - const c_0 = $[0] !== a$9; - const c_1 = $[1] !== b$10; - const c_2 = $[2] !== c$11; - const c_3 = $[3] !== d$12; - let x$23; + const x = 0; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + const c_3 = $[3] !== d; + let x$0; if (c_0 || c_1 || c_2 || c_3) { - x$23 = undefined; + x$0 = undefined; if (true) { if (true) { - const x$16 = a$9; - x$23 = x$16; + const x$1 = a; + x$0 = x$1; } else { - const x$17 = b$10; - x$23 = x$17; + const x$2 = b; + x$0 = x$2; } - x$18; - x$23 = x$18; + x$3; + x$0 = x$3; } else { if (true) { - const x$20 = c$11; - x$23 = x$20; + const x$4 = c; + x$0 = x$4; } else { - const x$21 = d$12; - x$23 = x$21; + const x$5 = d; + x$0 = x$5; } - x$22; - x$23 = x$22; + x$6; + x$0 = x$6; } - $[0] = a$9; - $[1] = b$10; - $[2] = c$11; - $[3] = d$12; - $[4] = x$23; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = d; + $[4] = x$0; } else { - x$23 = $[4]; + x$0 = $[4]; } - return x$23; + return x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md index 12890207a8..91d708ccf0 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-loops-no-reassign.expect.md @@ -85,17 +85,17 @@ function foo( ## Code ```javascript -function foo$0(a$6, b$7, c$8) { - const x$9 = 0; - while (a$6) { - while (b$7) { - while (c$8) { - x$9 + 1; +function foo(a, b, c) { + const x = 0; + while (a) { + while (b) { + while (c) { + x + 1; } } } - return x$9; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md index cf372de562..e6f5c05c10 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-phi.expect.md @@ -22,16 +22,16 @@ bb0: [2] If (read b$6) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Let mutate x$10_@0[1:6] = read x$8 + [3] Let mutate x$0$10_@0[1:6] = read x$8 [3] If (read c$7) then:bb4 else:bb3 fallthrough=bb3 bb4: predecessor blocks: bb2 - [4] Const mutate x$9 = read c$7 - [5] Reassign mutate x$10_@0[1:6] = read x$9 + [4] Const mutate x$1$9 = read c$7 + [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9 [5] Goto bb3 bb3: predecessor blocks: bb4 bb2 - [6] read x$10_@0 + [6] read x$0$10_@0 [7] Goto bb1 bb1: predecessor blocks: bb3 bb0 @@ -48,14 +48,14 @@ function foo( ) { [1] Const mutate x$8 = read a$5 if (read b$6) { - scope @0 [1:6] deps=[read c$7] out=[x$10_@0] { - [3] Let mutate x$10_@0[1:6] = read x$8 + scope @0 [1:6] deps=[read c$7] out=[x$0$10_@0] { + [3] Let mutate x$0$10_@0[1:6] = read x$8 if (read c$7) { - [4] Const mutate x$9 = read c$7 - [5] Reassign mutate x$10_@0[1:6] = read x$9 + [4] Const mutate x$1$9 = read c$7 + [5] Reassign mutate x$0$10_@0[1:6] = read x$1$9 } } - [6] read x$10_@0 + [6] read x$0$10_@0 } return } @@ -65,28 +65,28 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6, c$7) { +function foo(a, b, c) { const $ = React.useMemoCache(); - const x$8 = a$5; - if (b$6) { - const c_0 = $[0] !== c$7; - let x$10; + const x = a; + if (b) { + const c_0 = $[0] !== c; + let x$0; if (c_0) { - x$10 = x$8; + x$0 = x; - if (c$7) { - const x$9 = c$7; - x$10 = x$9; + if (c) { + const x$1 = c; + x$0 = x$1; } - $[0] = c$7; - $[1] = x$10; + $[0] = c; + $[1] = x$0; } else { - x$10 = $[1]; + x$0 = $[1]; } - x$10; + x$0; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md index c9d80875a2..17b0c3e306 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-nested-partial-reassignment.expect.md @@ -21,24 +21,24 @@ function foo(a, b, c, d, e) { ``` bb0: [1] Const mutate x$12:TPrimitive = null - [2] Let mutate x$15_@0[1:8] = read x$12:TPrimitive + [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive [2] If (read a$7) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Const mutate x$13 = read b$8 - [4] Reassign mutate x$15_@0[1:8] = read x$13 + [3] Const mutate x$1$13 = read b$8 + [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13 [4] Goto bb1 bb3: predecessor blocks: bb0 [5] If (read c$9) then:bb5 else:bb1 fallthrough=bb1 bb5: predecessor blocks: bb3 - [6] Const mutate x$14 = read d$10 - [7] Reassign mutate x$15_@0[1:8] = read x$14 + [6] Const mutate x$2$14 = read d$10 + [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14 [7] Goto bb1 bb1: predecessor blocks: bb2 bb5 bb3 - [8] Return read x$15_@0 + [8] Return read x$0$15_@0 ``` ## Reactive Scopes @@ -52,19 +52,19 @@ function foo( e, ) { [1] Const mutate x$12:TPrimitive = null - scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] out=[x$15_@0] { - [2] Let mutate x$15_@0[1:8] = read x$12:TPrimitive + scope @0 [1:8] deps=[read a$7, read b$8, read c$9, read d$10] out=[x$0$15_@0] { + [2] Let mutate x$0$15_@0[1:8] = read x$12:TPrimitive if (read a$7) { - [3] Const mutate x$13 = read b$8 - [4] Reassign mutate x$15_@0[1:8] = read x$13 + [3] Const mutate x$1$13 = read b$8 + [4] Reassign mutate x$0$15_@0[1:8] = read x$1$13 } else { if (read c$9) { - [6] Const mutate x$14 = read d$10 - [7] Reassign mutate x$15_@0[1:8] = read x$14 + [6] Const mutate x$2$14 = read d$10 + [7] Reassign mutate x$0$15_@0[1:8] = read x$2$14 } } } - return read x$15_@0 + return read x$0$15_@0 } ``` @@ -72,37 +72,37 @@ function foo( ## Code ```javascript -function foo$0(a$7, b$8, c$9, d$10, e$11) { +function foo(a, b, c, d, e) { const $ = React.useMemoCache(); - const x$12 = null; - const c_0 = $[0] !== a$7; - const c_1 = $[1] !== b$8; - const c_2 = $[2] !== c$9; - const c_3 = $[3] !== d$10; - let x$15; + const x = null; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + const c_2 = $[2] !== c; + const c_3 = $[3] !== d; + let x$0; if (c_0 || c_1 || c_2 || c_3) { - x$15 = x$12; + x$0 = x; - if (a$7) { - const x$13 = b$8; - x$15 = x$13; + if (a) { + const x$1 = b; + x$0 = x$1; } else { - if (c$9) { - const x$14 = d$10; - x$15 = x$14; + if (c) { + const x$2 = d; + x$0 = x$2; } } - $[0] = a$7; - $[1] = b$8; - $[2] = c$9; - $[3] = d$10; - $[4] = x$15; + $[0] = a; + $[1] = b; + $[2] = c; + $[3] = d; + $[4] = x$0; } else { - x$15 = $[4]; + x$0 = $[4]; } - return x$15; + return x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md index 5c3be6c255..d84a9bb8d5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-newexpression.expect.md @@ -33,7 +33,7 @@ function Foo( ## Code ```javascript -function Foo$0() {} +function Foo() {} ``` ## HIR @@ -65,19 +65,19 @@ function Component( ## Code ```javascript -function Component$0(props$6) { +function Component(props) { const $ = React.useMemoCache(); - let c$9; + let c; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const a$7 = []; - const b$8 = {}; - c$9 = new Foo$4(a$7, b$8); - $[0] = c$9; + const a = []; + const b = {}; + c = new Foo(a, b); + $[0] = c; } else { - c$9 = $[0]; + c = $[0]; } - return c$9; + return c; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md index eef672c131..023081d3ff 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression-phi.expect.md @@ -26,22 +26,22 @@ bb0: [2] Const mutate y$7:TPrimitive = 2 [3] Const mutate $8:TPrimitive = 1 [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive - [5] Let mutate x$12_@0[1:10] = read x$6:TPrimitive - [5] Let mutate y$13_@0[1:10] = read y$7:TPrimitive + [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive + [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive [5] If (read $9:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [6] Const mutate x$10:TPrimitive = 2 - [7] Reassign mutate x$12_@0[1:10] = read x$10:TPrimitive + [6] Const mutate x$2$10:TPrimitive = 2 + [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive [7] Goto bb1 bb3: predecessor blocks: bb0 - [8] Const mutate y$11:TPrimitive = 3 - [9] Reassign mutate y$13_@0[1:10] = read y$11:TPrimitive + [8] Const mutate y$3$11:TPrimitive = 3 + [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive [9] Goto bb1 bb1: predecessor blocks: bb2 bb3 - [10] Const mutate t$14_@2:TObject = Object { x: read x$12_@0, y: read y$13_@0 } + [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 } [11] Return freeze t$14_@2:TObject ``` @@ -54,19 +54,19 @@ function foo( [2] Const mutate y$7:TPrimitive = 2 [3] Const mutate $8:TPrimitive = 1 [4] Const mutate $9:TPrimitive = Binary read x$6:TPrimitive > read $8:TPrimitive - scope @0 [1:10] deps=[] out=[x$12_@0] { - [5] Let mutate x$12_@0[1:10] = read x$6:TPrimitive - [5] Let mutate y$13_@0[1:10] = read y$7:TPrimitive + scope @0 [1:10] deps=[] out=[x$0$12_@0] { + [5] Let mutate x$0$12_@0[1:10] = read x$6:TPrimitive + [5] Let mutate y$1$13_@0[1:10] = read y$7:TPrimitive if (read $9:TPrimitive) { - [6] Const mutate x$10:TPrimitive = 2 - [7] Reassign mutate x$12_@0[1:10] = read x$10:TPrimitive + [6] Const mutate x$2$10:TPrimitive = 2 + [7] Reassign mutate x$0$12_@0[1:10] = read x$2$10:TPrimitive } else { - [8] Const mutate y$11:TPrimitive = 3 - [9] Reassign mutate y$13_@0[1:10] = read y$11:TPrimitive + [8] Const mutate y$3$11:TPrimitive = 3 + [9] Reassign mutate y$1$13_@0[1:10] = read y$3$11:TPrimitive } } - scope @2 [10:11] deps=[read x$12_@0, read y$13_@0] out=[t$14_@2] { - [10] Const mutate t$14_@2:TObject = Object { x: read x$12_@0, y: read y$13_@0 } + scope @2 [10:11] deps=[read x$0$12_@0, read y$1$13_@0] out=[t$14_@2] { + [10] Const mutate t$14_@2:TObject = Object { x: read x$0$12_@0, y: read y$1$13_@0 } } return freeze t$14_@2:TObject } @@ -76,45 +76,45 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$6 = 1; - const y$7 = 2; - let x$12; + const x = 1; + const y = 2; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$12 = x$6; - let y$13 = y$7; + x$0 = x; + let y$1 = y; - if (x$6 > 1) { - const x$10 = 2; - x$12 = x$10; + if (x > 1) { + const x$2 = 2; + x$0 = x$2; } else { - const y$11 = 3; - y$13 = y$11; + const y$3 = 3; + y$1 = y$3; } - $[0] = x$12; + $[0] = x$0; } else { - x$12 = $[0]; + x$0 = $[0]; } - const c_1 = $[1] !== x$12; - const c_2 = $[2] !== y$13; - let t$14; + const c_1 = $[1] !== x$0; + const c_2 = $[2] !== y$1; + let t; if (c_1 || c_2) { - t$14 = { - x: x$12, - y: y$13, + t = { + x: x$0, + y: y$1, }; - $[1] = x$12; - $[2] = y$13; - $[3] = t$14; + $[1] = x$0; + $[2] = y$1; + $[3] = t; } else { - t$14 = $[3]; + t = $[3]; } - return t$14; + return t; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md index c1d66e099d..947ef1730b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-objectexpression.expect.md @@ -40,22 +40,22 @@ function Component( ## Code ```javascript -function Component$0(props$5) { +function Component(props) { const $ = React.useMemoCache(); - const a$6 = 1; - const b$7 = 2; - let x$8; + const a = 1; + const b = 2; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$8 = { - a: a$6, - b: b$7, + x = { + a: a, + b: b, }; - $[0] = x$8; + $[0] = x; } else { - x$8 = $[0]; + x = $[0]; } - return x$8; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md index 7228cdecfb..c8e879b09c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-alias-mutate-if.expect.md @@ -67,30 +67,30 @@ function foo( ## Code ```javascript -function foo$0(a$7) { +function foo(a) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$7; - let x$9; + const c_0 = $[0] !== a; + let x; if (c_0) { - const b$8 = {}; - x$9 = b$8; + const b = {}; + x = b; - if (a$7) { - const y$10 = {}; - x$9.y = y$10; + if (a) { + const y = {}; + x.y = y; } else { - const z$11 = {}; - x$9.z = z$11; + const z = {}; + x.z = z; } - mutate$6(b$8); - $[0] = a$7; - $[1] = x$9; + mutate(b); + $[0] = a; + $[1] = x; } else { - x$9 = $[1]; + x = $[1]; } - return x$9; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md index 49ed7cf4aa..6fa6e7114a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-if.expect.md @@ -65,44 +65,44 @@ function foo( ## Code ```javascript -function foo$0(a$5) { +function foo(a) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$5; - let x$6; + const c_0 = $[0] !== a; + let x; if (c_0) { - x$6 = {}; + x = {}; - if (a$5) { - let y$7; + if (a) { + let y; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { - y$7 = {}; - $[2] = y$7; + y = {}; + $[2] = y; } else { - y$7 = $[2]; + y = $[2]; } - x$6.y = y$7; + x.y = y; } else { - let z$8; + let z; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - z$8 = {}; - $[3] = z$8; + z = {}; + $[3] = z; } else { - z$8 = $[3]; + z = $[3]; } - x$6.z = z$8; + x.z = z; } - $[0] = a$5; - $[1] = x$6; + $[0] = a; + $[1] = x; } else { - x$6 = $[1]; + x = $[1]; } - return x$6; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md index 9f99a2eced..92bda0eaa2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-if.expect.md @@ -64,29 +64,29 @@ function foo( ## Code ```javascript -function foo$0(a$6) { +function foo(a) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$6; - let x$7; + const c_0 = $[0] !== a; + let x; if (c_0) { - x$7 = {}; + x = {}; - if (a$6) { - const y$8 = {}; - x$7.y = y$8; + if (a) { + const y = {}; + x.y = y; } else { - const z$9 = {}; - x$7.z = z$9; + const z = {}; + x.z = z; } - mutate$5(x$7); - $[0] = a$6; - $[1] = x$7; + mutate(x); + $[0] = a; + $[1] = x; } else { - x$7 = $[1]; + x = $[1]; } - return x$7; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md index 59d1fe7c91..732057cb21 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate-inside-if.expect.md @@ -66,37 +66,37 @@ function foo( ## Code ```javascript -function foo$0(a$6) { +function foo(a) { const $ = React.useMemoCache(); - const c_0 = $[0] !== a$6; - let x$7; + const c_0 = $[0] !== a; + let x; if (c_0) { - x$7 = {}; + x = {}; - if (a$6) { - const y$8 = {}; - x$7.y = y$8; - mutate$4(y$8); + if (a) { + const y = {}; + x.y = y; + mutate(y); } else { - let z$9; + let z; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { - z$9 = {}; - $[2] = z$9; + z = {}; + $[2] = z; } else { - z$9 = $[2]; + z = $[2]; } - x$7.z = z$9; + x.z = z; } - $[0] = a$6; - $[1] = x$7; + $[0] = a; + $[1] = x; } else { - x$7 = $[1]; + x = $[1]; } - return x$7; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md index edf61fa7d9..33cf4df6c5 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-alias-mutate.expect.md @@ -47,21 +47,21 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let y$7; + let y; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const a$5 = {}; - const x$6 = a$5; - y$7 = {}; - y$7.x = x$6; - mutate$4(a$5); - $[0] = y$7; + const a = {}; + const x = a; + y = {}; + y.x = x; + mutate(a); + $[0] = y; } else { - y$7 = $[0]; + y = $[0]; } - return y$7; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md index 3c542a9fec..a0c4bce260 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-call.expect.md @@ -43,31 +43,31 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$4; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$4 = []; - $[0] = x$4; + x = []; + $[0] = x; } else { - x$4 = $[0]; + x = $[0]; } - const c_1 = $[1] !== x$4; - let y$5; + const c_1 = $[1] !== x; + let y; if (c_1) { - y$5 = { - x: x$4, + y = { + x: x, }; - y$5.x.push([]); - $[1] = x$4; - $[2] = y$5; + y.x.push([]); + $[1] = x; + $[2] = y; } else { - y$5 = $[2]; + y = $[2]; } - return y$5; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md index bc9fb05665..8d1508c835 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-2.expect.md @@ -42,20 +42,20 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let y$5; + let y; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const x$4 = []; - y$5 = {}; - y$5.x = x$4; - mutate$3(x$4); - $[0] = y$5; + const x = []; + y = {}; + y.x = x; + mutate(x); + $[0] = y; } else { - y$5 = $[0]; + y = $[0]; } - return y$5; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md index 7338e9aa0a..56bf236bc8 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate-alias.expect.md @@ -47,21 +47,21 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let y$6; + let y; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const a$5 = {}; - y$6 = a$5; - const x$7 = []; - y$6.x = x$7; - mutate$4(a$5); - $[0] = y$6; + const a = {}; + y = a; + const x = []; + y.x = x; + mutate(a); + $[0] = y; } else { - y$6 = $[0]; + y = $[0]; } - return y$6; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md index a34a301b10..8ad5180d55 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property-mutate.expect.md @@ -42,20 +42,20 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let y$5; + let y; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - const x$4 = []; - y$5 = {}; - y$5.x = x$4; - mutate$3(y$5); - $[0] = y$5; + const x = []; + y = {}; + y.x = x; + mutate(y); + $[0] = y; } else { - y$5 = $[0]; + y = $[0]; } - return y$5; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md index 9d4989455e..88c56e2c15 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-property.expect.md @@ -41,29 +41,29 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$3; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$3 = []; - $[0] = x$3; + x = []; + $[0] = x; } else { - x$3 = $[0]; + x = $[0]; } - const c_1 = $[1] !== x$3; - let y$4; + const c_1 = $[1] !== x; + let y; if (c_1) { - y$4 = {}; - y$4.x = x$3; - $[1] = x$3; - $[2] = y$4; + y = {}; + y.x = x; + $[1] = x; + $[2] = y; } else { - y$4 = $[2]; + y = $[2]; } - return y$4; + return y; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md index 8dfba9fdc1..094418e949 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-reassign.expect.md @@ -17,10 +17,10 @@ function foo(a, b, c) { ``` bb0: [1] Const mutate x$8:TPrimitive = 0 - [2] Const mutate x$9 = read a$5 - [3] Const mutate x$10 = read b$6 - [4] Const mutate x$11 = read c$7 - [5] Return read x$11 + [2] Const mutate x$0$9 = read a$5 + [3] Const mutate x$1$10 = read b$6 + [4] Const mutate x$2$11 = read c$7 + [5] Return read x$2$11 ``` ## Reactive Scopes @@ -32,10 +32,10 @@ function foo( c, ) { [1] Const mutate x$8:TPrimitive = 0 - [2] Const mutate x$9 = read a$5 - [3] Const mutate x$10 = read b$6 - [4] Const mutate x$11 = read c$7 - return read x$11 + [2] Const mutate x$0$9 = read a$5 + [3] Const mutate x$1$10 = read b$6 + [4] Const mutate x$2$11 = read c$7 + return read x$2$11 } ``` @@ -43,12 +43,12 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6, c$7) { - const x$8 = 0; - const x$9 = a$5; - const x$10 = b$6; - const x$11 = c$7; - return x$11; +function foo(a, b, c) { + const x = 0; + const x$0 = a; + const x$1 = b; + const x$2 = c; + return x$2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md index ef2cb2cce1..3ee84debd9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-return.expect.md @@ -20,16 +20,16 @@ bb0: [1] Const mutate x$4:TPrimitive = 1 [2] Const mutate $5:TPrimitive = 1 [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - [4] Let mutate x$8_@0[1:7] = read x$4:TPrimitive + [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Const mutate x$7:TPrimitive = 2 - [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive + [5] Const mutate x$1$7:TPrimitive = 2 + [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Return read x$8_@0 + [7] Return read x$0$8_@0 ``` ## Reactive Scopes @@ -40,14 +40,14 @@ function foo( [1] Const mutate x$4:TPrimitive = 1 [2] Const mutate $5:TPrimitive = 1 [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - scope @0 [1:7] deps=[] out=[x$8_@0] { - [4] Let mutate x$8_@0[1:7] = read x$4:TPrimitive + scope @0 [1:7] deps=[] out=[x$0$8_@0] { + [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive if (read $6:TPrimitive) { - [5] Const mutate x$7:TPrimitive = 2 - [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive + [5] Const mutate x$1$7:TPrimitive = 2 + [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive } } - return read x$8_@0 + return read x$0$8_@0 } ``` @@ -55,24 +55,24 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$4 = 1; - let x$8; + const x = 1; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$8 = x$4; + x$0 = x; - if (x$4 === 1) { - const x$7 = 2; - x$8 = x$7; + if (x === 1) { + const x$1 = 2; + x$0 = x$1; } - $[0] = x$8; + $[0] = x$0; } else { - x$8 = $[0]; + x$0 = $[0]; } - return x$8; + return x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md index fb568a3fe6..3a31214d77 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-shadowing.expect.md @@ -37,7 +37,7 @@ function log( ## Code ```javascript -function log$0() {} +function log() {} ``` ## HIR @@ -45,21 +45,21 @@ function log$0() {} ``` bb0: [1] Const mutate str$6:TPrimitive = "" - [2] Let mutate str$10_@0[1:8] = read str$6:TPrimitive + [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive [2] If (read cond$5) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Const mutate str$7:TPrimitive = "other test" - [4] Call mutate log$4:TFunction(read str$7:TPrimitive) + [3] Const mutate str$1$7:TPrimitive = "other test" + [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive) [5] Goto bb1 bb3: predecessor blocks: bb0 - [6] Const mutate str$8:TPrimitive = "fallthrough test" - [7] Reassign mutate str$10_@0[1:8] = read str$8:TPrimitive + [6] Const mutate str$2$8:TPrimitive = "fallthrough test" + [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive [7] Goto bb1 bb1: predecessor blocks: bb2 bb3 - [8] Call mutate log$4:TFunction(read str$10_@0) + [8] Call mutate log$4:TFunction(read str$0$10_@0) [9] Return ``` @@ -70,17 +70,17 @@ function Foo( cond, ) { [1] Const mutate str$6:TPrimitive = "" - scope @0 [1:8] deps=[read cond$5] out=[str$10_@0] { - [2] Let mutate str$10_@0[1:8] = read str$6:TPrimitive + scope @0 [1:8] deps=[read cond$5] out=[str$0$10_@0] { + [2] Let mutate str$0$10_@0[1:8] = read str$6:TPrimitive if (read cond$5) { - [3] Const mutate str$7:TPrimitive = "other test" - [4] Call mutate log$4:TFunction(read str$7:TPrimitive) + [3] Const mutate str$1$7:TPrimitive = "other test" + [4] Call mutate log$4:TFunction(read str$1$7:TPrimitive) } else { - [6] Const mutate str$8:TPrimitive = "fallthrough test" - [7] Reassign mutate str$10_@0[1:8] = read str$8:TPrimitive + [6] Const mutate str$2$8:TPrimitive = "fallthrough test" + [7] Reassign mutate str$0$10_@0[1:8] = read str$2$8:TPrimitive } } - [8] Call mutate log$4:TFunction(read str$10_@0) + [8] Call mutate log$4:TFunction(read str$0$10_@0) return } @@ -89,29 +89,29 @@ function Foo( ## Code ```javascript -function Foo$0(cond$5) { +function Foo(cond) { const $ = React.useMemoCache(); - const str$6 = ""; - const c_0 = $[0] !== cond$5; - let str$10; + const str = ""; + const c_0 = $[0] !== cond; + let str$0; if (c_0) { - str$10 = str$6; + str$0 = str; - if (cond$5) { - const str$7 = "other test"; - log$4(str$7); + if (cond) { + const str$1 = "other test"; + log(str$1); } else { - const str$8 = "fallthrough test"; - str$10 = str$8; + const str$2 = "fallthrough test"; + str$0 = str$2; } - $[0] = cond$5; - $[1] = str$10; + $[0] = cond; + $[1] = str$0; } else { - str$10 = $[1]; + str$0 = $[1]; } - log$4(str$10); + log(str$0); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md index 6ed3065fed..e8e157b3f2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-sibling-phis.expect.md @@ -34,40 +34,40 @@ bb0: bb2: predecessor blocks: bb0 [4] Const mutate $15:TPrimitive = true - [5] Let mutate x$18_@0[5:10] = undefined + [5] Let mutate x$0$18_@0[5:10] = undefined [5] If (read $15:TPrimitive) then:bb4 else:bb5 fallthrough=bb3 bb4: predecessor blocks: bb2 - [6] Const mutate x$16 = read a$9 - [7] Reassign mutate x$18_@0[5:10] = read x$16 + [6] Const mutate x$1$16 = read a$9 + [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16 [7] Goto bb3 bb5: predecessor blocks: bb2 - [8] Const mutate x$17 = read b$10 - [9] Reassign mutate x$18_@0[5:10] = read x$17 + [8] Const mutate x$2$17 = read b$10 + [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17 [9] Goto bb3 bb3: predecessor blocks: bb4 bb5 - [10] read x$18_@0 + [10] read x$0$18_@0 [11] Goto bb1 bb6: predecessor blocks: bb0 [12] Const mutate $19:TPrimitive = true - [13] Let mutate x$22_@1[13:18] = undefined + [13] Let mutate x$3$22_@1[13:18] = undefined [13] If (read $19:TPrimitive) then:bb8 else:bb9 fallthrough=bb7 bb8: predecessor blocks: bb6 - [14] Const mutate x$20 = read c$11 - [15] Reassign mutate x$22_@1[13:18] = read x$20 + [14] Const mutate x$4$20 = read c$11 + [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20 [15] Goto bb7 bb9: predecessor blocks: bb6 - [16] Const mutate x$21 = read d$12 - [17] Reassign mutate x$22_@1[13:18] = read x$21 + [16] Const mutate x$5$21 = read d$12 + [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21 [17] Goto bb7 bb7: predecessor blocks: bb8 bb9 - [18] read x$22_@1 + [18] read x$3$22_@1 [19] Goto bb1 bb1: predecessor blocks: bb3 bb7 @@ -87,30 +87,30 @@ function foo( [2] Const mutate $14:TPrimitive = true if (read $14:TPrimitive) { [4] Const mutate $15:TPrimitive = true - scope @0 [5:10] deps=[read a$9, read b$10] out=[x$18_@0] { - [5] Let mutate x$18_@0[5:10] = undefined + scope @0 [5:10] deps=[read a$9, read b$10] out=[x$0$18_@0] { + [5] Let mutate x$0$18_@0[5:10] = undefined if (read $15:TPrimitive) { - [6] Const mutate x$16 = read a$9 - [7] Reassign mutate x$18_@0[5:10] = read x$16 + [6] Const mutate x$1$16 = read a$9 + [7] Reassign mutate x$0$18_@0[5:10] = read x$1$16 } else { - [8] Const mutate x$17 = read b$10 - [9] Reassign mutate x$18_@0[5:10] = read x$17 + [8] Const mutate x$2$17 = read b$10 + [9] Reassign mutate x$0$18_@0[5:10] = read x$2$17 } } - [10] read x$18_@0 + [10] read x$0$18_@0 } else { [12] Const mutate $19:TPrimitive = true - scope @1 [13:18] deps=[read c$11, read d$12] out=[x$22_@1] { - [13] Let mutate x$22_@1[13:18] = undefined + scope @1 [13:18] deps=[read c$11, read d$12] out=[x$3$22_@1] { + [13] Let mutate x$3$22_@1[13:18] = undefined if (read $19:TPrimitive) { - [14] Const mutate x$20 = read c$11 - [15] Reassign mutate x$22_@1[13:18] = read x$20 + [14] Const mutate x$4$20 = read c$11 + [15] Reassign mutate x$3$22_@1[13:18] = read x$4$20 } else { - [16] Const mutate x$21 = read d$12 - [17] Reassign mutate x$22_@1[13:18] = read x$21 + [16] Const mutate x$5$21 = read d$12 + [17] Reassign mutate x$3$22_@1[13:18] = read x$5$21 } } - [18] read x$22_@1 + [18] read x$3$22_@1 } return } @@ -120,57 +120,57 @@ function foo( ## Code ```javascript -function foo$0(a$9, b$10, c$11, d$12) { +function foo(a, b, c, d) { const $ = React.useMemoCache(); - const x$13 = 0; + const x = 0; if (true) { - const c_0 = $[0] !== a$9; - const c_1 = $[1] !== b$10; - let x$18; + const c_0 = $[0] !== a; + const c_1 = $[1] !== b; + let x$0; if (c_0 || c_1) { - x$18 = undefined; + x$0 = undefined; if (true) { - const x$16 = a$9; - x$18 = x$16; + const x$1 = a; + x$0 = x$1; } else { - const x$17 = b$10; - x$18 = x$17; + const x$2 = b; + x$0 = x$2; } - $[0] = a$9; - $[1] = b$10; - $[2] = x$18; + $[0] = a; + $[1] = b; + $[2] = x$0; } else { - x$18 = $[2]; + x$0 = $[2]; } - x$18; + x$0; } else { - const c_3 = $[3] !== c$11; - const c_4 = $[4] !== d$12; - let x$22; + const c_3 = $[3] !== c; + const c_4 = $[4] !== d; + let x$3; if (c_3 || c_4) { - x$22 = undefined; + x$3 = undefined; if (true) { - const x$20 = c$11; - x$22 = x$20; + const x$4 = c; + x$3 = x$4; } else { - const x$21 = d$12; - x$22 = x$21; + const x$5 = d; + x$3 = x$5; } - $[3] = c$11; - $[4] = d$12; - $[5] = x$22; + $[3] = c; + $[4] = d; + $[5] = x$3; } else { - x$22 = $[5]; + x$3 = $[5]; } - x$22; + x$3; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md index a680165fde..b292e564f2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple-phi.expect.md @@ -23,21 +23,21 @@ bb0: [1] Const mutate y$5:TPrimitive = 2 [2] Const mutate $6:TPrimitive = 1 [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive - [4] Let mutate y$10_@0[4:9] = undefined + [4] Let mutate y$0$10_@0[4:9] = undefined [4] If (read $7:TPrimitive) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Const mutate y$8:TPrimitive = 1 - [6] Reassign mutate y$10_@0[4:9] = read y$8:TPrimitive + [5] Const mutate y$1$8:TPrimitive = 1 + [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive [6] Goto bb1 bb3: predecessor blocks: bb0 - [7] Const mutate y$9:TPrimitive = 2 - [8] Reassign mutate y$10_@0[4:9] = read y$9:TPrimitive + [7] Const mutate y$2$9:TPrimitive = 2 + [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive [8] Goto bb1 bb1: predecessor blocks: bb2 bb3 - [9] Const mutate x$11 = read y$10_@0 + [9] Const mutate x$11 = read y$0$10_@0 [10] Return ``` @@ -49,17 +49,17 @@ function foo( [1] Const mutate y$5:TPrimitive = 2 [2] Const mutate $6:TPrimitive = 1 [3] Const mutate $7:TPrimitive = Binary read y$5:TPrimitive > read $6:TPrimitive - scope @0 [4:9] deps=[] out=[y$10_@0] { - [4] Let mutate y$10_@0[4:9] = undefined + scope @0 [4:9] deps=[] out=[y$0$10_@0] { + [4] Let mutate y$0$10_@0[4:9] = undefined if (read $7:TPrimitive) { - [5] Const mutate y$8:TPrimitive = 1 - [6] Reassign mutate y$10_@0[4:9] = read y$8:TPrimitive + [5] Const mutate y$1$8:TPrimitive = 1 + [6] Reassign mutate y$0$10_@0[4:9] = read y$1$8:TPrimitive } else { - [7] Const mutate y$9:TPrimitive = 2 - [8] Reassign mutate y$10_@0[4:9] = read y$9:TPrimitive + [7] Const mutate y$2$9:TPrimitive = 2 + [8] Reassign mutate y$0$10_@0[4:9] = read y$2$9:TPrimitive } } - [9] Const mutate x$11 = read y$10_@0 + [9] Const mutate x$11 = read y$0$10_@0 return } @@ -68,27 +68,27 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const y$5 = 2; - let y$10; + const y = 2; + let y$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - y$10 = undefined; + y$0 = undefined; - if (y$5 > 1) { - const y$8 = 1; - y$10 = y$8; + if (y > 1) { + const y$1 = 1; + y$0 = y$1; } else { - const y$9 = 2; - y$10 = y$9; + const y$2 = 2; + y$0 = y$2; } - $[0] = y$10; + $[0] = y$0; } else { - y$10 = $[0]; + y$0 = $[0]; } - const x$11 = y$10; + const x = y$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md index 3e968a618f..47485853fe 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-simple.expect.md @@ -33,9 +33,9 @@ function foo( ## Code ```javascript -function foo$0() { - const x$3 = 1; - const y$4 = 2; +function foo() { + const x = 1; + const y = 2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md index 9e0f53ebda..2619499ef9 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-single-if.expect.md @@ -47,11 +47,11 @@ function foo( ## Code ```javascript -function foo$0() { - const x$4 = 1; - const y$5 = 2; - if (y$5) { - const z$6 = x$4 + y$5; +function foo() { + const x = 1; + const y = 2; + if (y) { + const z = x + y; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md index db9dc1f77a..b19e4ccfb7 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-switch.expect.md @@ -33,7 +33,7 @@ bb0: [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive [4] Const mutate $13:TPrimitive = 1 [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive - [6] Let mutate x$21_@0[6:16] = undefined + [6] Let mutate x$0$21_@0[6:16] = undefined [6] Switch (read x$10:TPrimitive) Case read $14:TPrimitive: bb5 Case read $12:TPrimitive: bb3 @@ -42,24 +42,24 @@ bb0: bb5: predecessor blocks: bb0 [7] Const mutate $15:TPrimitive = 1 - [8] Const mutate x$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive - [9] Reassign mutate x$21_@0[6:16] = read x$16:TPrimitive + [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive + [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive [9] Goto bb1 bb3: predecessor blocks: bb0 [10] Const mutate $17:TPrimitive = 2 - [11] Const mutate x$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive - [12] Reassign mutate x$21_@0[6:16] = read x$18:TPrimitive + [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive + [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive [12] Goto bb1 bb2: predecessor blocks: bb0 [13] Const mutate $19:TPrimitive = 3 - [14] Const mutate x$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive - [15] Reassign mutate x$21_@0[6:16] = read x$20:TPrimitive + [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive + [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive [15] Goto bb1 bb1: predecessor blocks: bb5 bb3 bb2 - [16] Const mutate y$22 = read x$21_@0 + [16] Const mutate y$22 = read x$0$21_@0 [17] Return ``` @@ -73,29 +73,29 @@ function foo( [3] Const mutate $12:TPrimitive = Binary read x$10:TPrimitive === read $11:TPrimitive [4] Const mutate $13:TPrimitive = 1 [5] Const mutate $14:TPrimitive = Binary read x$10:TPrimitive === read $13:TPrimitive - scope @0 [6:16] deps=[] out=[x$21_@0] { - [6] Let mutate x$21_@0[6:16] = undefined + scope @0 [6:16] deps=[] out=[x$0$21_@0] { + [6] Let mutate x$0$21_@0[6:16] = undefined switch (read x$10:TPrimitive) { case read $14:TPrimitive: { [7] Const mutate $15:TPrimitive = 1 - [8] Const mutate x$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive - [9] Reassign mutate x$21_@0[6:16] = read x$16:TPrimitive + [8] Const mutate x$1$16:TPrimitive = Binary read x$10:TPrimitive + read $15:TPrimitive + [9] Reassign mutate x$0$21_@0[6:16] = read x$1$16:TPrimitive break bb1 } case read $12:TPrimitive: { [10] Const mutate $17:TPrimitive = 2 - [11] Const mutate x$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive - [12] Reassign mutate x$21_@0[6:16] = read x$18:TPrimitive + [11] Const mutate x$2$18:TPrimitive = Binary read x$10:TPrimitive + read $17:TPrimitive + [12] Reassign mutate x$0$21_@0[6:16] = read x$2$18:TPrimitive break bb1 } default: { [13] Const mutate $19:TPrimitive = 3 - [14] Const mutate x$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive - [15] Reassign mutate x$21_@0[6:16] = read x$20:TPrimitive + [14] Const mutate x$3$20:TPrimitive = Binary read x$10:TPrimitive + read $19:TPrimitive + [15] Reassign mutate x$0$21_@0[6:16] = read x$3$20:TPrimitive } } } - [16] Const mutate y$22 = read x$21_@0 + [16] Const mutate y$22 = read x$0$21_@0 return } @@ -104,38 +104,38 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$10 = 1; - let x$21; + const x = 1; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$21 = undefined; + x$0 = undefined; - bb1: switch (x$10) { - case x$10 === 1: { - const x$16 = x$10 + 1; - x$21 = x$16; + bb1: switch (x) { + case x === 1: { + const x$1 = x + 1; + x$0 = x$1; break bb1; } - case x$10 === 2: { - const x$18 = x$10 + 2; - x$21 = x$18; + case x === 2: { + const x$2 = x + 2; + x$0 = x$2; break bb1; } default: { - const x$20 = x$10 + 3; - x$21 = x$20; + const x$3 = x + 3; + x$0 = x$3; } } - $[0] = x$21; + $[0] = x$0; } else { - x$21 = $[0]; + x$0 = $[0]; } - const y$22 = x$21; + const y = x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md index 4c902808d7..0583161d7a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-throw.expect.md @@ -19,16 +19,16 @@ bb0: [1] Const mutate x$4:TPrimitive = 1 [2] Const mutate $5:TPrimitive = 1 [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - [4] Let mutate x$8_@0[1:7] = read x$4:TPrimitive + [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive [4] If (read $6:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Const mutate x$7:TPrimitive = 2 - [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive + [5] Const mutate x$1$7:TPrimitive = 2 + [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Throw read x$8_@0 + [7] Throw read x$0$8_@0 ``` ## Reactive Scopes @@ -39,14 +39,14 @@ function foo( [1] Const mutate x$4:TPrimitive = 1 [2] Const mutate $5:TPrimitive = 1 [3] Const mutate $6:TPrimitive = Binary read x$4:TPrimitive === read $5:TPrimitive - scope @0 [1:7] deps=[] out=[x$8_@0] { - [4] Let mutate x$8_@0[1:7] = read x$4:TPrimitive + scope @0 [1:7] deps=[] out=[x$0$8_@0] { + [4] Let mutate x$0$8_@0[1:7] = read x$4:TPrimitive if (read $6:TPrimitive) { - [5] Const mutate x$7:TPrimitive = 2 - [6] Reassign mutate x$8_@0[1:7] = read x$7:TPrimitive + [5] Const mutate x$1$7:TPrimitive = 2 + [6] Reassign mutate x$0$8_@0[1:7] = read x$1$7:TPrimitive } } - throw read x$8_@0 + throw read x$0$8_@0 } ``` @@ -54,24 +54,24 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - const x$4 = 1; - let x$8; + const x = 1; + let x$0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$8 = x$4; + x$0 = x; - if (x$4 === 1) { - const x$7 = 2; - x$8 = x$7; + if (x === 1) { + const x$1 = 2; + x$0 = x$1; } - $[0] = x$8; + $[0] = x$0; } else { - x$8 = $[0]; + x$0 = $[0]; } - throw x$8; + throw x$0; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md index 46eb7778de..58008a3ad1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-while-no-reassign.expect.md @@ -56,13 +56,13 @@ function foo( ## Code ```javascript -function foo$0() { - const x$5 = 1; - while (x$5 < 10) { - x$5 + 1; +function foo() { + const x = 1; + while (x < 10) { + x + 1; } - return x$5; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md index 64f04e3ee5..e90c59d658 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/ssa-while.expect.md @@ -58,22 +58,22 @@ function foo( ## Code ```javascript -function foo$0() { +function foo() { const $ = React.useMemoCache(); - let x$5; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$5 = 1; + x = 1; - while (x$5 < 10) { - x$5 = x$5 + 1; + while (x < 10) { + x = x + 1; } - $[0] = x$5; + $[0] = x; } else { - x$5 = $[0]; + x = $[0]; } - return x$5; + return x; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md index 9fa08b42e5..ec5464ca79 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md @@ -37,7 +37,7 @@ bb0: [3] Const mutate $12:TPrimitive = false [4] Const mutate $13:TPrimitive = true [5] Const mutate $14:TPrimitive = 1 - [6] Let mutate y$20_@1[1:12] = read y$11:TPrimitive + [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive [6] Switch (read props$9.p0) Case read $14:TPrimitive: bb1 Case read $13:TPrimitive: bb6 @@ -47,19 +47,19 @@ bb0: bb6: predecessor blocks: bb0 [7] Call mutate x$10_@1.push(read props$9.p2) - [8] Const mutate y$15_@2 = Array [] - [9] Reassign mutate y$20_@1[1:12] = read y$15_@2 + [8] Const mutate y$1$15_@2 = Array [] + [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2 [9] Goto bb1 bb2: predecessor blocks: bb0 - [10] Const mutate y$16 = read x$10_@1 - [11] Reassign mutate y$20_@1[1:12] = read y$16 + [10] Const mutate y$2$16 = read x$10_@1 + [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16 [11] Goto bb1 bb1: predecessor blocks: bb0 bb6 bb2 [12] Const mutate child$19_@3 = JSX - [13] Call read y$20_@1.push(read props$9.p4) - [14] Const mutate t8$22_@4 = JSX {read child$19_@3} + [13] Call read y$0$20_@1.push(read props$9.p4) + [14] Const mutate t8$22_@4 = JSX {read child$19_@3} [15] Return read t8$22_@4 ``` @@ -75,34 +75,34 @@ function Component( [3] Const mutate $12:TPrimitive = false [4] Const mutate $13:TPrimitive = true [5] Const mutate $14:TPrimitive = 1 - [6] Let mutate y$20_@1[1:12] = read y$11:TPrimitive + [6] Let mutate y$0$20_@1[1:12] = read y$11:TPrimitive switch (read props$9.p0) { case read $14:TPrimitive: { break bb1 } case read $13:TPrimitive: { [7] Call mutate x$10_@1.push(read props$9.p2) - scope @2 [8:9] deps=[] out=[y$15_@2] { - [8] Const mutate y$15_@2 = Array [] + scope @2 [8:9] deps=[] out=[y$1$15_@2] { + [8] Const mutate y$1$15_@2 = Array [] } - [9] Reassign mutate y$20_@1[1:12] = read y$15_@2 + [9] Reassign mutate y$0$20_@1[1:12] = read y$1$15_@2 break bb1 } default: { break bb1 } case read $12:TPrimitive: { - [10] Const mutate y$16 = read x$10_@1 - [11] Reassign mutate y$20_@1[1:12] = read y$16 + [10] Const mutate y$2$16 = read x$10_@1 + [11] Reassign mutate y$0$20_@1[1:12] = read y$2$16 } } } scope @3 [12:13] deps=[freeze x$10_@1] out=[child$19_@3] { [12] Const mutate child$19_@3 = JSX } - [13] Call read y$20_@1.push(read props$9.p4) - scope @4 [14:15] deps=[freeze y$20_@1, read child$19_@3] out=[$22_@4] { - [14] Const mutate $22_@4 = JSX {read child$19_@3} + [13] Call read y$0$20_@1.push(read props$9.p4) + scope @4 [14:15] deps=[freeze y$0$20_@1, read child$19_@3] out=[$22_@4] { + [14] Const mutate $22_@4 = JSX {read child$19_@3} } return read $22_@4 } @@ -112,33 +112,33 @@ function Component( ## Code ```javascript -function Component$0(props$9) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$9.p0; - const c_1 = $[1] !== props$9.p2; - let x$10; + const c_0 = $[0] !== props.p0; + const c_1 = $[1] !== props.p2; + let x; if (c_0 || c_1) { - x$10 = []; - const y$11 = undefined; - let y$20 = y$11; + x = []; + const y = undefined; + let y$0 = y; - bb1: switch (props$9.p0) { + bb1: switch (props.p0) { case 1: { break bb1; } case true: { - x$10.push(props$9.p2); - let y$15; + x.push(props.p2); + let y$1; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { - y$15 = []; - $[3] = y$15; + y$1 = []; + $[3] = y$1; } else { - y$15 = $[3]; + y$1 = $[3]; } - y$20 = y$15; + y$0 = y$1; break bb1; } @@ -147,44 +147,44 @@ function Component$0(props$9) { } case false: { - const y$16 = x$10; - y$20 = y$16; + const y$2 = x; + y$0 = y$2; } } - $[0] = props$9.p0; - $[1] = props$9.p2; - $[2] = x$10; + $[0] = props.p0; + $[1] = props.p2; + $[2] = x; } else { - x$10 = $[2]; + x = $[2]; } - const c_4 = $[4] !== x$10; - let child$19; + const c_4 = $[4] !== x; + let child; if (c_4) { - child$19 = ; - $[4] = x$10; - $[5] = child$19; + child = ; + $[4] = x; + $[5] = child; } else { - child$19 = $[5]; + child = $[5]; } - y$20.push(props$9.p4); - const c_6 = $[6] !== y$20; - const c_7 = $[7] !== child$19; - let t8$22; + y$0.push(props.p4); + const c_6 = $[6] !== y$0; + const c_7 = $[7] !== child; + let t8; if (c_6 || c_7) { - t8$22 = {child$19}; - $[6] = y$20; - $[7] = child$19; - $[8] = t8$22; + t8 = {child}; + $[6] = y$0; + $[7] = child; + $[8] = t8; } else { - t8$22 = $[8]; + t8 = $[8]; } - return t8$22; + return t8; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md index 558cd7ae94..cf42c9da17 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-with-fallthrough.expect.md @@ -54,27 +54,27 @@ bb0: Fallthrough: bb1 bb10: predecessor blocks: bb0 - [9] Const mutate y$17:TPrimitive = 0 + [9] Const mutate y$0$17:TPrimitive = 0 [10] Goto bb9 bb9: predecessor blocks: bb10 bb0 - [11] Const mutate y$18:TPrimitive = 1 + [11] Const mutate y$1$18:TPrimitive = 1 [12] Goto bb1 bb5: predecessor blocks: bb0 - [13] Const mutate y$19:TPrimitive = 3 + [13] Const mutate y$2$19:TPrimitive = 3 [14] Goto bb1 bb4: predecessor blocks: bb0 - [15] Const mutate y$20:TPrimitive = 4 + [15] Const mutate y$3$20:TPrimitive = 4 [16] Goto bb3 bb3: predecessor blocks: bb4 bb0 - [17] Const mutate y$21:TPrimitive = 5 + [17] Const mutate y$4$21:TPrimitive = 5 [18] Goto bb2 bb2: predecessor blocks: bb3 bb0 - [19] Const mutate y$22:TPrimitive = 0 + [19] Const mutate y$5$22:TPrimitive = 0 [20] Goto bb1 bb1: predecessor blocks: bb9 bb0 bb5 bb2 @@ -96,27 +96,27 @@ function foo( [7] Const mutate $16:TPrimitive = 0 switch (read x$9) { case read $16:TPrimitive: { - [9] Const mutate y$17:TPrimitive = 0 + [9] Const mutate y$0$17:TPrimitive = 0 } case read $15:TPrimitive: { - [11] Const mutate y$18:TPrimitive = 1 + [11] Const mutate y$1$18:TPrimitive = 1 break bb1 } case read $14:TPrimitive: { break bb1 } case read $13:TPrimitive: { - [13] Const mutate y$19:TPrimitive = 3 + [13] Const mutate y$2$19:TPrimitive = 3 break bb1 } case read $12:TPrimitive: { - [15] Const mutate y$20:TPrimitive = 4 + [15] Const mutate y$3$20:TPrimitive = 4 } case read $11:TPrimitive: { - [17] Const mutate y$21:TPrimitive = 5 + [17] Const mutate y$4$21:TPrimitive = 5 } default: { - [19] Const mutate y$22:TPrimitive = 0 + [19] Const mutate y$5$22:TPrimitive = 0 } } return @@ -127,15 +127,15 @@ function foo( ## Code ```javascript -function foo$0(x$9) { - const y$10 = undefined; - bb1: switch (x$9) { +function foo(x) { + const y = undefined; + bb1: switch (x) { case 0: { - const y$17 = 0; + const y$0 = 0; } case 1: { - const y$18 = 1; + const y$1 = 1; break bb1; } @@ -144,20 +144,20 @@ function foo$0(x$9) { } case 3: { - const y$19 = 3; + const y$2 = 3; break bb1; } case 4: { - const y$20 = 4; + const y$3 = 4; } case 5: { - const y$21 = 5; + const y$4 = 5; } default: { - const y$22 = 0; + const y$5 = 0; } } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md index 78d444c1c4..efcd01c369 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md @@ -31,7 +31,7 @@ bb0: [2] Const mutate y$10:TPrimitive = undefined [3] Const mutate $11:TPrimitive = false [4] Const mutate $12:TPrimitive = true - [5] Let mutate y$20_@1[1:12] = read y$10:TPrimitive + [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive [5] Switch (read props$8.p0) Case read $12:TPrimitive: bb4 Case read $11:TPrimitive: bb2 @@ -41,18 +41,18 @@ bb4: predecessor blocks: bb0 [6] Call mutate x$9_@1.push(read props$8.p2) [7] Call mutate x$9_@1.push(read props$8.p3) - [8] Const mutate y$13_@2 = Array [] + [8] Const mutate y$1$13_@2 = Array [] [9] Goto bb2 bb2: predecessor blocks: bb4 bb0 - [10] Const mutate y$15 = read x$9_@1 - [11] Reassign mutate y$20_@1[1:12] = read y$15 + [10] Const mutate y$2$15 = read x$9_@1 + [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15 [11] Goto bb1 bb1: predecessor blocks: bb2 bb0 [12] Const mutate child$19_@3 = JSX - [13] Call read y$20_@1.push(read props$8.p4) - [14] Const mutate t8$23_@4 = JSX {read child$19_@3} + [13] Call read y$0$20_@1.push(read props$8.p4) + [14] Const mutate t8$23_@4 = JSX {read child$19_@3} [15] Return read t8$23_@4 ``` @@ -67,25 +67,25 @@ function Component( [2] Const mutate y$10:TPrimitive = undefined [3] Const mutate $11:TPrimitive = false [4] Const mutate $12:TPrimitive = true - [5] Let mutate y$20_@1[1:12] = read y$10:TPrimitive + [5] Let mutate y$0$20_@1[1:12] = read y$10:TPrimitive switch (read props$8.p0) { case read $12:TPrimitive: { [6] Call mutate x$9_@1.push(read props$8.p2) [7] Call mutate x$9_@1.push(read props$8.p3) - [8] Const mutate y$13_@2 = Array [] + [8] Const mutate y$1$13_@2 = Array [] } case read $11:TPrimitive: { - [10] Const mutate y$15 = read x$9_@1 - [11] Reassign mutate y$20_@1[1:12] = read y$15 + [10] Const mutate y$2$15 = read x$9_@1 + [11] Reassign mutate y$0$20_@1[1:12] = read y$2$15 } } } scope @3 [12:13] deps=[freeze x$9_@1] out=[child$19_@3] { [12] Const mutate child$19_@3 = JSX } - [13] Call read y$20_@1.push(read props$8.p4) - scope @4 [14:15] deps=[read y$20_@1, read child$19_@3] out=[$23_@4] { - [14] Const mutate $23_@4 = JSX {read child$19_@3} + [13] Call read y$0$20_@1.push(read props$8.p4) + scope @4 [14:15] deps=[read y$0$20_@1, read child$19_@3] out=[$23_@4] { + [14] Const mutate $23_@4 = JSX {read child$19_@3} } return read $23_@4 } @@ -95,64 +95,64 @@ function Component( ## Code ```javascript -function Component$0(props$8) { +function Component(props) { const $ = React.useMemoCache(); - const c_0 = $[0] !== props$8.p0; - const c_1 = $[1] !== props$8.p2; - const c_2 = $[2] !== props$8.p3; - let x$9; + const c_0 = $[0] !== props.p0; + const c_1 = $[1] !== props.p2; + const c_2 = $[2] !== props.p3; + let x; if (c_0 || c_1 || c_2) { - x$9 = []; - const y$10 = undefined; - let y$20 = y$10; + x = []; + const y = undefined; + let y$0 = y; - switch (props$8.p0) { + switch (props.p0) { case true: { - x$9.push(props$8.p2); - x$9.push(props$8.p3); - const y$13 = []; + x.push(props.p2); + x.push(props.p3); + const y$1 = []; } case false: { - const y$15 = x$9; - y$20 = y$15; + const y$2 = x; + y$0 = y$2; } } - $[0] = props$8.p0; - $[1] = props$8.p2; - $[2] = props$8.p3; - $[3] = x$9; + $[0] = props.p0; + $[1] = props.p2; + $[2] = props.p3; + $[3] = x; } else { - x$9 = $[3]; + x = $[3]; } - const c_4 = $[4] !== x$9; - let child$19; + const c_4 = $[4] !== x; + let child; if (c_4) { - child$19 = ; - $[4] = x$9; - $[5] = child$19; + child = ; + $[4] = x; + $[5] = child; } else { - child$19 = $[5]; + child = $[5]; } - y$20.push(props$8.p4); - const c_6 = $[6] !== y$20; - const c_7 = $[7] !== child$19; - let t8$23; + y$0.push(props.p4); + const c_6 = $[6] !== y$0; + const c_7 = $[7] !== child; + let t8; if (c_6 || c_7) { - t8$23 = {child$19}; - $[6] = y$20; - $[7] = child$19; - $[8] = t8$23; + t8 = {child}; + $[6] = y$0; + $[7] = child; + $[8] = t8; } else { - t8$23 = $[8]; + t8 = $[8]; } - return t8$23; + return t8; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md index 6d64e5d287..66cc11bd6a 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/transitive-alias-fields.expect.md @@ -53,15 +53,15 @@ function component( ## Code ```javascript -function component$0() { - const x$6 = {}; - const p$7 = {}; - const q$8 = {}; - const y$9 = {}; - x$6.y = y$9; - p$7.y = x$6.y; - q$8.y = p$7.y; - mutate$5(q$8); +function component() { + const x = {}; + const p = {}; + const q = {}; + const y = {}; + x.y = y; + p.y = x.y; + q.y = p.y; + mutate(q); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md index 5828952e8c..52daf83ed3 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-args-test-binary-operator.expect.md @@ -44,9 +44,9 @@ function component( ## Code ```javascript -function component$0(a$5, b$6) { - if (a$5 > b$6) { - const m$8 = {}; +function component(a, b) { + if (a > b) { + const m = {}; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md index 4defdc8da4..b1ef3ccee2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-binary-operator.expect.md @@ -52,27 +52,27 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let a$7; + let a; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - a$7 = some$1(); - $[0] = a$7; + a = some(); + $[0] = a; } else { - a$7 = $[0]; + a = $[0]; } - let b$8; + let b; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - b$8 = someOther$3(); - $[1] = b$8; + b = someOther(); + $[1] = b; } else { - b$8 = $[1]; + b = $[1]; } - if (a$7 > b$8) { - const m$10 = {}; + if (a > b) { + const m = {}; } } diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md index 0ca6d71b05..77d7817aae 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-field-load.expect.md @@ -37,19 +37,19 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let x$5; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$5 = { + x = { t: 1, }; - $[0] = x$5; + $[0] = x; } else { - x$5 = $[0]; + x = $[0]; } - const p$6 = x$5.t; + const p = x.t; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md index 46c1032f52..ca714bfe91 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-load-binary-op.expect.md @@ -62,49 +62,49 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let t0$10; + let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0$10 = makeSomePrimitive$1(); - $[0] = t0$10; + t0 = makeSomePrimitive(); + $[0] = t0; } else { - t0$10 = $[0]; + t0 = $[0]; } - let t1$11; + let t1; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - t1$11 = makeSomePrimitive$1(); - $[1] = t1$11; + t1 = makeSomePrimitive(); + $[1] = t1; } else { - t1$11 = $[1]; + t1 = $[1]; } - const c_2 = $[2] !== t0$10; - const c_3 = $[3] !== t1$11; - let x$12; + const c_2 = $[2] !== t0; + const c_3 = $[3] !== t1; + let x; if (c_2 || c_3) { - x$12 = { - u: t0$10, - v: t1$11, + x = { + u: t0, + v: t1, }; - $[2] = t0$10; - $[3] = t1$11; - $[4] = x$12; + $[2] = t0; + $[3] = t1; + $[4] = x; } else { - x$12 = $[4]; + x = $[4]; } - const u$13 = x$12.u; - const v$14 = x$12.v; + const u = x.u; + const v = x.v; - if (u$13 > v$14) { + if (u > v) { } - const y$16 = x$12.u; - const z$17 = x$12.v; + const y = x.u; + const z = x.v; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md index 6166f1f1d5..d39c486c66 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-field-store.expect.md @@ -43,27 +43,27 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let x$4; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$4 = {}; - let q$5; + x = {}; + let q; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - q$5 = {}; - $[1] = q$5; + q = {}; + $[1] = q; } else { - q$5 = $[1]; + q = $[1]; } - x$4.t = q$5; - $[0] = x$4; + x.t = q; + $[0] = x; } else { - x$4 = $[0]; + x = $[0]; } - const z$6 = x$4.t; + const z = x.t; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md index e9f636e992..9f7f44bce2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-polymorphic.expect.md @@ -60,43 +60,43 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let p$7; + let p; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - p$7 = makePrimitive$1(); - $[0] = p$7; + p = makePrimitive(); + $[0] = p; } else { - p$7 = $[0]; + p = $[0]; } - p$7 + p$7; - let o$8; + p + p; + let o; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - o$8 = {}; - $[1] = o$8; + o = {}; + $[1] = o; } else { - o$8 = $[1]; + o = $[1]; } - const c_2 = $[2] !== p$7; - const c_3 = $[3] !== o$8; - let x$9; + const c_2 = $[2] !== p; + const c_3 = $[3] !== o; + let x; if (c_2 || c_3) { - x$9 = {}; - x$9.t = p$7; - const z$10 = x$9.t; - x$9.t = o$8; - $[2] = p$7; - $[3] = o$8; - $[4] = x$9; + x = {}; + x.t = p; + const z = x.t; + x.t = o; + $[2] = p; + $[3] = o; + $[4] = x; } else { - x$9 = $[4]; + x = $[4]; } - const y$11 = x$9.t; + const y = x.t; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md index d90abcedcb..e9cf4c3e73 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-primitive.expect.md @@ -33,9 +33,9 @@ function component( ## Code ```javascript -function component$0() { - const x$3 = 1; - const y$4 = 2; +function component() { + const x = 1; + const y = 2; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md index 38bf888b61..6e77c29d30 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md @@ -56,30 +56,30 @@ function component( ## Code ```javascript -function component$0() { +function component() { const $ = React.useMemoCache(); - let x$7; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - x$7 = foo$1(); - $[0] = x$7; + x = foo(); + $[0] = x; } else { - x$7 = $[0]; + x = $[0]; } - let y$8; + let y; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - y$8 = foo$1(); - $[1] = y$8; + y = foo(); + $[1] = y; } else { - y$8 = $[1]; + y = $[1]; } - if (x$7 > y$8) { - const z$10 = {}; + if (x > y) { + const z = {}; } - const z$12 = foo$1(); + const z = foo(); } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md index 331ae1a636..d48f04bc52 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/while-break.expect.md @@ -44,11 +44,11 @@ function foo( ## Code ```javascript -function foo$0(a$3, b$4) { - while (a$3) { +function foo(a, b) { + while (a) { break; } - return b$4; + return b; } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md index 121911b256..90d1b0c572 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/while-conditional-continue.expect.md @@ -65,15 +65,15 @@ function foo( ## Code ```javascript -function foo$0(a$5, b$6, c$7, d$8) { - while (a$5) { - if (b$6) { +function foo(a, b, c, d) { + while (a) { + if (b) { continue; } - c$7(); + c(); } - d$8(); + d(); } ``` diff --git a/compiler/forget/test262 b/compiler/forget/test262 index 920a567b72..83a46bfe0e 160000 --- a/compiler/forget/test262 +++ b/compiler/forget/test262 @@ -1 +1 @@ -Subproject commit 920a567b72433deed172180d8649df23dbca1607 +Subproject commit 83a46bfe0e79aed8274a1b9f4beb0a2efa0b3533