From 99b9da4b009b4eccda12a6546747497bcd00f5fb Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Wed, 6 Mar 2024 11:07:09 -0800 Subject: [PATCH] Move remaining promotion of temporaries out of codegen I realized that codegen still had a fallback for generating identifier nodes for unnamed temporaries. This PR updates codegen to throw if it needs to generate an identifier for a temporary, and updates earlier passes to promote temporaries to named values in all the cases that were missed: * BuildHIR needs to promote temporaries for temporaries in destructuring bindings and catch clause bindings * PromoteUsedTemporaries has to promote temporaries for destructured function parameters or function params that are context variables. --- .../src/HIR/BuildHIR.ts | 6 ++ .../ReactiveScopes/CodegenReactiveFunction.ts | 7 +- .../ReactiveScopes/PromoteUsedTemporaries.ts | 39 +++++++++-- .../compiler/array-pattern-params.expect.md | 42 +++++------ ...g.useMemo-deps-array-not-cleared.expect.md | 16 ++--- ...turing-function-member-expr-call.expect.md | 34 ++++----- ...component-declaration-basic.flow.expect.md | 14 ++-- ...e-reactive-explicit-control-flow.expect.md | 4 +- ...e-reactive-implicit-control-flow.expect.md | 4 +- ...variable-reassigned-objectmethod.expect.md | 4 +- ...able-reassigned-reactive-capture.expect.md | 4 +- ...-variable-reassigned-two-lambdas.expect.md | 4 +- ...-array-assignment-to-context-var.expect.md | 4 +- ...object-assignment-to-context-var.expect.md | 4 +- ...g-literal-key-invalid-identifier.expect.md | 4 +- ...ructure-param-string-literal-key.expect.md | 4 +- ...estructuring-array-param-default.expect.md | 6 +- .../destructuring-assignment.expect.md | 30 ++++---- ...tructuring-default-at-array-hole.expect.md | 4 +- ...cturing-default-at-explicit-null.expect.md | 4 +- ...ng-default-at-explicit-undefined.expect.md | 4 +- ...turing-default-past-end-of-array.expect.md | 4 +- ...structuring-object-param-default.expect.md | 6 +- ...g-same-property-identifier-names.expect.md | 30 ++++---- ...ith-conditional-as-default-value.expect.md | 4 +- .../fixtures/compiler/destructuring.expect.md | 28 ++++---- ...no-whitespace-btw-text-and-param.expect.md | 14 ++-- .../fbt/fbt-preserve-whitespace.expect.md | 14 ++-- ...-single-space-btw-param-and-text.expect.md | 14 ++-- ...bt-whitespace-around-param-value.expect.md | 14 ++-- .../fbt/fbt-whitespace-within-text.expect.md | 14 ++-- ...btparam-with-jsx-element-content.expect.md | 14 ++-- .../flag-enable-emit-hook-guards.expect.md | 30 ++++---- ...unction-param-assignment-pattern.expect.md | 30 ++++---- ...ing-recursive-call-within-lambda.expect.md | 22 +++--- .../hoisting-recursive-call.expect.md | 14 ++-- .../compiler/hoisting-within-lambda.expect.md | 22 +++--- ...functions-component-with-ref-arg.expect.md | 12 ++-- ...attribute-with-jsx-element-value.expect.md | 46 ++++++------ ...ute-with-jsx-fragment-value.flow.expect.md | 28 ++++---- ...local-memberexpr-tag-conditional.expect.md | 14 ++-- ...ctive-local-variable-member-expr.expect.md | 14 ++-- .../maybe-mutate-object-in-callback.expect.md | 4 +- ...ction-with-param-as-captured-dep.expect.md | 4 +- ...eral-method-call-in-ternary-test.expect.md | 4 +- ...od-derived-in-ternary-consequent.expect.md | 14 ++-- ...ral-method-in-ternary-consequent.expect.md | 14 ++-- ...t-literal-method-in-ternary-test.expect.md | 4 +- ...d-shorthand-aliased-mutate-after.expect.md | 4 +- ...t-method-shorthand-derived-value.expect.md | 30 ++++---- ...t-method-shorthand-mutated-after.expect.md | 4 +- .../compiler/object-pattern-params.expect.md | 42 +++++------ .../object-shorthand-method-1.expect.md | 28 ++++---- .../object-shorthand-method-2.expect.md | 44 ++++++------ .../object-shorthand-method-nested.expect.md | 14 ++-- ...rol-dependency-phi-setState-type.expect.md | 4 +- ...trol-dependency-switch-condition.expect.md | 14 ++-- ...-cond-deps-cfg-nested-testifelse.expect.md | 4 +- ...rrent-aliased-not-added-to-dep-2.expect.md | 34 ++++----- .../ref-current-not-added-to-dep-2.expect.md | 34 ++++----- .../repro-dce-circular-reference.expect.md | 14 ++-- ...on-from-merge-consecutive-scopes.expect.md | 32 ++++----- ...invoked-callback-escaping-return.expect.md | 70 +++++++++---------- ...ve-memoization-nonescaping-value.expect.md | 14 ++-- .../rest-param-with-array-pattern.expect.md | 14 ++-- .../rest-param-with-identifier.expect.md | 14 ++-- ...param-with-object-spread-pattern.expect.md | 14 ++-- .../allow-props-named-like-hooks.expect.md | 30 ++++---- .../try-catch-alias-try-values.expect.md | 4 +- ...value-modified-in-catch-escaping.expect.md | 4 +- ...atch-try-value-modified-in-catch.expect.md | 4 +- .../try-catch-with-catch-param.expect.md | 4 +- ...pression-on-function-parameter-1.expect.md | 18 ++--- ...pression-on-function-parameter-3.expect.md | 14 ++-- ...pression-on-function-parameter-4.expect.md | 14 ++-- ...Callback-set-ref-nested-property.expect.md | 36 +++++----- 76 files changed, 636 insertions(+), 594 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts index 325162d427..2d30eb31da 100644 --- a/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts @@ -44,6 +44,7 @@ import { Type, makeInstructionId, makeType, + promoteTemporaryToNamedIdentifier, } from "./HIR"; import HIRBuilder, { Bindings } from "./HIRBuilder"; import { BuiltInArrayId } from "./ObjectShape"; @@ -1215,6 +1216,7 @@ function lowerStatement( reactive: false, loc: handlerBindingPath.node.loc ?? GeneratedSource, }; + promoteTemporaryToNamedIdentifier(place.identifier); lowerValueToTemporary(builder, { kind: "DeclareLocal", lvalue: { @@ -3420,6 +3422,7 @@ function lowerAssignment( builder, element.node.loc ?? GeneratedSource ); + promoteTemporaryToNamedIdentifier(temp.identifier); items.push({ kind: "Spread", place: { ...temp }, @@ -3447,6 +3450,7 @@ function lowerAssignment( builder, element.node.loc ?? GeneratedSource ); + promoteTemporaryToNamedIdentifier(temp.identifier); items.push({ ...temp }); followups.push({ place: temp, path: element as NodePath }); // TODO remove type cast } @@ -3517,6 +3521,7 @@ function lowerAssignment( builder, property.node.loc ?? GeneratedSource ); + promoteTemporaryToNamedIdentifier(temp.identifier); properties.push({ kind: "Spread", place: { ...temp }, @@ -3597,6 +3602,7 @@ function lowerAssignment( builder, element.node.loc ?? GeneratedSource ); + promoteTemporaryToNamedIdentifier(temp.identifier); properties.push({ kind: "ObjectProperty", type: "property", diff --git a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts index 49bd7a276a..802e190d1d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -2013,5 +2013,10 @@ function convertIdentifier(identifier: Identifier): t.Identifier { if (identifier.name !== null) { return t.identifier(identifier.name.value); } - return t.identifier(`t${identifier.id}`); + CompilerError.invariant(false, { + reason: `Expected temporaries to be promoted to named identifiers in an earlier pass`, + loc: GeneratedSource, + description: `identifier ${identifier.id} is unnamed`, + suggestions: null, + }); } diff --git a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PromoteUsedTemporaries.ts b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PromoteUsedTemporaries.ts index f83e5e8b40..81b6be49d6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PromoteUsedTemporaries.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PromoteUsedTemporaries.ts @@ -11,8 +11,8 @@ import { Identifier, IdentifierId, InstructionId, + Place, ReactiveFunction, - ReactiveInstruction, ReactiveScopeBlock, ReactiveValue, promoteTemporaryJsxTagToNamedIdentifier, @@ -45,11 +45,36 @@ class Visitor extends ReactiveFunctionVisitor { } } } - override visitInstruction( - instruction: ReactiveInstruction, + + override visitValue( + id: InstructionId, + value: ReactiveValue, state: VisitorState ): void { - this.traverseInstruction(instruction, state); + this.traverseValue(id, value, state); + if (value.kind === "FunctionExpression" || value.kind === "ObjectMethod") { + for (const operand of value.loweredFunc.func.params) { + const place = operand.kind === "Identifier" ? operand : operand.place; + if (place.identifier.name === null) { + promoteTemporary(place.identifier, state); + } + } + } + } + + override visitReactiveFunctionValue( + _id: InstructionId, + _dependencies: Place[], + fn: ReactiveFunction, + state: VisitorState + ): void { + for (const operand of fn.params) { + const place = operand.kind === "Identifier" ? operand : operand.place; + if (place.identifier.name === null) { + promoteTemporary(place.identifier, state); + } + } + visitReactiveFunction(fn, this, state); } } @@ -73,6 +98,12 @@ export function promoteUsedTemporaries(fn: ReactiveFunction): void { const state: VisitorState = { tags, }; + for (const operand of fn.params) { + const place = operand.kind === "Identifier" ? operand : operand.place; + if (place.identifier.name === null) { + promoteTemporary(place.identifier, state); + } + } visitReactiveFunction(fn, new Visitor(), state); } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md index cd722d1df2..2ff833d1b1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md @@ -20,37 +20,37 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function component(t16) { +function component(t0) { const $ = useMemoCache(7); - const [a, b] = t16; - let t0; - if ($[0] !== a) { - t0 = { a }; - $[0] = a; - $[1] = t0; - } else { - t0 = $[1]; - } - const y = t0; + const [a, b] = t0; let t1; - if ($[2] !== b) { - t1 = { b }; - $[2] = b; - $[3] = t1; + if ($[0] !== a) { + t1 = { a }; + $[0] = a; + $[1] = t1; } else { - t1 = $[3]; + t1 = $[1]; } - const z = t1; + const y = t1; let t2; + if ($[2] !== b) { + t2 = { b }; + $[2] = b; + $[3] = t2; + } else { + t2 = $[3]; + } + const z = t2; + let t3; if ($[4] !== y || $[5] !== z) { - t2 = [y, z]; + t3 = [y, z]; $[4] = y; $[5] = z; - $[6] = t2; + $[6] = t3; } else { - t2 = $[6]; + t3 = $[6]; } - return t2; + return t3; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug.useMemo-deps-array-not-cleared.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug.useMemo-deps-array-not-cleared.expect.md index 7231221e31..efaf98237a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug.useMemo-deps-array-not-cleared.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug.useMemo-deps-array-not-cleared.expect.md @@ -24,22 +24,22 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function App(t25) { +function App(t0) { const $ = useMemoCache(2); - const { text, hasDeps } = t25; + const { text, hasDeps } = t0; hasDeps ? null : [text]; - let t0; let t1; + let t2; if ($[0] !== text) { - t1 = text.toUpperCase(); + t2 = text.toUpperCase(); $[0] = text; - $[1] = t1; + $[1] = t2; } else { - t1 = $[1]; + t2 = $[1]; } - t0 = t1; - const resolvedText = t0; + t1 = t2; + const resolvedText = t1; return resolvedText; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md index c6a0e93ff2..498b83ccbb 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md @@ -20,41 +20,41 @@ function component({ mutator }) { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function component(t26) { +function component(t0) { const $ = useMemoCache(7); - const { mutator } = t26; - let t0; + const { mutator } = t0; + let t1; if ($[0] !== mutator) { - t0 = () => { + t1 = () => { mutator.poke(); }; $[0] = mutator; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - const poke = t0; - let t1; + const poke = t1; + let t2; if ($[2] !== mutator.user) { - t1 = () => { + t2 = () => { mutator.user.hide(); }; $[2] = mutator.user; - $[3] = t1; + $[3] = t2; } else { - t1 = $[3]; + t2 = $[3]; } - const hide = t1; - let t2; + const hide = t2; + let t3; if ($[4] !== poke || $[5] !== hide) { - t2 = ; + t3 = ; $[4] = poke; $[5] = hide; - $[6] = t2; + $[6] = t3; } else { - t2 = $[6]; + t3 = $[6]; } - return t2; + return t3; } ``` diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component-declaration-basic.flow.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component-declaration-basic.flow.expect.md index dd0f79f6ab..bda2b42b63 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component-declaration-basic.flow.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component-declaration-basic.flow.expect.md @@ -14,18 +14,18 @@ function shouldNotCompile() {} ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -export default function Foo(t7) { +export default function Foo(t0) { const $ = useMemoCache(2); - const { bar } = t7; - let t0; + const { bar } = t0; + let t1; if ($[0] !== bar) { - t0 = ; + t1 = ; $[0] = bar; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } function shouldNotCompile() {} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-explicit-control-flow.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-explicit-control-flow.expect.md index 8a3e2afa4e..52f827f84b 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-explicit-control-flow.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-explicit-control-flow.expect.md @@ -29,9 +29,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { invoke } from "shared-runtime"; -function Component(t21) { +function Component(t0) { const $ = useMemoCache(2); - const { shouldReassign } = t21; + const { shouldReassign } = t0; let x; if ($[0] !== shouldReassign) { x = null; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-implicit-control-flow.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-implicit-control-flow.expect.md index 77fe2dc28f..c740abf62e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-implicit-control-flow.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reactive-implicit-control-flow.expect.md @@ -33,9 +33,9 @@ import { conditionalInvoke } from "shared-runtime"; // same as context-variable-reactive-explicit-control-flow.js, but make // the control flow implicit -function Component(t20) { +function Component(t0) { const $ = useMemoCache(2); - const { shouldReassign } = t20; + const { shouldReassign } = t0; let x; if ($[0] !== shouldReassign) { x = null; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-objectmethod.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-objectmethod.expect.md index f0291aa32b..18fbaeb87a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-objectmethod.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-objectmethod.expect.md @@ -30,9 +30,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { invoke } from "shared-runtime"; -function Component(t24) { +function Component(t0) { const $ = useMemoCache(2); - const { cond } = t24; + const { cond } = t0; let x; if ($[0] !== cond) { x = 2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-reactive-capture.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-reactive-capture.expect.md index 9bf4d59fc4..cb1086644b 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-reactive-capture.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-reactive-capture.expect.md @@ -27,9 +27,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { invoke } from "shared-runtime"; -function Component(t20) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t20; + const { value } = t0; let x; if ($[0] !== value) { x = null; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-two-lambdas.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-two-lambdas.expect.md index e76b34b4bf..6596258601 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-two-lambdas.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/context-variable-reassigned-two-lambdas.expect.md @@ -35,9 +35,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { conditionalInvoke } from "shared-runtime"; -function Component(t32) { +function Component(t0) { const $ = useMemoCache(3); - const { doReassign1, doReassign2 } = t32; + const { doReassign1, doReassign2 } = t0; let x; if ($[0] !== doReassign1 || $[1] !== doReassign2) { x = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-array-assignment-to-context-var.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-array-assignment-to-context-var.expect.md index 4d9cde1765..3640024501 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-array-assignment-to-context-var.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-array-assignment-to-context-var.expect.md @@ -31,8 +31,8 @@ function Component(props) { const $ = useMemoCache(4); let x; if ($[0] !== props.value) { - const [t31] = props.value; - x = t31; + const [t0] = props.value; + x = t0; const foo = () => { x = identity(props.value[0]); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-object-assignment-to-context-var.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-object-assignment-to-context-var.expect.md index ff66a37223..a5434e1440 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-object-assignment-to-context-var.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-object-assignment-to-context-var.expect.md @@ -31,8 +31,8 @@ function Component(props) { const $ = useMemoCache(4); let x; if ($[0] !== props) { - const { x: t27 } = props; - x = t27; + const { x: t0 } = props; + x = t0; const foo = () => { x = identity(props.x); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key-invalid-identifier.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key-invalid-identifier.expect.md index 84f0b5cdf0..d4b16fda13 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key-invalid-identifier.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key-invalid-identifier.expect.md @@ -17,8 +17,8 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -function foo(t5) { - const { "data-foo-bar": dataTestID } = t5; +function foo(t0) { + const { "data-foo-bar": dataTestID } = t0; return dataTestID; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.expect.md index fd2fa66c61..200e624709 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-param-string-literal-key.expect.md @@ -17,8 +17,8 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -function foo(t5) { - const { data: dataTestID } = t5; +function foo(t0) { + const { data: dataTestID } = t0; return dataTestID; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-param-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-param-default.expect.md index 21791eea3c..e5c80a53b1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-param-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-param-default.expect.md @@ -17,9 +17,9 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -function Component(t13) { - const [t14] = t13; - const a = t14 === undefined ? 2 : t14; +function Component(t0) { + const [t1] = t0; + const a = t1 === undefined ? 2 : t1; return a; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md index 7b93e9b33a..8e3e09fe58 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md @@ -39,28 +39,28 @@ function foo(a, b, c) { let g; let n; let o; - const [t49, t50] = a; - d = t49; - const [t54] = t50; - const { e: t56 } = t54; - ({ f: g } = t56); - const { l: t61, o: t62 } = b; - const { m: t64 } = t61; - const [t66] = t64; - [n] = t66; - o = t62; - let t0; + const [t0, t1] = a; + d = t0; + const [t2] = t1; + const { e: t3 } = t2; + ({ f: g } = t3); + const { l: t4, o: t5 } = b; + const { m: t6 } = t4; + const [t7] = t6; + [n] = t7; + o = t5; + let t8; if ($[0] !== d || $[1] !== g || $[2] !== n || $[3] !== o) { - t0 = { d, g, n, o }; + t8 = { d, g, n, o }; $[0] = d; $[1] = g; $[2] = n; $[3] = o; - $[4] = t0; + $[4] = t8; } else { - t0 = $[4]; + t8 = $[4]; } - return t0; + return t8; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-array-hole.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-array-hole.expect.md index dfbde95cb6..28454b1d95 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-array-hole.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-array-hole.expect.md @@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = { ```javascript function Component(props) { - const [t18] = props.value; - const x = t18 === undefined ? 42 : t18; + const [t0] = props.value; + const x = t0 === undefined ? 42 : t0; return x; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-null.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-null.expect.md index 5e83e28cc4..b1a9f9f12c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-null.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-null.expect.md @@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = { ```javascript function Component(props) { - const [t18] = props.value; - const x = t18 === undefined ? 42 : t18; + const [t0] = props.value; + const x = t0 === undefined ? 42 : t0; return x; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-undefined.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-undefined.expect.md index 6f81cd8f6e..07e4603fc8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-undefined.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-at-explicit-undefined.expect.md @@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = { ```javascript function Component(props) { - const [t18] = props.value; - const x = t18 === undefined ? 42 : t18; + const [t0] = props.value; + const x = t0 === undefined ? 42 : t0; return x; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-past-end-of-array.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-past-end-of-array.expect.md index 56bdf0231c..1b7ceacfcb 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-past-end-of-array.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-default-past-end-of-array.expect.md @@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = { ```javascript function Component(props) { - const [t18] = props.value; - const x = t18 === undefined ? 42 : t18; + const [t0] = props.value; + const x = t0 === undefined ? 42 : t0; return x; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-param-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-param-default.expect.md index 71182450f7..48a22e9dd2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-param-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-param-default.expect.md @@ -17,9 +17,9 @@ export const FIXTURE_ENTRYPOINT = { ## Code ```javascript -function Component(t13) { - const { a: t14 } = t13; - const a = t14 === undefined ? 2 : t14; +function Component(t0) { + const { a: t1 } = t0; + const a = t1 === undefined ? 2 : t1; return a; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md index 0420336a68..481cc7a191 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md @@ -29,27 +29,27 @@ import { identity } from "shared-runtime"; function Component(props) { const $ = useMemoCache(5); - const { x: t18, sameName: renamed } = props; - const { destructured } = t18; - let t0; - if ($[0] !== destructured) { - t0 = identity(destructured); - $[0] = destructured; - $[1] = t0; - } else { - t0 = $[1]; - } - const sameName = t0; + const { x: t0, sameName: renamed } = props; + const { destructured } = t0; let t1; + if ($[0] !== destructured) { + t1 = identity(destructured); + $[0] = destructured; + $[1] = t1; + } else { + t1 = $[1]; + } + const sameName = t1; + let t2; if ($[2] !== sameName || $[3] !== renamed) { - t1 = [sameName, renamed]; + t2 = [sameName, renamed]; $[2] = sameName; $[3] = renamed; - $[4] = t1; + $[4] = t2; } else { - t1 = $[4]; + t2 = $[4]; } - return t1; + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-conditional-as-default-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-conditional-as-default-value.expect.md index e241dfdba9..2a152dacaf 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-conditional-as-default-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-conditional-as-default-value.expect.md @@ -18,8 +18,8 @@ export const FIXTURE_ENTRYPOINT = { ```javascript function Component(props) { - const [t23] = props.y; - const x = t23 === undefined ? (true ? 1 : 0) : t23; + const [t0] = props.y; + const x = t0 === undefined ? (true ? 1 : 0) : t0; return x; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring.expect.md index c716448ac0..2aa62d6885 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring.expect.md @@ -63,21 +63,21 @@ function foo(a, b, c) { g = $[6]; } const { f } = t2; - const { l: t51, p } = b; - const { m: t3 } = t51; - let t4; + const { l: t3, p } = b; + const { m: t4 } = t3; + let t5; let o; - if ($[7] !== t3) { - [t4, ...o] = t3; - $[7] = t3; - $[8] = t4; + if ($[7] !== t4) { + [t5, ...o] = t4; + $[7] = t4; + $[8] = t5; $[9] = o; } else { - t4 = $[8]; + t5 = $[8]; o = $[9]; } - const [n] = t4; - let t5; + const [n] = t5; + let t6; if ( $[10] !== d || $[11] !== f || @@ -87,7 +87,7 @@ function foo(a, b, c) { $[15] !== o || $[16] !== p ) { - t5 = [d, f, g, h, n, o, p]; + t6 = [d, f, g, h, n, o, p]; $[10] = d; $[11] = f; $[12] = g; @@ -95,11 +95,11 @@ function foo(a, b, c) { $[14] = n; $[15] = o; $[16] = p; - $[17] = t5; + $[17] = t6; } else { - t5 = $[17]; + t6 = $[17]; } - return t5; + return t6; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md index 6916fd4f8a..eda227ef92 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-no-whitespace-btw-text-and-param.expect.md @@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; const _ = fbt; -function Component(t12) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t12; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 = fbt._( + t1 = fbt._( "Before text{paramName}After text", [fbt._param("paramName", value)], { hk: "aKEGX" } ); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md index c6fef5b6ea..0ec83317fe 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-preserve-whitespace.expect.md @@ -28,12 +28,12 @@ import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; const _ = fbt; -function Component(t12) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t12; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 = fbt._( + t1 = fbt._( "Before text {paramName}", [ fbt._param( @@ -45,11 +45,11 @@ function Component(t12) { { hk: "3z5SVE" } ); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md index 4055016b83..677ee89824 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-single-space-btw-param-and-text.expect.md @@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; const _ = fbt; -function Component(t12) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t12; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 = fbt._( + t1 = fbt._( "Before text {paramName} after text", [fbt._param("paramName", value)], { hk: "26pxNm" } ); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md index 59558307a2..1583aa3e7b 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-around-param-value.expect.md @@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; const _ = fbt; -function Component(t14) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t14; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 = fbt._( + t1 = fbt._( "Before text {paramName} after text", [fbt._param("paramName", value)], { hk: "26pxNm" } ); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md index a0c77c19e4..e2c3a98651 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbt-whitespace-within-text.expect.md @@ -29,22 +29,22 @@ import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; const _ = fbt; -function Component(t12) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t12; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 = fbt._( + t1 = fbt._( "Before text {paramName} after text more text and more and more and more and more and more and more and more and more and blah blah blah blah", [fbt._param("paramName", value)], { hk: "24ZPpO" } ); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md index 2b66b46a48..a15287910f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md @@ -28,12 +28,12 @@ function Component({ name, data, icon }) { import { unstable_useMemoCache as useMemoCache } from "react"; import fbt from "fbt"; -function Component(t33) { +function Component(t0) { const $ = useMemoCache(4); - const { name, data, icon } = t33; - let t0; + const { name, data, icon } = t0; + let t1; if ($[0] !== name || $[1] !== icon || $[2] !== data) { - t0 = ( + t1 = ( {fbt._( "{item author}{icon}{=m2}", @@ -64,11 +64,11 @@ function Component(t33) { $[0] = name; $[1] = icon; $[2] = data; - $[3] = t0; + $[3] = t1; } else { - t0 = $[3]; + t1 = $[3]; } - return t0; + return t1; } ``` diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md index 340ab95a89..0fe0f338b6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md @@ -53,49 +53,49 @@ import { } from "shared-runtime"; const MyContext = createContext("my context value"); -function Component(t47) { +function Component(t0) { const $ = useMemoCache(4); try { $dispatcherGuard(0); - const { value } = t47; + const { value } = t0; print(identity(CONST_STRING0)); - let t0; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = getNumber(); - $[0] = t0; + t1 = getNumber(); + $[0] = t1; } else { - t0 = $[0]; + t1 = $[0]; } const [state, setState] = (function () { try { $dispatcherGuard(2); - return useState(t0); + return useState(t1); } finally { $dispatcherGuard(3); } })(); print(value, state); - let t1; let t2; + let t3; if ($[1] !== state) { - t1 = () => { + t2 = () => { if (state === 4) { setState(5); } }; - t2 = [state]; + t3 = [state]; $[1] = state; - $[2] = t1; - $[3] = t2; + $[2] = t2; + $[3] = t3; } else { - t1 = $[2]; - t2 = $[3]; + t2 = $[2]; + t3 = $[3]; } (function () { try { $dispatcherGuard(2); - return useEffect(t1, t2); + return useEffect(t2, t3); } finally { $dispatcherGuard(3); } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md index a1a5de3220..55a0d7513f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md @@ -18,28 +18,28 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t23, t0) { +function Component(t0, t1) { const $ = useMemoCache(5); - const x = t23 === undefined ? "default" : t23; - let t1; - if ($[0] !== t0) { - t1 = t0 === undefined ? [{}] : t0; - $[0] = t0; - $[1] = t1; - } else { - t1 = $[1]; - } - const y = t1; + const x = t0 === undefined ? "default" : t0; let t2; + if ($[0] !== t1) { + t2 = t1 === undefined ? [{}] : t1; + $[0] = t1; + $[1] = t2; + } else { + t2 = $[1]; + } + const y = t2; + let t3; if ($[2] !== x || $[3] !== y) { - t2 = [x, y]; + t3 = [x, y]; $[2] = x; $[3] = y; - $[4] = t2; + $[4] = t3; } else { - t2 = $[4]; + t3 = $[4]; } - return t2; + return t3; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call-within-lambda.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call-within-lambda.expect.md index 3a62d9500d..d6ed09d570 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call-within-lambda.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call-within-lambda.expect.md @@ -26,11 +26,11 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Foo(t32) { +function Foo(t0) { const $ = useMemoCache(2); - let t0; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = (val) => { + t1 = (val) => { const fact = (x) => { if (x <= 0) { return 1; @@ -39,19 +39,19 @@ function Foo(t32) { }; return fact(val); }; - $[0] = t0; + $[0] = t1; } else { - t0 = $[0]; + t1 = $[0]; } - const outer = t0; - let t1; + const outer = t1; + let t2; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - t1 = outer(3); - $[1] = t1; + t2 = outer(3); + $[1] = t2; } else { - t1 = $[1]; + t2 = $[1]; } - return t1; + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md index 0a06e38bd2..485195ac56 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md @@ -25,10 +25,10 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Foo(t25) { +function Foo(t0) { const $ = useMemoCache(2); - const { value } = t25; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { const factorial = (x) => { if (x <= 1) { @@ -38,13 +38,13 @@ function Foo(t25) { } }; - t0 = factorial(value); + t1 = factorial(value); $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-within-lambda.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-within-lambda.expect.md index 77b679730c..04259b8299 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-within-lambda.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-within-lambda.expect.md @@ -24,29 +24,29 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t22) { +function Component(t0) { const $ = useMemoCache(2); - let t0; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = () => { + t1 = () => { const inner = () => x; const x = 3; return inner(); }; - $[0] = t0; + $[0] = t1; } else { - t0 = $[0]; + t1 = $[0]; } - const outer = t0; - let t1; + const outer = t1; + let t2; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - t1 =
{outer()}
; - $[1] = t1; + t2 =
{outer()}
; + $[1] = t2; } else { - t1 = $[1]; + t2 = $[1]; } - return t1; + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-ref-arg.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-ref-arg.expect.md index 452f0cfeba..b4d0d98b58 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-ref-arg.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-ref-arg.expect.md @@ -20,17 +20,17 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; // @compilationMode(infer) -function Foo(t6, ref) { +function Foo(t0, ref) { const $ = useMemoCache(2); - let t0; + let t1; if ($[0] !== ref) { - t0 =
; + t1 =
; $[0] = ref; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md index e3fe47d718..4f40b1c367 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.expect.md @@ -43,12 +43,12 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t27) { +function Component(t0) { const $ = useMemoCache(2); - const { items } = t27; - let t0; + const { items } = t0; + let t1; if ($[0] !== items) { - t0 = + t1 = items.length > 0 ? ( ) : null; $[0] = items; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } -function Foo(t5) { - const { value } = t5; +function Foo(t0) { + const { value } = t0; return value; } -function Bar(t6) { +function Bar(t0) { const $ = useMemoCache(2); - const { children } = t6; - let t0; + const { children } = t0; + let t1; if ($[0] !== children) { - t0 =
{children}
; + t1 =
{children}
; $[0] = children; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } -function Item(t7) { +function Item(t0) { const $ = useMemoCache(2); - const { item } = t7; - let t0; + const { item } = t0; + let t1; if ($[0] !== item.name) { - t0 =
{item.name}
; + t1 =
{item.name}
; $[0] = item.name; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.expect.md index add775e4bf..f73da9e521 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-fragment-value.flow.expect.md @@ -34,12 +34,12 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { Stringify } from "shared-runtime"; -function Component(t26) { +function Component(t0) { const $ = useMemoCache(2); - const { items } = t26; - let t0; + const { items } = t0; + let t1; if ($[0] !== items) { - t0 = + t1 = items.length > 0 ? ( ) : null; $[0] = items; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } -function Foo(t6) { +function Foo(t0) { const $ = useMemoCache(2); - const { value } = t6; - let t0; + const { value } = t0; + let t1; if ($[0] !== value) { - t0 =
{value}
; + t1 =
{value}
; $[0] = value; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-local-memberexpr-tag-conditional.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-local-memberexpr-tag-conditional.expect.md index f55090eb48..ab75e5c63c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-local-memberexpr-tag-conditional.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-local-memberexpr-tag-conditional.expect.md @@ -24,19 +24,19 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; import * as SharedRuntime from "shared-runtime"; -function useFoo(t12) { +function useFoo(t0) { const $ = useMemoCache(1); - const { cond } = t12; + const { cond } = t0; const MyLocal = SharedRuntime; if (cond) { - let t0; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = ; - $[0] = t0; + t1 = ; + $[0] = t1; } else { - t0 = $[0]; + t1 = $[0]; } - return t0; + return t1; } else { return null; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-reactive-local-variable-member-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-reactive-local-variable-member-expr.expect.md index d0719fda0f..deda8903b0 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-reactive-local-variable-member-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-reactive-local-variable-member-expr.expect.md @@ -26,20 +26,20 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import * as sharedRuntime from "shared-runtime"; -function Component(t13) { +function Component(t0) { const $ = useMemoCache(2); - const { something } = t13; + const { something } = t0; const Foo = something.StaticText1; - let t0; + let t1; if ($[0] !== Foo) { - t0 = () => ; + t1 = () => ; $[0] = Foo; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md index 01ea1cdd11..0f9feab9df 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md @@ -62,8 +62,8 @@ function Component(props) { return t2; } -function Foo(t5) { - const { children } = t5; +function Foo(t0) { + const { children } = t0; return children; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/nested-function-with-param-as-captured-dep.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/nested-function-with-param-as-captured-dep.expect.md index bfa76bf899..df7b7b6852 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/nested-function-with-param-as-captured-dep.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/nested-function-with-param-as-captured-dep.expect.md @@ -28,8 +28,8 @@ function Foo() { let t0; let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t1 = function a(t28) { - const x_0 = t28 === undefined ? () => {} : t28; + t1 = function a(t0) { + const x_0 = t0 === undefined ? () => {} : t0; return x_0; }; $[0] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-call-in-ternary-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-call-in-ternary-test.expect.md index 741304dbde..98cb57e803 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-call-in-ternary-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-call-in-ternary-test.expect.md @@ -36,8 +36,8 @@ import { CONST_STRING1, } from "shared-runtime"; -function useHook(t18) { - const { value } = t18; +function useHook(t0) { + const { value } = t0; return { getValue() { return identity(value); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-derived-in-ternary-consequent.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-derived-in-ternary-consequent.expect.md index 113a14a35a..4c19f97c20 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-derived-in-ternary-consequent.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-derived-in-ternary-consequent.expect.md @@ -27,12 +27,12 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { identity, createHookWrapper } from "shared-runtime"; -function useHook(t17) { +function useHook(t0) { const $ = useMemoCache(3); - const { isCond, value } = t17; - let t0; + const { isCond, value } = t0; + let t1; if ($[0] !== isCond || $[1] !== value) { - t0 = isCond + t1 = isCond ? identity({ getValue() { return value; @@ -41,11 +41,11 @@ function useHook(t17) { : 42; $[0] = isCond; $[1] = value; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-consequent.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-consequent.expect.md index 5fc1344933..b214cd9742 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-consequent.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-consequent.expect.md @@ -27,12 +27,12 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper } from "shared-runtime"; -function useHook(t15) { +function useHook(t0) { const $ = useMemoCache(3); - const { isCond, value } = t15; - let t0; + const { isCond, value } = t0; + let t1; if ($[0] !== isCond || $[1] !== value) { - t0 = isCond + t1 = isCond ? { getValue() { return value; @@ -41,11 +41,11 @@ function useHook(t15) { : 42; $[0] = isCond; $[1] = value; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-test.expect.md index 62e539ed15..75351ae849 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-literal-method-in-ternary-test.expect.md @@ -34,8 +34,8 @@ import { CONST_STRING1, } from "shared-runtime"; -function useHook(t16) { - const { value } = t16; +function useHook(t0) { + const { value } = t0; return { getValue() { return identity(value); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-aliased-mutate-after.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-aliased-mutate-after.expect.md index 086f6be456..d26169f3b8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-aliased-mutate-after.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-aliased-mutate-after.expect.md @@ -26,9 +26,9 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper, mutate, mutateAndReturn } from "shared-runtime"; -function useHook(t21) { +function useHook(t0) { const $ = useMemoCache(2); - const { value } = t21; + const { value } = t0; let obj; if ($[0] !== value) { const x = mutateAndReturn({ value }); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-derived-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-derived-value.expect.md index 4e02a87eed..50acc28ff7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-derived-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-derived-value.expect.md @@ -25,31 +25,31 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper, mutateAndReturn } from "shared-runtime"; -function useHook(t18) { +function useHook(t0) { const $ = useMemoCache(4); - const { value } = t18; - let t0; - if ($[0] !== value) { - t0 = mutateAndReturn({ value }); - $[0] = value; - $[1] = t0; - } else { - t0 = $[1]; - } - const x = t0; + const { value } = t0; let t1; + if ($[0] !== value) { + t1 = mutateAndReturn({ value }); + $[0] = value; + $[1] = t1; + } else { + t1 = $[1]; + } + const x = t1; + let t2; if ($[2] !== x) { - t1 = { + t2 = { getValue() { return x; }, }; $[2] = x; - $[3] = t1; + $[3] = t2; } else { - t1 = $[3]; + t2 = $[3]; } - const obj = t1; + const obj = t2; return obj; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-mutated-after.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-mutated-after.expect.md index 17a5cacd72..181343d5c4 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-mutated-after.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-method-shorthand-mutated-after.expect.md @@ -26,9 +26,9 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper, mutate, mutateAndReturn } from "shared-runtime"; -function useHook(t21) { +function useHook(t0) { const $ = useMemoCache(2); - const { value } = t21; + const { value } = t0; let obj; if ($[0] !== value) { const x = mutateAndReturn({ value }); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md index cd8e2f5a2f..ee104dd55e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md @@ -20,37 +20,37 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function component(t16) { +function component(t0) { const $ = useMemoCache(7); - const { a, b } = t16; - let t0; - if ($[0] !== a) { - t0 = { a }; - $[0] = a; - $[1] = t0; - } else { - t0 = $[1]; - } - const y = t0; + const { a, b } = t0; let t1; - if ($[2] !== b) { - t1 = { b }; - $[2] = b; - $[3] = t1; + if ($[0] !== a) { + t1 = { a }; + $[0] = a; + $[1] = t1; } else { - t1 = $[3]; + t1 = $[1]; } - const z = t1; + const y = t1; let t2; + if ($[2] !== b) { + t2 = { b }; + $[2] = b; + $[3] = t2; + } else { + t2 = $[3]; + } + const z = t2; + let t3; if ($[4] !== y || $[5] !== z) { - t2 = { y, z }; + t3 = { y, z }; $[4] = y; $[5] = z; - $[6] = t2; + $[6] = t3; } else { - t2 = $[6]; + t3 = $[6]; } - return t2; + return t3; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-1.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-1.expect.md index 1a1124f8d6..aa3fe3b5a4 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-1.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-1.expect.md @@ -26,34 +26,34 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper } from "shared-runtime"; -function useHook(t16) { +function useHook(t0) { const $ = useMemoCache(5); - const { a, b } = t16; - let t0; + const { a, b } = t0; + let t1; if ($[0] !== a) { - t0 = function () { + t1 = function () { return [a]; }; $[0] = a; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - let t1; - if ($[2] !== b || $[3] !== t0) { - t1 = { - x: t0, + let t2; + if ($[2] !== b || $[3] !== t1) { + t2 = { + x: t1, y() { return [b]; }, }; $[2] = b; - $[3] = t0; - $[4] = t1; + $[3] = t1; + $[4] = t2; } else { - t1 = $[4]; + t2 = $[4]; } - return t1; + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-2.expect.md index e595d3583b..aa2b0bd920 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-2.expect.md @@ -27,42 +27,42 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper } from "shared-runtime"; -function useHook(t16) { +function useHook(t0) { const $ = useMemoCache(8); - const { a, b, c } = t16; - let t0; - if ($[0] !== a) { - t0 = [a]; - $[0] = a; - $[1] = t0; - } else { - t0 = $[1]; - } + const { a, b, c } = t0; let t1; - if ($[2] !== b || $[3] !== c || $[4] !== t0) { - let t2; + if ($[0] !== a) { + t1 = [a]; + $[0] = a; + $[1] = t1; + } else { + t1 = $[1]; + } + let t2; + if ($[2] !== b || $[3] !== c || $[4] !== t1) { + let t3; if ($[6] !== c) { - t2 = { c }; + t3 = { c }; $[6] = c; - $[7] = t2; + $[7] = t3; } else { - t2 = $[7]; + t3 = $[7]; } - t1 = { - x: t0, + t2 = { + x: t1, y() { return [b]; }, - z: t2, + z: t3, }; $[2] = b; $[3] = c; - $[4] = t0; - $[5] = t1; + $[4] = t1; + $[5] = t2; } else { - t1 = $[5]; + t2 = $[5]; } - return t1; + return t2; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md index c84e813415..fb52d4ee4a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md @@ -34,13 +34,13 @@ export const FIXTURE_ENTRYPOINT = { import { useState, unstable_useMemoCache as useMemoCache } from "react"; import { createHookWrapper } from "shared-runtime"; -function useHook(t21) { +function useHook(t0) { const $ = useMemoCache(3); - const { value } = t21; + const { value } = t0; const [state] = useState(false); - let t0; + let t1; if ($[0] !== value || $[1] !== state) { - t0 = { + t1 = { getX() { return { a: [], @@ -53,11 +53,11 @@ function useHook(t21) { }; $[0] = value; $[1] = state; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-phi-setState-type.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-phi-setState-type.expect.md index 0e4b9e5c34..26f9670f41 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-phi-setState-type.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-phi-setState-type.expect.md @@ -98,8 +98,8 @@ function Component(props) { return t1; } -function Foo(t21) { - const { cond, setX, setY, setState } = t21; +function Foo(t0) { + const { cond, setX, setY, setState } = t0; if (cond) { invariant(setState === setX, "Expected the correct setState function"); } else { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.expect.md index a72645458b..dc102a476c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.expect.md @@ -44,9 +44,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; const GLOBAL = 42; -function Component(t14) { +function Component(t0) { const $ = useMemoCache(2); - const { value } = t14; + const { value } = t0; let x; bb1: switch (GLOBAL) { case value: { @@ -57,15 +57,15 @@ function Component(t14) { x = 2; } } - let t0; + let t1; if ($[0] !== x) { - t0 = [x]; + t1 = [x]; $[0] = x; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-testifelse.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-testifelse.expect.md index c73a8a1439..a857260e13 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-testifelse.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-testifelse.expect.md @@ -37,9 +37,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { setProperty } from "shared-runtime"; -function useFoo(t27) { +function useFoo(t0) { const $ = useMemoCache(3); - const { o, branchCheck } = t27; + const { o, branchCheck } = t0; let x; if ($[0] !== branchCheck || $[1] !== o.value) { x = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md index 25d9ff2cc9..cd890a618a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md @@ -17,29 +17,29 @@ function Foo({ a }) { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; // @validateRefAccessDuringRender:false -function Foo(t20) { +function Foo(t0) { const $ = useMemoCache(4); - const { a } = t20; + const { a } = t0; const ref = useRef(); const val = ref.current; - let t0; - if ($[0] !== a) { - t0 = { a, val }; - $[0] = a; - $[1] = t0; - } else { - t0 = $[1]; - } - const x = t0; let t1; - if ($[2] !== x) { - t1 = ; - $[2] = x; - $[3] = t1; + if ($[0] !== a) { + t1 = { a, val }; + $[0] = a; + $[1] = t1; } else { - t1 = $[3]; + t1 = $[1]; } - return t1; + const x = t1; + let t2; + if ($[2] !== x) { + t2 = ; + $[2] = x; + $[3] = t2; + } else { + t2 = $[3]; + } + return t2; } ``` diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md index d8717af18e..dbe3d00950 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md @@ -16,28 +16,28 @@ function Foo({ a }) { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; // @validateRefAccessDuringRender:false -function Foo(t17) { +function Foo(t0) { const $ = useMemoCache(4); - const { a } = t17; + const { a } = t0; const ref = useRef(); - let t0; - if ($[0] !== a) { - t0 = { a, val: ref.current }; - $[0] = a; - $[1] = t0; - } else { - t0 = $[1]; - } - const x = t0; let t1; - if ($[2] !== x) { - t1 = ; - $[2] = x; - $[3] = t1; + if ($[0] !== a) { + t1 = { a, val: ref.current }; + $[0] = a; + $[1] = t1; } else { - t1 = $[3]; + t1 = $[1]; } - return t1; + const x = t1; + let t2; + if ($[2] !== x) { + t2 = ; + $[2] = x; + $[3] = t2; + } else { + t2 = $[3]; + } + return t2; } ``` diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-dce-circular-reference.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-dce-circular-reference.expect.md index a1cc4ad50d..78c995b775 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-dce-circular-reference.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-dce-circular-reference.expect.md @@ -34,24 +34,24 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { identity } from "shared-runtime"; -function Component(t25) { +function Component(t0) { const $ = useMemoCache(2); - const { data } = t25; + const { data } = t0; let x = 0; for (const item of data) { const { current, other } = item; x = x + current; identity(other); } - let t0; + let t1; if ($[0] !== x) { - t0 = [x]; + t1 = [x]; $[0] = x; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md index d878fb5f51..69eab397cc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-duplicate-instruction-from-merge-consecutive-scopes.expect.md @@ -28,31 +28,31 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { Stringify } from "shared-runtime"; -function Component(t23) { +function Component(t0) { const $ = useMemoCache(3); - const { id } = t23; - let t0; + const { id } = t0; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = ; - $[0] = t0; + t1 = ; + $[0] = t1; } else { - t0 = $[0]; + t1 = $[0]; } - const t1 = id ? true : false; - let t2; - if ($[1] !== t1) { - t2 = ( + const t2 = id ? true : false; + let t3; + if ($[1] !== t2) { + t3 = ( <> - {t0} - + {t1} + ); - $[1] = t1; - $[2] = t2; + $[1] = t2; + $[2] = t3; } else { - t2 = $[2]; + t3 = $[2]; } - return t2; + return t3; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-invoked-callback-escaping-return.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-invoked-callback-escaping-return.expect.md index a1b0e3ada0..570a46bef3 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-invoked-callback-escaping-return.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-invoked-callback-escaping-return.expect.md @@ -39,58 +39,58 @@ export const FIXTURE_ENTRYPOINT = { // @validatePreserveExistingMemoizationGuarantees @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions import { useCallback, unstable_useMemoCache as useMemoCache } from "react"; -function Component(t26) { +function Component(t0) { const $ = useMemoCache(11); - const { entity, children } = t26; - let t0; - if ($[0] !== entity) { - t0 = () => entity != null; - $[0] = entity; - $[1] = t0; - } else { - t0 = $[1]; - } - const showMessage = t0; + const { entity, children } = t0; let t1; - if ($[2] !== showMessage) { - t1 = showMessage(); - $[2] = showMessage; - $[3] = t1; + if ($[0] !== entity) { + t1 = () => entity != null; + $[0] = entity; + $[1] = t1; } else { - t1 = $[3]; + t1 = $[1]; } - const shouldShowMessage = t1; + const showMessage = t1; let t2; - if ($[4] !== shouldShowMessage) { - t2 =
{shouldShowMessage}
; - $[4] = shouldShowMessage; - $[5] = t2; + if ($[2] !== showMessage) { + t2 = showMessage(); + $[2] = showMessage; + $[3] = t2; } else { - t2 = $[5]; + t2 = $[3]; } + const shouldShowMessage = t2; let t3; - if ($[6] !== children) { - t3 =
{children}
; - $[6] = children; - $[7] = t3; + if ($[4] !== shouldShowMessage) { + t3 =
{shouldShowMessage}
; + $[4] = shouldShowMessage; + $[5] = t3; } else { - t3 = $[7]; + t3 = $[5]; } let t4; - if ($[8] !== t2 || $[9] !== t3) { - t4 = ( + if ($[6] !== children) { + t4 =
{children}
; + $[6] = children; + $[7] = t4; + } else { + t4 = $[7]; + } + let t5; + if ($[8] !== t3 || $[9] !== t4) { + t5 = (
- {t2} {t3} + {t4}
); - $[8] = t2; - $[9] = t3; - $[10] = t4; + $[8] = t3; + $[9] = t4; + $[10] = t5; } else { - t4 = $[10]; + t5 = $[10]; } - return t4; + return t5; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-value.expect.md index e37e954613..f5e23b485d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-false-positive-preserve-memoization-nonescaping-value.expect.md @@ -36,23 +36,23 @@ export const FIXTURE_ENTRYPOINT = { // @validatePreserveExistingMemoizationGuarantees @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions import { useCallback, unstable_useMemoCache as useMemoCache } from "react"; -function Component(t23) { +function Component(t0) { const $ = useMemoCache(2); - const { entity, children } = t23; + const { entity, children } = t0; const showMessage = () => entity != null; if (!showMessage()) { return children; } - let t0; + let t1; if ($[0] !== children) { - t0 =
{children}
; + t1 =
{children}
; $[0] = children; - $[1] = t0; + $[1] = t1; } else { - t0 = $[1]; + t1 = $[1]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md index eef537df2d..d8ab68b22e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md @@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(foo, ...t9) { +function Component(foo, ...t0) { const $ = useMemoCache(3); - const [bar] = t9; - let t0; + const [bar] = t0; + let t1; if ($[0] !== foo || $[1] !== bar) { - t0 = [foo, bar]; + t1 = [foo, bar]; $[0] = foo; $[1] = bar; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md index 6745138dd6..be8486a582 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md @@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(foo, ...t9) { +function Component(foo, ...t0) { const $ = useMemoCache(3); - const bar = t9; - let t0; + const bar = t0; + let t1; if ($[0] !== foo || $[1] !== bar) { - t0 = [foo, bar]; + t1 = [foo, bar]; $[0] = foo; $[1] = bar; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md index ddfb0a8c68..b90b1089fc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md @@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(foo, ...t9) { +function Component(foo, ...t0) { const $ = useMemoCache(3); - const { bar } = t9; - let t0; + const { bar } = t0; + let t1; if ($[0] !== foo || $[1] !== bar) { - t0 = [foo, bar]; + t1 = [foo, bar]; $[0] = foo; $[1] = bar; - $[2] = t0; + $[2] = t1; } else { - t0 = $[2]; + t1 = $[2]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/allow-props-named-like-hooks.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/allow-props-named-like-hooks.expect.md index e98597bc80..67f52d6a3d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/allow-props-named-like-hooks.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/rules-of-hooks/allow-props-named-like-hooks.expect.md @@ -33,29 +33,29 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; import { Stringify } from "shared-runtime"; -function Component(t29) { +function Component(t0) { const $ = useMemoCache(8); - const { useFeature } = t29; + const { useFeature } = t0; let x; if (useFeature) { - const t0 = useFeature + useFeature; - let t1; - if ($[0] !== t0 || $[1] !== useFeature) { - t1 = [t0].push(-useFeature); - $[0] = t0; + const t1 = useFeature + useFeature; + let t2; + if ($[0] !== t1 || $[1] !== useFeature) { + t2 = [t1].push(-useFeature); + $[0] = t1; $[1] = useFeature; - $[2] = t1; + $[2] = t2; } else { - t1 = $[2]; + t2 = $[2]; } - x = t1; + x = t2; } const y = useFeature; const z = useFeature.useProperty; - let t0; + let t1; if ($[3] !== useFeature || $[4] !== x || $[5] !== y || $[6] !== z) { - t0 = ( + t1 = ( {x} {y} @@ -66,11 +66,11 @@ function Component(t29) { $[4] = x; $[5] = y; $[6] = z; - $[7] = t0; + $[7] = t1; } else { - t0 = $[7]; + t1 = $[7]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-alias-try-values.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-alias-try-values.expect.md index da80744e32..126a18d913 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-alias-try-values.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-alias-try-values.expect.md @@ -39,8 +39,8 @@ function Component(props) { x = []; try { throwInput(x); - } catch (t27) { - const e = t27; + } catch (t0) { + const e = t0; y = e; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md index e07c20d348..ec399a935a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md @@ -38,8 +38,8 @@ function Component(props) { const y = []; y.push(props.y); throwInput(y); - } catch (t30) { - const e = t30; + } catch (t0) { + const e = t0; e.push(props.e); x = e; } diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md index b10bce221b..d23a752b59 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md @@ -39,8 +39,8 @@ function Component(props) { const y = []; y.push(props.y); throwInput(y); - } catch (t25) { - const e = t25; + } catch (t1) { + const e = t1; e.push(props.e); t0 = e; break bb18; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md index c4ff0295df..1a66a7a521 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md @@ -39,8 +39,8 @@ function Component(props) { const x = []; try { throwInput(x); - } catch (t22) { - const e = t22; + } catch (t1) { + const e = t1; e.push(null); t0 = e; break bb11; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-1.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-1.expect.md index 793cdea9b4..6171c9648e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-1.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-1.expect.md @@ -24,18 +24,18 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t38) { +function Component(t0) { const $ = useMemoCache(10); - let { a, b: t40, c: t41 } = t38; - let [b] = t40; - let { c } = t41; + let { a, b: t1, c: t2 } = t0; + let [b] = t1; + let { c } = t2; const d = a++; const e = ++a; const f = b--; const g = --b; const h = c++; const i = --c; - let t0; + let t3; if ( $[0] !== a || $[1] !== b || @@ -47,7 +47,7 @@ function Component(t38) { $[7] !== h || $[8] !== i ) { - t0 = [a, b, c, d, e, f, g, h, i]; + t3 = [a, b, c, d, e, f, g, h, i]; $[0] = a; $[1] = b; $[2] = c; @@ -57,11 +57,11 @@ function Component(t38) { $[6] = g; $[7] = h; $[8] = i; - $[9] = t0; + $[9] = t3; } else { - t0 = $[9]; + t3 = $[9]; } - return t0; + return t3; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-3.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-3.expect.md index 04905404f8..85ef2fcec7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-3.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-3.expect.md @@ -20,22 +20,22 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t14) { +function Component(t0) { const $ = useMemoCache(4); - let { c } = t14; + let { c } = t0; const h = c++; const i = --c; - let t0; + let t1; if ($[0] !== c || $[1] !== h || $[2] !== i) { - t0 = [c, h, i]; + t1 = [c, h, i]; $[0] = c; $[1] = h; $[2] = i; - $[3] = t0; + $[3] = t1; } else { - t0 = $[3]; + t1 = $[3]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-4.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-4.expect.md index 4ec48b36ab..610a6c4f4f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-4.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/update-expression-on-function-parameter-4.expect.md @@ -20,22 +20,22 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -function Component(t14) { +function Component(t0) { const $ = useMemoCache(4); - let [b] = t14; + let [b] = t0; const f = b--; const g = --b; - let t0; + let t1; if ($[0] !== b || $[1] !== f || $[2] !== g) { - t0 = [b, f, g]; + t1 = [b, f, g]; $[0] = b; $[1] = f; $[2] = g; - $[3] = t0; + $[3] = t1; } else { - t0 = $[3]; + t1 = $[3]; } - return t0; + return t1; } export const FIXTURE_ENTRYPOINT = { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useCallback-set-ref-nested-property.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useCallback-set-ref-nested-property.expect.md index 0e080e3f55..2b8bcd73de 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useCallback-set-ref-nested-property.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/useCallback-set-ref-nested-property.expect.md @@ -36,35 +36,35 @@ import { // Identical to useCallback-set-ref-nested-property-preserve-memoization, // but with a different set of compiler flags -function Component(t27) { +function Component(t0) { const $ = useMemoCache(4); - let t0; - if ($[0] === Symbol.for("react.memo_cache_sentinel")) { - t0 = { inner: null }; - $[0] = t0; - } else { - t0 = $[0]; - } - const ref = useRef(t0); let t1; + if ($[0] === Symbol.for("react.memo_cache_sentinel")) { + t1 = { inner: null }; + $[0] = t1; + } else { + t1 = $[0]; + } + const ref = useRef(t1); + let t2; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { - t1 = (event) => { + t2 = (event) => { ref.current.inner = event.target.value; }; - $[1] = t1; + $[1] = t2; } else { - t1 = $[1]; + t2 = $[1]; } - const onChange = t1; - let t2; + const onChange = t2; + let t3; if ($[2] !== onChange) { - t2 = ; + t3 = ; $[2] = onChange; - $[3] = t2; + $[3] = t3; } else { - t2 = $[3]; + t3 = $[3]; } - return t2; + return t3; } export const FIXTURE_ENTRYPOINT = {