From 28767a7afb7ca426712b588dbc3beacc12f645b8 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 12 Oct 2023 12:03:42 -0700 Subject: [PATCH] Inline reactive scope dep checks; no more change vars Reactive scopes are currently preceded by individual variable declarations, one for each of the scope's dependencies. Only after checking independently if each of these dependencies has changed do we then do an "or" to check if we should actually recompute the body of the scope. But that's wasteful: it's more efficient to rely on `||` short-circuiting, and recompute as soon as any input changes. The main reason I can see not to do this is debugging. Having the change variables makes it easy to see what changed. But at this point I think it makes sense to optimize for code size and performance; we can always add back a dev-only mode that uses change variables if that turns out to help debugging. --- .../ReactiveScopes/CodegenReactiveFunction.ts | 27 ++++++------------- .../compiler/alias-computed-load.expect.md | 3 +-- .../fixtures/compiler/alias-while.expect.md | 3 +-- ...ng-primitive-as-dep-nested-scope.expect.md | 11 +++----- .../allocating-primitive-as-dep.expect.md | 3 +-- .../allow-passing-refs-as-props.expect.md | 3 +-- .../array-access-assignment.expect.md | 12 +++------ .../compiler/array-at-closure.expect.md | 10 +++---- .../compiler/array-at-effect.expect.md | 13 +++------ .../array-expression-spread.expect.md | 4 +-- .../fixtures/compiler/array-join.expect.md | 7 ++--- ...ay-map-captures-receiver-noAlias.expect.md | 3 +-- ...ay-map-noAlias-escaping-function.expect.md | 6 ++--- .../compiler/array-pattern-params.expect.md | 10 +++---- .../compiler/array-properties.expect.md | 9 ++----- .../compiler/array-property-call.expect.md | 13 +++------ .../compiler/array-push-effect.expect.md | 10 +++---- .../arrow-function-expr-gating-test.expect.md | 3 +-- .../assignment-expression-computed.expect.md | 3 +-- ...ssignment-expression-nested-path.expect.md | 3 +-- .../await-side-effecting-promise.expect.md | 3 +-- .../fixtures/compiler/await.expect.md | 6 ++--- .../babel-existing-react-import.expect.md | 12 +++------ ...xisting-react-kitchensink-import.expect.md | 12 +++------ ...-existing-react-namespace-import.expect.md | 3 +-- ...g.useMemo-deps-array-not-cleared.expect.md | 3 +-- .../compiler/bug_object-pattern.expect.md | 3 +-- .../fixtures/compiler/call-spread.expect.md | 4 +-- ...ith-independently-memoizable-arg.expect.md | 6 ++--- ...pture-indirect-mutate-alias-iife.expect.md | 3 +-- .../capture-indirect-mutate-alias.expect.md | 3 +-- .../compiler/capture-param-mutate.expect.md | 3 +-- .../capture_mutate-across-fns-iife.expect.md | 3 +-- .../capture_mutate-across-fns.expect.md | 3 +-- .../capturing-arrow-function-1.expect.md | 6 ++--- ...fun-alias-captured-mutate-2-iife.expect.md | 4 +-- ...ring-fun-alias-captured-mutate-2.expect.md | 4 +-- ...alias-captured-mutate-arr-2-iife.expect.md | 4 +-- ...-fun-alias-captured-mutate-arr-2.expect.md | 4 +-- ...c-alias-captured-mutate-arr-iife.expect.md | 4 +-- ...g-func-alias-captured-mutate-arr.expect.md | 4 +-- ...-func-alias-captured-mutate-iife.expect.md | 4 +-- ...uring-func-alias-captured-mutate.expect.md | 4 +-- ...-func-alias-computed-mutate-iife.expect.md | 3 +-- ...uring-func-alias-computed-mutate.expect.md | 3 +-- ...capturing-func-alias-mutate-iife.expect.md | 3 +-- .../capturing-func-alias-mutate.expect.md | 3 +-- ...as-receiver-computed-mutate-iife.expect.md | 3 +-- ...c-alias-receiver-computed-mutate.expect.md | 3 +-- ...-func-alias-receiver-mutate-iife.expect.md | 3 +-- ...uring-func-alias-receiver-mutate.expect.md | 3 +-- .../capturing-func-mutate-2.expect.md | 7 ++--- .../capturing-func-mutate-3.expect.md | 3 +-- .../capturing-func-mutate-nested.expect.md | 3 +-- .../compiler/capturing-func-mutate.expect.md | 4 +-- ...capturing-func-simple-alias-iife.expect.md | 3 +-- .../capturing-func-simple-alias.expect.md | 3 +-- .../compiler/capturing-function-1.expect.md | 6 ++--- ...ction-alias-computed-load-2-iife.expect.md | 3 +-- ...g-function-alias-computed-load-2.expect.md | 3 +-- ...ction-alias-computed-load-3-iife.expect.md | 4 +-- ...g-function-alias-computed-load-3.expect.md | 4 +-- ...ction-alias-computed-load-4-iife.expect.md | 3 +-- ...g-function-alias-computed-load-4.expect.md | 3 +-- ...unction-alias-computed-load-iife.expect.md | 3 +-- ...ing-function-alias-computed-load.expect.md | 3 +-- ...nction-capture-ref-before-rename.expect.md | 10 +++---- ...ction-conditional-capture-mutate.expect.md | 7 ++--- .../capturing-function-decl.expect.md | 3 +-- ...g-function-member-expr-arguments.expect.md | 3 +-- ...turing-function-member-expr-call.expect.md | 10 +++---- .../capturing-function-renamed-ref.expect.md | 3 +-- ...apturing-function-runs-inference.expect.md | 9 +++---- ...ring-function-skip-computed-path.expect.md | 3 +-- .../capturing-function-within-block.expect.md | 6 ++--- .../compiler/capturing-member-expr.expect.md | 6 ++--- .../capturing-nested-member-call.expect.md | 3 +-- ...ested-member-expr-in-nested-func.expect.md | 6 ++--- .../capturing-nested-member-expr.expect.md | 6 ++--- ...capturing-reference-changes-type.expect.md | 3 +-- ...pturing-variable-in-nested-block.expect.md | 6 ++--- ...ring-variable-in-nested-function.expect.md | 6 ++--- ...codegen-emit-imports-same-source.expect.md | 3 +-- .../codegen-emit-make-read-only.expect.md | 7 ++--- ...en-instrument-forget-gating-test.expect.md | 6 ++--- .../codegen-instrument-forget-test.expect.md | 6 ++--- ...component-declaration-basic.flow.expect.md | 3 +-- .../fixtures/compiler/component.expect.md | 11 +++----- .../compiler/computed-call-spread.expect.md | 5 +--- ...ted-load-primitive-as-dependency.expect.md | 3 +-- .../compiler/computed-store-alias.expect.md | 4 +-- .../compiler/concise-arrow-expr.expect.md | 3 +-- ...ond-deps-conditional-member-expr.expect.md | 3 +-- .../conditional-break-labeled.expect.md | 11 ++++---- .../compiler/conditional-break.expect.md | 14 +++------- .../compiler/conditional-on-mutable.expect.md | 14 +++------- .../compiler/console-readonly.expect.md | 3 +-- .../compiler/constant-computed.expect.md | 3 +-- .../constant-propagate-global-phis.expect.md | 3 +-- .../compiler/controlled-input.expect.md | 4 +-- .../compiler/debugger-memoized.expect.md | 3 +-- .../default-param-array-with-unary.expect.md | 3 +-- ...ault-param-calls-global-function.expect.md | 3 +-- ...efault-param-with-empty-callback.expect.md | 3 +-- ...-param-with-reorderable-callback.expect.md | 3 +-- .../delete-computed-property.expect.md | 4 +-- .../compiler/delete-property.expect.md | 4 +-- .../compiler/dependencies-outputs.expect.md | 7 ++--- .../fixtures/compiler/dependencies.expect.md | 4 +-- .../destructure-capture-global.expect.md | 3 +-- ...ructure-default-array-with-unary.expect.md | 3 +-- .../destructuring-array-default.expect.md | 3 +-- ...cturing-assignment-array-default.expect.md | 3 +-- .../destructuring-assignment.expect.md | 6 +---- ...and-local-variables-with-default.expect.md | 20 +++++--------- ...ed-scope-declarations-and-locals.expect.md | 10 +++---- .../destructuring-object-default.expect.md | 3 +-- ...uring-object-pattern-within-rest.expect.md | 7 ++--- ...destructuring-property-inference.expect.md | 7 ++--- ...h-typecast-as-default-value.flow.expect.md | 3 +-- .../fixtures/compiler/destructuring.expect.md | 26 +++++++++--------- .../compiler/do-while-compound-test.expect.md | 3 +-- .../do-while-conditional-break.expect.md | 3 +-- .../drop-methodcall-usecallback.expect.md | 6 ++--- .../drop-methodcall-usememo.expect.md | 3 +-- ...alysis-destructured-rest-element.expect.md | 10 +++---- .../escape-analysis-jsx-child.expect.md | 12 +++------ .../escape-analysis-logical.expect.md | 14 +++------- ...nterleaved-allocating-dependency.expect.md | 7 ++--- ...ved-allocating-nested-dependency.expect.md | 10 +++---- ...interleaved-primitive-dependency.expect.md | 4 +-- .../compiler/extend-scopes-if.expect.md | 5 +--- .../fbt-call-complex-param-value.expect.md | 6 ++--- .../fixtures/compiler/fbt-call.expect.md | 6 ++--- .../fbt-params-complex-param-value.expect.md | 3 +-- .../fixtures/compiler/fbt-params.expect.md | 3 +-- .../compiler/fbt-preserve-jsxtext.expect.md | 3 +-- .../fbt-template-string-same-scope.expect.md | 6 ++--- ...btparam-with-jsx-element-content.expect.md | 5 +--- ...fbtparam-with-jsx-fragment-value.expect.md | 3 +-- .../compiler/for-in-statement-break.expect.md | 3 +-- .../for-in-statement-continue.expect.md | 3 +-- .../compiler/for-in-statement.expect.md | 6 ++--- .../function-declaration-simple.expect.md | 3 +-- ...-maybe-mutates-hook-return-value.expect.md | 6 ++--- ...pression-with-store-to-parameter.expect.md | 3 +-- ...unction-param-assignment-pattern.expect.md | 7 ++--- ...ing-test-export-default-function.expect.md | 6 ++--- ...test-export-function-and-default.expect.md | 6 ++--- .../gating-test-export-function.expect.md | 6 ++--- .../fixtures/compiler/gating-test.expect.md | 6 ++--- ...sting-nested-const-declaration-2.expect.md | 3 +-- .../compiler/holey-array-expr.expect.md | 3 +-- .../fixtures/compiler/hook-call.expect.md | 3 +-- .../fixtures/compiler/hook-noAlias.expect.md | 7 ++--- .../compiler/immutable-hooks.expect.md | 3 +-- ...rtent-mutability-readonly-lambda.expect.md | 3 +-- .../compiler/independent-across-if.expect.md | 9 ++----- .../fixtures/compiler/independent.expect.md | 10 +++---- ...endently-memoize-object-property.expect.md | 9 ++----- ...nctions-component-with-hook-call.expect.md | 3 +-- ...er-functions-hook-with-hook-call.expect.md | 3 +-- .../compiler/infer-global-object.expect.md | 6 ++--- ...-promoted-to-outer-scope-dynamic.expect.md | 15 +++-------- .../interdependent-across-if.expect.md | 9 ++----- .../compiler/interdependent.expect.md | 8 ++---- .../fixtures/compiler/inverted-if.expect.md | 6 +---- ...attribute-with-jsx-element-value.expect.md | 9 +++---- ...ute-with-jsx-fragment-value.flow.expect.md | 6 ++--- .../compiler/jsx-empty-expression.expect.md | 3 +-- .../fixtures/compiler/jsx-fragment.expect.md | 3 +-- .../compiler/jsx-namespaced-name.expect.md | 3 +-- ...ctive-local-variable-member-expr.expect.md | 3 +-- .../fixtures/compiler/jsx-spread.expect.md | 7 ++--- ...-tag-evaluation-order-non-global.expect.md | 12 +++------ .../jsx-tag-evaluation-order.expect.md | 3 +-- .../jsx-ternary-local-variable.expect.md | 3 +-- .../lambda-capture-returned-alias.expect.md | 7 ++--- ...mutated-non-reactive-to-reactive.expect.md | 6 ++--- .../logical-expression-object.expect.md | 4 +-- .../maybe-mutate-object-in-callback.expect.md | 3 +-- ...merge-consecutive-scopes-objects.expect.md | 13 +++------ .../merge-consecutive-scopes.expect.md | 10 +++---- ...e-nested-scopes-with-same-inputs.expect.md | 3 +-- .../compiler/method-call-computed.expect.md | 11 +++----- .../compiler/method-call-fn-call.expect.md | 8 ++---- .../fixtures/compiler/method-call.expect.md | 7 ++--- ...-expr-export-default-gating-test.expect.md | 3 +-- ...ti-arrow-expr-export-gating-test.expect.md | 3 +-- .../multi-arrow-expr-gating-test.expect.md | 3 +-- ...ed-function-shadowed-identifiers.expect.md | 4 +-- .../nested-optional-member-expr.expect.md | 3 +-- .../fixtures/compiler/new-spread.expect.md | 4 +-- .../noAlias-filter-on-array-prop.expect.md | 3 +-- .../obj-literal-cached-in-if-else.expect.md | 6 ++--- ...bj-literal-mutated-after-if-else.expect.md | 4 +-- ...mutated-after-if-else-with-alias.expect.md | 3 +-- .../obj-mutated-after-if-else.expect.md | 3 +-- ...-after-nested-if-else-with-alias.expect.md | 4 +-- ...ct-expression-string-literal-key.expect.md | 3 +-- .../object-literal-spread-element.expect.md | 3 +-- .../compiler/object-pattern-params.expect.md | 10 +++---- .../object-shorthand-method-1.expect.md | 6 ++--- .../object-shorthand-method-2.expect.md | 10 +++---- .../compiler/optional-call-chained.expect.md | 3 +-- .../compiler/optional-call-logical.expect.md | 3 +-- .../compiler/optional-call-simple.expect.md | 3 +-- ...ith-independently-memoizable-arg.expect.md | 3 +-- ...call-with-optional-property-load.expect.md | 3 +-- .../fixtures/compiler/optional-call.expect.md | 3 +-- ...ional-computed-member-expression.expect.md | 7 ++--- ...mber-expression-call-as-property.expect.md | 4 +-- ...optional-member-expression-chain.expect.md | 4 +-- ...optional-member-expr-as-property.expect.md | 4 +-- .../compiler/optional-method-call.expect.md | 3 +-- .../optional-receiver-method-call.expect.md | 3 +-- ...ptional-receiver-optional-method.expect.md | 3 +-- ...ng-scopes-shadowing-within-block.expect.md | 12 +++------ .../overlapping-scopes-within-block.expect.md | 9 ++----- .../phi-type-inference-array-push.expect.md | 7 ++--- ...hi-type-inference-property-store.expect.md | 8 ++---- .../primitive-as-dep-nested-scope.expect.md | 11 +++----- .../compiler/primitive-as-dep.expect.md | 3 +-- .../prop-capturing-function-1.expect.md | 7 ++--- .../compiler/property-assignment.expect.md | 7 ++--- .../compiler/property-call-spread.expect.md | 4 +-- .../compiler/react-namespace.expect.md | 7 ++--- ...properties-inside-optional-chain.expect.md | 3 +-- .../compiler/reactive-scopes-if.expect.md | 11 +++----- .../compiler/reactive-scopes.expect.md | 7 ++--- ...-analysis-interleaved-reactivity.expect.md | 9 +++---- ...ve-via-mutation-of-computed-load.expect.md | 11 +++----- ...ve-via-mutation-of-property-load.expect.md | 10 +++---- ...ject-method-calls-mutable-lambda.expect.md | 3 +-- .../readonly-object-method-calls.expect.md | 6 ++--- ...-in-returned-function-expression.expect.md | 3 +-- .../reassignment-conditional.expect.md | 9 ++----- .../reassignment-separate-scopes.expect.md | 16 ++++------- .../fixtures/compiler/reassignment.expect.md | 8 ++---- ...-reactive-cond-deps-cfg-condexpr.expect.md | 4 +-- ...ce-reactive-cond-deps-cfg-ifelse.expect.md | 4 +-- ...d-deps-cfg-nested-ifelse-missing.expect.md | 4 +-- ...tive-cond-deps-cfg-nested-ifelse.expect.md | 4 +-- ...-cond-deps-cfg-nested-testifelse.expect.md | 4 +-- ...ond-deps-cfg-switch-missing-case.expect.md | 4 +-- ...-deps-cfg-switch-missing-default.expect.md | 4 +-- ...ce-reactive-cond-deps-cfg-switch.expect.md | 4 +-- ...uce-reactive-cond-deps-no-uncond.expect.md | 4 +-- ...eactive-cond-deps-promote-uncond.expect.md | 4 +-- ...eactive-cond-deps-subpath-order1.expect.md | 4 +-- ...eactive-cond-deps-subpath-order2.expect.md | 4 +-- ...ctive-cond-deps-superpath-order1.expect.md | 4 +-- ...ctive-cond-deps-superpath-order2.expect.md | 4 +-- ...ce-reactive-cond-memberexpr-join.expect.md | 3 +-- ...ncies-optional-member-expression.expect.md | 3 +-- .../reduce-reactive-deps-cond-scope.expect.md | 6 ++--- ...eps-join-uncond-scopes-cond-deps.expect.md | 10 +++---- ...ncond-deps-nonoverlap-descendant.expect.md | 5 +--- ...ve-uncond-deps-nonoverlap-direct.expect.md | 4 +-- ...e-uncond-deps-overlap-descendant.expect.md | 3 +-- ...ctive-uncond-deps-overlap-direct.expect.md | 3 +-- ...ctive-uncond-deps-subpath-order1.expect.md | 3 +-- ...ctive-uncond-deps-subpath-order2.expect.md | 3 +-- ...ctive-uncond-deps-subpath-order3.expect.md | 3 +-- ...-current-aliased-no-added-to-dep.expect.md | 3 +-- ...rrent-aliased-not-added-to-dep-2.expect.md | 6 ++--- ...f-current-field-not-added-to-dep.expect.md | 3 +-- .../ref-current-not-added-to-dep-2.expect.md | 6 ++--- .../ref-current-not-added-to-dep.expect.md | 3 +-- ...t-optional-field-no-added-to-dep.expect.md | 3 +-- ...f-current-write-not-added-to-dep.expect.md | 3 +-- .../fixtures/compiler/ref-in-effect.expect.md | 3 +-- ...repro-duplicate-import-specifier.expect.md | 3 +-- ...on-from-merge-consecutive-scopes.expect.md | 3 +-- ...o-variable-without-mutable-range.expect.md | 11 +++----- ...epro-scope-missing-mutable-range.expect.md | 3 +-- .../fixtures/compiler/repro.expect.md | 7 ++--- .../rest-param-with-array-pattern.expect.md | 4 +-- .../rest-param-with-identifier.expect.md | 4 +-- ...param-with-object-spread-pattern.expect.md | 4 +-- .../rules-of-hooks-9a47e97b5d13.expect.md | 4 +-- .../rules-of-hooks-e66a744cffbe.expect.md | 4 +-- .../rules-of-hooks-eacfcaa6ef89.expect.md | 3 +-- ...s-dep-and-redeclare-maybe-frozen.expect.md | 20 ++++---------- ...me-variable-as-dep-and-redeclare.expect.md | 19 ++++--------- .../fixtures/compiler/simple-scope.expect.md | 3 +-- .../fixtures/compiler/simple.expect.md | 6 ++--- .../ssa-cascading-eliminated-phis.expect.md | 3 +-- .../compiler/ssa-leave-case.expect.md | 7 ++--- ...a-property-alias-alias-mutate-if.expect.md | 3 +-- .../compiler/ssa-property-alias-if.expect.md | 3 +-- .../ssa-property-alias-mutate-if.expect.md | 3 +-- ...-property-alias-mutate-inside-if.expect.md | 3 +-- ...ernary-destruction-with-mutation.expect.md | 3 +-- ...ssa-renaming-ternary-destruction.expect.md | 3 +-- ...a-renaming-ternary-with-mutation.expect.md | 3 +-- .../compiler/ssa-renaming-ternary.expect.md | 3 +-- ...onditional-ternary-with-mutation.expect.md | 3 +-- ...a-renaming-unconditional-ternary.expect.md | 3 +-- ...ming-unconditional-with-mutation.expect.md | 3 +-- ...-via-destructuring-with-mutation.expect.md | 3 +-- .../ssa-renaming-via-destructuring.expect.md | 6 ++--- .../ssa-renaming-with-mutation.expect.md | 3 +-- .../fixtures/compiler/ssa-renaming.expect.md | 6 ++--- .../switch-non-final-default.expect.md | 10 +++---- .../fixtures/compiler/switch.expect.md | 10 +++---- ...temporary-accessed-outside-scope.expect.md | 7 ++--- ...emporary-at-start-of-value-block.expect.md | 3 +-- ...erty-load-accessed-outside-scope.expect.md | 7 ++--- ...sion-captures-value-later-frozen.expect.md | 6 ++--- .../try-catch-mutate-outer-value.expect.md | 3 +-- ...value-modified-in-catch-escaping.expect.md | 4 +-- .../try-catch-within-mutable-range.expect.md | 3 +-- .../type-cast-expression.flow.expect.md | 3 +-- .../fixtures/compiler/unary-expr.expect.md | 17 ++++++------ .../unused-object-element-with-rest.expect.md | 3 +-- .../update-expression-in-sequence.expect.md | 6 +---- ...expression-on-function-parameter.expect.md | 21 ++++++++------- .../compiler/update-expression.expect.md | 5 +--- .../compiler/use-callback-simple.expect.md | 6 ++--- ...maybe-mutate-context-in-callback.expect.md | 7 ++--- ...context-in-callback-if-condition.expect.md | 9 +++---- ...Context-read-context-in-callback.expect.md | 7 ++--- .../compiler/useEffect-arg-memoized.expect.md | 6 ++--- .../useEffect-nested-lambdas.expect.md | 3 +-- .../useMemo-if-else-multiple-return.expect.md | 6 ++--- ...seMemo-independently-memoizeable.expect.md | 14 +++------- .../useMemo-inlining-block-return.expect.md | 3 +-- .../useMemo-multiple-if-else.expect.md | 3 +-- .../compiler/useMemo-simple.expect.md | 6 ++--- 330 files changed, 554 insertions(+), 1262 deletions(-) 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 5b2873c4e2..8a65ea14bc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -237,28 +237,17 @@ function codegenMemoBlockForReactiveScope( ): void { const cacheStoreStatements: Array = []; const cacheLoadStatements: Array = []; - const changeIdentifiers: Array = []; + const changeExpressions: Array = []; for (const dep of scope.dependencies) { const index = cx.nextCacheIndex; - const changeIdentifier = t.identifier(`c_${index}`); const depValue = codegenDependency(cx, dep); - changeIdentifiers.push(changeIdentifier); - statements.push( - t.variableDeclaration("const", [ - t.variableDeclarator( - changeIdentifier, - t.binaryExpression( - "!==", - t.memberExpression( - t.identifier("$"), - t.numericLiteral(index), - true - ), - depValue - ) - ), - ]) + changeExpressions.push( + t.binaryExpression( + "!==", + t.memberExpression(t.identifier("$"), t.numericLiteral(index), true), + depValue + ) ); cacheStoreStatements.push( t.expressionStatement( @@ -336,7 +325,7 @@ function codegenMemoBlockForReactiveScope( ) ); } - let testCondition = (changeIdentifiers as Array).reduce( + let testCondition = (changeExpressions as Array).reduce( (acc: t.Expression | null, ident: t.Expression) => { if (acc == null) { return ident; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md index 44b8a6a030..29853e3896 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md @@ -19,9 +19,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let x; - if (c_0) { + if ($[0] !== a) { x = { a }; const y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-while.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-while.expect.md index 1c979ac82c..7952cedc67 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-while.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-while.expect.md @@ -29,9 +29,8 @@ function mutate(x, y) {} import { unstable_useMemoCache as useMemoCache } from "react"; function foo(cond) { const $ = useMemoCache(2); - const c_0 = $[0] !== cond; let a; - if (c_0) { + if ($[0] !== cond) { a = {}; let b = {}; let c = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md index 63e8ffaafa..d321e844b3 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md @@ -25,17 +25,14 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // bar(props.b) i // - y depends on either bar(props.b) or bar(props.b) + 1 function AllocatingPrimitiveAsDepNested(props) { const $ = useMemoCache(9); - const c_0 = $[0] !== props.b; - const c_1 = $[1] !== props.a; let x; let y; - if (c_0 || c_1) { + if ($[0] !== props.b || $[1] !== props.a) { x = {}; mutate(x); const t0 = bar(props.b) + 1; - const c_4 = $[4] !== t0; let t1; - if (c_4) { + if ($[4] !== t0) { t1 = foo(t0); $[4] = t0; $[5] = t1; @@ -52,10 +49,8 @@ function AllocatingPrimitiveAsDepNested(props) { x = $[2]; y = $[3]; } - const c_6 = $[6] !== x; - const c_7 = $[7] !== y; let t2; - if (c_6 || c_7) { + if ($[6] !== x || $[7] !== y) { t2 = [x, y]; $[6] = x; $[7] = y; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md index e7831baf83..b06e1e47b4 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md @@ -23,9 +23,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // bar(props.b) i function AllocatingPrimitiveAsDep(props) { const $ = useMemoCache(2); const t0 = bar(props).b + 1; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = foo(t0); $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allow-passing-refs-as-props.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allow-passing-refs-as-props.expect.md index 022d17f16f..d3a8ef511a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allow-passing-refs-as-props.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/allow-passing-refs-as-props.expect.md @@ -16,9 +16,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); const ref = useRef(null); - const c_0 = $[0] !== ref; let t0; - if (c_0) { + if ($[0] !== ref) { t0 = ; $[0] = ref; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md index eb37eac767..ace266beae 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md @@ -25,16 +25,12 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c) { const $ = useMemoCache(10); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; - const c_2 = $[2] !== c; let x; let z; - if (c_0 || c_1 || c_2) { + if ($[0] !== a || $[1] !== b || $[2] !== c) { x = [a]; - const c_5 = $[5] !== b; let t0; - if (c_5) { + if ($[5] !== b) { t0 = [null, b]; $[5] = b; $[6] = t0; @@ -54,10 +50,8 @@ function foo(a, b, c) { x = $[3]; z = $[4]; } - const c_7 = $[7] !== x; - const c_8 = $[8] !== z; let t1; - if (c_7 || c_8) { + if ($[7] !== x || $[8] !== z) { t1 = [x, z]; $[7] = x; $[8] = z; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md index 330045c423..0429688072 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md @@ -20,9 +20,8 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.x; let t0; - if (c_0) { + if ($[0] !== props.x) { t0 = foo(props.x); $[0] = props.x; $[1] = t0; @@ -30,10 +29,8 @@ function Component(props) { t0 = $[1]; } const x = t0; - const c_2 = $[2] !== props; - const c_3 = $[3] !== x; let t1; - if (c_2 || c_3) { + if ($[2] !== props || $[3] !== x) { t1 = function () { const arr = [...bar(props)]; return arr.at(x); @@ -45,9 +42,8 @@ function Component(props) { t1 = $[4]; } const fn = t1; - const c_5 = $[5] !== fn; let t2; - if (c_5) { + if ($[5] !== fn) { t2 = fn(); $[5] = fn; $[6] = t2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md index 786fb20054..e551b5d439 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md @@ -23,18 +23,16 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // arrayInstance. // - mutate on lvalue function ArrayAtTest(props) { const $ = useMemoCache(9); - const c_0 = $[0] !== props.x; let t0; - if (c_0) { + if ($[0] !== props.x) { t0 = foo(props.x); $[0] = props.x; $[1] = t0; } else { t0 = $[1]; } - const c_2 = $[2] !== t0; let t1; - if (c_2) { + if ($[2] !== t0) { t1 = [t0]; $[2] = t0; $[3] = t1; @@ -42,13 +40,10 @@ function ArrayAtTest(props) { t1 = $[3]; } const arr = t1; - const c_4 = $[4] !== props.y; - const c_5 = $[5] !== arr; let t3; - if (c_4 || c_5) { - const c_7 = $[7] !== props.y; + if ($[4] !== props.y || $[5] !== arr) { let t2; - if (c_7) { + if ($[7] !== props.y) { t2 = bar(props.y); $[7] = props.y; $[8] = t2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md index bce6e3d794..615ac70f4f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md @@ -21,10 +21,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(3); - const c_0 = $[0] !== props.foo; - const c_1 = $[1] !== props.bar; let t0; - if (c_0 || c_1) { + if ($[0] !== props.foo || $[1] !== props.bar) { t0 = [0, ...props.foo, null, ...props.bar, "z"]; $[0] = props.foo; $[1] = props.bar; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-join.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-join.expect.md index 0ce1b81ccc..7504faa7b2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-join.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-join.expect.md @@ -28,9 +28,8 @@ function Component(props) { t0 = $[0]; t1 = $[1]; } - const c_2 = $[2] !== props.value; let t2; - if (c_2) { + if ($[2] !== props.value) { t2 = [t0, t1, props.value]; $[2] = props.value; $[3] = t2; @@ -47,10 +46,8 @@ function Component(props) { } const y = x.join(t3); foo(y); - const c_5 = $[5] !== x; - const c_6 = $[6] !== y; let t4; - if (c_5 || c_6) { + if ($[5] !== x || $[6] !== y) { t4 = [x, y]; $[5] = x; $[6] = y; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-captures-receiver-noAlias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-captures-receiver-noAlias.expect.md index b83e08b90f..c07c8742dd 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-captures-receiver-noAlias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-captures-receiver-noAlias.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { const item = { a: props.a }; const items = [item]; t0 = items.map((item_0) => item_0); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-noAlias-escaping-function.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-noAlias-escaping-function.expect.md index af22a304df..9105970f7f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-noAlias-escaping-function.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-noAlias-escaping-function.expect.md @@ -30,9 +30,8 @@ function Component(props) { t0 = $[0]; } const f = t0; - const c_1 = $[1] !== props.items; let t1; - if (c_1) { + if ($[1] !== props.items) { t1 = [...props.items].map(f); $[1] = props.items; $[2] = t1; @@ -40,9 +39,8 @@ function Component(props) { t1 = $[2]; } const x = t1; - const c_3 = $[3] !== x; let t2; - if (c_3) { + if ($[3] !== x) { t2 = [x, f]; $[3] = x; $[4] = t2; 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 71c3d478bb..fd86a88849 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 @@ -23,9 +23,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function component(t16) { const $ = useMemoCache(7); const [a, b] = t16; - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -33,9 +32,8 @@ function component(t16) { t0 = $[1]; } const y = t0; - const c_2 = $[2] !== b; let t1; - if (c_2) { + if ($[2] !== b) { t1 = { b }; $[2] = b; $[3] = t1; @@ -43,10 +41,8 @@ function component(t16) { t1 = $[3]; } const z = t1; - const c_4 = $[4] !== y; - const c_5 = $[5] !== z; let t2; - if (c_4 || c_5) { + if ($[4] !== y || $[5] !== z) { t2 = [y, z]; $[4] = y; $[5] = z; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md index 7038f7b1c7..72b8cd76df 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md @@ -23,10 +23,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let t0; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { t0 = [props.a, props.b, "hello"]; $[0] = props.a; $[1] = props.b; @@ -37,11 +35,8 @@ function Component(props) { const a = t0; const x = a.length; const y = a.push; - const c_3 = $[3] !== a; - const c_4 = $[4] !== x; - const c_5 = $[5] !== y; let t1; - if (c_3 || c_4 || c_5) { + if ($[3] !== a || $[4] !== x || $[5] !== y) { t1 = { a, x, y, z: a.concat }; $[3] = a; $[4] = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md index 8a0bcdb0e6..e5412424d3 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md @@ -24,11 +24,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(11); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let t0; let a; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { a = [props.a, props.b, "hello"]; t0 = a.push(42); $[0] = props.a; @@ -40,10 +38,8 @@ function Component(props) { a = $[3]; } const x = t0; - const c_4 = $[4] !== a; - const c_5 = $[5] !== props.c; let t1; - if (c_4 || c_5) { + if ($[4] !== a || $[5] !== props.c) { t1 = a.at(props.c); $[4] = a; $[5] = props.c; @@ -52,11 +48,8 @@ function Component(props) { t1 = $[6]; } const y = t1; - const c_7 = $[7] !== a; - const c_8 = $[8] !== x; - const c_9 = $[9] !== y; let t2; - if (c_7 || c_8 || c_9) { + if ($[7] !== a || $[8] !== x || $[9] !== y) { t2 = { a, x, y }; $[7] = a; $[8] = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md index 2366c7cb86..8e0ab318d8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md @@ -24,9 +24,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // arrayInstance. // - mutate on receiver function Component(props) { const $ = useMemoCache(8); - const c_0 = $[0] !== props.x; let t0; - if (c_0) { + if ($[0] !== props.x) { t0 = foo(props.x); $[0] = props.x; $[1] = t0; @@ -34,9 +33,8 @@ function Component(props) { t0 = $[1]; } const x = t0; - const c_2 = $[2] !== props.y; let t1; - if (c_2) { + if ($[2] !== props.y) { t1 = { y: props.y }; $[2] = props.y; $[3] = t1; @@ -44,10 +42,8 @@ function Component(props) { t1 = $[3]; } const y = t1; - const c_4 = $[4] !== x; - const c_5 = $[5] !== y; let arr; - if (c_4 || c_5) { + if ($[4] !== x || $[5] !== y) { arr = []; let t2; if ($[7] === Symbol.for("react.memo_cache_sentinel")) { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md index 78152a3bba..9b2998ed97 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md @@ -17,9 +17,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @gating const ErrorView = isForgetEnabled_Fixtures() ? (error, _retry) => { const $ = useMemoCache(2); - const c_0 = $[0] !== error; let t0; - if (c_0) { + if ($[0] !== error) { t0 = ; $[0] = error; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md index 33230b0871..9c069b3cd2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.x; let x; - if (c_0) { + if ($[0] !== props.x) { x = [props.x]; x[0] = x[0] * 2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md index e38d0776f2..dbb715b8cc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md @@ -23,9 +23,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function g(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.c; let a; - if (c_0) { + if ($[0] !== props.c) { a = { b: { c: props.c } }; a.b.c = a.b.c + 1; a.b.c = a.b.c * 2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md index 5ad3a3e801..e53405a71f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md @@ -16,9 +16,8 @@ async function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; async function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.id; let x; - if (c_0) { + if ($[0] !== props.id) { x = []; await populateData(props.id, x); $[0] = props.id; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await.expect.md index 42176f985d..1a2c0798aa 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/await.expect.md @@ -15,9 +15,8 @@ async function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; async function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.id; let t0; - if (c_0) { + if ($[0] !== props.id) { t0 = await load(props.id); $[0] = props.id; $[1] = t0; @@ -25,9 +24,8 @@ async function Component(props) { t0 = $[1]; } const user = t0; - const c_2 = $[2] !== user.name; let t1; - if (c_2) { + if ($[2] !== user.name) { t1 =
{user.name}
; $[2] = user.name; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md index 7a9fbce63e..55c97f0a6d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md @@ -33,9 +33,8 @@ function Component(props) { const $ = useMemoCache(4); const [x] = useState(0); let t35; - const c_0 = $[0] !== x; let t0; - if (c_0) { + if ($[0] !== x) { t0 = calculateExpensiveNumber(x); $[0] = x; $[1] = t0; @@ -44,9 +43,8 @@ function Component(props) { } t35 = t0; const expensiveNumber = t35; - const c_2 = $[2] !== expensiveNumber; let t1; - if (c_2) { + if ($[2] !== expensiveNumber) { t1 =
{expensiveNumber}
; $[2] = expensiveNumber; $[3] = t1; @@ -60,9 +58,8 @@ function Component2(props) { const $ = useMemoCache(4); const [x] = useState(0); let t35; - const c_0 = $[0] !== x; let t0; - if (c_0) { + if ($[0] !== x) { t0 = calculateExpensiveNumber(x); $[0] = x; $[1] = t0; @@ -71,9 +68,8 @@ function Component2(props) { } t35 = t0; const expensiveNumber = t35; - const c_2 = $[2] !== expensiveNumber; let t1; - if (c_2) { + if ($[2] !== expensiveNumber) { t1 =
{expensiveNumber}
; $[2] = expensiveNumber; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-kitchensink-import.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-kitchensink-import.expect.md index db03ab401a..2c5e9f66ca 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-kitchensink-import.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-kitchensink-import.expect.md @@ -35,9 +35,8 @@ function Component(props) { const $ = useMemoCache(4); const [x] = useState(0); let t35; - const c_0 = $[0] !== x; let t0; - if (c_0) { + if ($[0] !== x) { t0 = calculateExpensiveNumber(x); $[0] = x; $[1] = t0; @@ -46,9 +45,8 @@ function Component(props) { } t35 = t0; const expensiveNumber = t35; - const c_2 = $[2] !== expensiveNumber; let t1; - if (c_2) { + if ($[2] !== expensiveNumber) { t1 =
{expensiveNumber}
; $[2] = expensiveNumber; $[3] = t1; @@ -62,9 +60,8 @@ function Component2(props) { const $ = useMemoCache(4); const [x] = useState(0); let t35; - const c_0 = $[0] !== x; let t0; - if (c_0) { + if ($[0] !== x) { t0 = calculateExpensiveNumber(x); $[0] = x; $[1] = t0; @@ -73,9 +70,8 @@ function Component2(props) { } t35 = t0; const expensiveNumber = t35; - const c_2 = $[2] !== expensiveNumber; let t1; - if (c_2) { + if ($[2] !== expensiveNumber) { t1 =
{expensiveNumber}
; $[2] = expensiveNumber; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md index 03bc5e12db..a4a94cb310 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md @@ -32,9 +32,8 @@ function Component(props) { let t39; t39 = calculateExpensiveNumber(x); const expensiveNumber = t39; - const c_0 = $[0] !== expensiveNumber; let t0; - if (c_0) { + if ($[0] !== expensiveNumber) { t0 =
{expensiveNumber}
; $[0] = expensiveNumber; $[1] = t0; 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 8151afa038..c35529e029 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 @@ -30,9 +30,8 @@ function App(t23) { hasDeps ? null : [text]; let t44; - const c_0 = $[0] !== text; let t0; - if (c_0) { + if ($[0] !== text) { t0 = text.toUpperCase(); $[0] = text; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md index 4bdda2e2aa..d20165ddc8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md @@ -23,9 +23,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function component(t) { const $ = useMemoCache(2); const { a } = t; - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-spread.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-spread.expect.md index d32100757b..da219eabac 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-spread.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-spread.expect.md @@ -15,10 +15,8 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(3); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let t0; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { t0 = foo(...props.a, null, ...props.b); $[0] = props.a; $[1] = props.b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md index ac3985eaff..052b76f042 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md @@ -20,13 +20,11 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props; let t1; - if (c_0) { + if ($[0] !== props) { const x = makeFunction(props); - const c_2 = $[2] !== props.text; let t0; - if (c_2) { + if ($[2] !== props.text) { t0 = (
{props.text} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias-iife.expect.md index 57222d17f0..1a230a9371 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias-iife.expect.md @@ -28,9 +28,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let x; - if (c_0) { + if ($[0] !== a) { x = { a }; const q = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md index 1fa9f50bdb..a746cdc88d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md @@ -30,9 +30,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let x; - if (c_0) { + if ($[0] !== a) { x = { a }; const f0 = function () { const q = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md index 328d6219e5..0279315454 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md @@ -48,9 +48,8 @@ function getNativeLogFunction(level) { import { unstable_useMemoCache as useMemoCache } from "react"; function getNativeLogFunction(level) { const $ = useMemoCache(2); - const c_0 = $[0] !== level; let t0; - if (c_0) { + if ($[0] !== level) { t0 = function () { let str = undefined; if (arguments.length === 1 && typeof arguments[0] === "string") { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns-iife.expect.md index 9075d8227c..1e7dbb6f1b 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns-iife.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let z; - if (c_0) { + if ($[0] !== a) { z = { a }; (function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md index 2ef607c8e1..e94dffda47 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md @@ -28,9 +28,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let z; - if (c_0) { + if ($[0] !== a) { z = { a }; const f0 = function () { const f1 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md index c35ba9bf14..c609191d27 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -34,9 +33,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = () => { console.log(z); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md index a7a73a9634..8dced458d9 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md @@ -31,10 +31,8 @@ import { mutate } from "shared-runtime"; function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let x; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { x = { foo }; const y = { bar }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md index d32fdd146e..4e994cfb63 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md @@ -23,10 +23,8 @@ function component(foo, bar) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let x; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { x = { foo }; const y = { bar }; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md index 6c7a08d7f5..92af83e719 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md @@ -31,10 +31,8 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let x; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { x = { foo }; const y = { bar }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md index 6dfb8707a0..b6ce0d6667 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md @@ -23,10 +23,8 @@ function component(foo, bar) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let x; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { x = { foo }; const y = { bar }; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md index e8e6df8f43..0d3e5fbb13 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md @@ -31,10 +31,8 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let y; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { const x = { foo }; y = { bar }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md index 90526c7bc6..f919bcd5f0 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md @@ -23,10 +23,8 @@ function component(foo, bar) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let y; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { const x = { foo }; y = { bar }; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md index a94c12ac82..7e1f61b513 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md @@ -31,10 +31,8 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let y; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { const x = { foo }; y = { bar }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md index 213bea05df..0c8f940d08 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md @@ -23,10 +23,8 @@ function component(foo, bar) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(foo, bar) { const $ = useMemoCache(3); - const c_0 = $[0] !== foo; - const c_1 = $[1] !== bar; let y; - if (c_0 || c_1) { + if ($[0] !== foo || $[1] !== bar) { const x = { foo }; y = { bar }; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate-iife.expect.md index 68b8296b87..464e58475f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate-iife.expect.md @@ -29,9 +29,8 @@ const { mutate } = require("shared-runtime"); function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md index e115efcf35..5e59e76b10 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md @@ -21,9 +21,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate-iife.expect.md index a7d9adb964..d5cc78539b 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate-iife.expect.md @@ -29,9 +29,8 @@ const { mutate } = require("shared-runtime"); function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md index a1389d73a7..ded6a69e4d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md @@ -21,9 +21,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.md index e6687b71f5..9347be5e7f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate-iife.expect.md @@ -30,9 +30,8 @@ import { mutate } from "shared-runtime"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md index 3bade6dab2..18ca65332c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md @@ -22,9 +22,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.md index 26f9308f21..08573715fe 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate-iife.expect.md @@ -30,9 +30,8 @@ const { mutate } = require("shared-runtime"); function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md index 7eb8182138..fbd7214574 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md @@ -22,9 +22,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md index a694c4233b..2853503c65 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md @@ -27,9 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(5); - const c_0 = $[0] !== b; let t0; - if (c_0) { + if ($[0] !== b) { t0 = { b }; $[0] = b; $[1] = t0; @@ -37,10 +36,8 @@ function component(a, b) { t0 = $[1]; } const y = t0; - const c_2 = $[2] !== a; - const c_3 = $[3] !== y.b; let z; - if (c_2 || c_3) { + if ($[2] !== a || $[3] !== y.b) { z = { a }; const x = function () { z.a = 2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md index 00860cf875..b9b4754af7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md index 2f385edd24..55916de57a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md @@ -25,9 +25,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { y = { b: { a } }; const x = function () { y.b.a = 2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md index 1fd96e4230..2a426b8ac6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md @@ -27,10 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(3); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; let z; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== b) { z = { a }; const y = { b }; const x = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.md index 1b4e8bd955..52a75942d2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias-iife.expect.md @@ -29,9 +29,8 @@ const { mutate } = require("shared-runtime"); function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md index 8fc678aedf..dbb9d829ad 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md @@ -21,9 +21,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md index 54ac22fd4e..46d7a9d324 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -34,9 +33,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = function () { console.log(z); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.md index 608d053ca1..b504f49445 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2-iife.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md index 5c981fbaba..7eab8e7005 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md @@ -27,9 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.md index f29b8495e2..f6dfc8e725 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3-iife.expect.md @@ -28,10 +28,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a, b) { const $ = useMemoCache(3); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; let y; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== b) { const x = [a, b]; y = {}; let t; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md index fad4cf4324..71a776211f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md @@ -29,10 +29,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a, b) { const $ = useMemoCache(3); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; let y; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== b) { const x = [a, b]; y = {}; let t; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.md index 3dbc9ff32b..4583dec6fd 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4-iife.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md index c188be70fb..a39ef3296e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md @@ -27,9 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.md index 1451d45247..b1135e090e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-iife.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md index 51832261fc..d34b24b05f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md @@ -27,9 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function bar(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = [a]; y = {}; const f0 = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md index 76d2ef6f19..f2be885234 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md @@ -25,9 +25,8 @@ function component(a, b) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(7); - const c_0 = $[0] !== a; let z; - if (c_0) { + if ($[0] !== a) { z = { a }; mutate(z); @@ -38,9 +37,8 @@ function component(a, b) { } let y = z; - const c_2 = $[2] !== b; let t0; - if (c_2) { + if ($[2] !== b) { t0 = { b }; $[2] = b; $[3] = t0; @@ -48,10 +46,8 @@ function component(a, b) { t0 = $[3]; } const z_0 = t0; - const c_4 = $[4] !== y; - const c_5 = $[5] !== z_0; let t1; - if (c_4 || c_5) { + if ($[4] !== y || $[5] !== z_0) { t1 = { y, z: z_0 }; $[4] = y; $[5] = z_0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md index 700a0094f1..731c860ec0 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md @@ -25,9 +25,8 @@ function component(a, b) { import { unstable_useMemoCache as useMemoCache } from "react"; // @debug function component(a, b) { const $ = useMemoCache(5); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -36,10 +35,8 @@ function component(a, b) { } const z = t0; const y = b; - const c_2 = $[2] !== y; - const c_3 = $[3] !== z; let t1; - if (c_2 || c_3) { + if ($[2] !== y || $[3] !== z) { t1 = function () { if (y) { maybeMutate(z); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md index 3309e2ef87..21a5e1883e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md @@ -25,9 +25,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t; - if (c_0) { + if ($[0] !== a) { t = { a }; const x = function x() { t.foo(); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md index 64a15a00d1..8a31cc99af 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md @@ -21,9 +21,8 @@ function Foo(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.router.location; let t0; - if (c_0) { + if ($[0] !== props.router.location) { t0 = (reason) => { log(props.router.location); }; 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 9d28478e70..c6a0e93ff2 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 @@ -23,9 +23,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function component(t26) { const $ = useMemoCache(7); const { mutator } = t26; - const c_0 = $[0] !== mutator; let t0; - if (c_0) { + if ($[0] !== mutator) { t0 = () => { mutator.poke(); }; @@ -35,9 +34,8 @@ function component(t26) { t0 = $[1]; } const poke = t0; - const c_2 = $[2] !== mutator.user; let t1; - if (c_2) { + if ($[2] !== mutator.user) { t1 = () => { mutator.user.hide(); }; @@ -47,10 +45,8 @@ function component(t26) { t1 = $[3]; } const hide = t1; - const c_4 = $[4] !== poke; - const c_5 = $[5] !== hide; let t2; - if (c_4 || c_5) { + if ($[4] !== poke || $[5] !== hide) { t2 = ; $[4] = poke; $[5] = hide; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md index 346acbabcf..df3ffa8a86 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md @@ -21,9 +21,8 @@ function component(a, b) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md index c294e7eb01..b8f57f30e2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md @@ -16,9 +16,8 @@ function component(a, b) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(6); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -26,9 +25,8 @@ function component(a, b) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = () => {z}; $[2] = z; $[3] = t1; @@ -36,9 +34,8 @@ function component(a, b) { t1 = $[3]; } const p = t1; - const c_4 = $[4] !== p; let t2; - if (c_4) { + if ($[4] !== p) { t2 = p(); $[4] = p; $[5] = t2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md index d0c17b5936..061b098d68 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md @@ -21,9 +21,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function StoreLandingUnseenGiftModalContainer(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { const giftsSeen = { a }; t0 = ((gift) => (gift.id ? giftsSeen[gift.id] : false))(); $[0] = a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md index adb4d6371f..c615a47036 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md @@ -27,9 +27,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -37,9 +36,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = function () { console.log(z); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md index cc3acf6c6c..24a795127d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -34,9 +33,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z.a; let t1; - if (c_2) { + if ($[2] !== z.a) { t1 = function () { console.log(z.a); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md index 9725ed6b7c..6143759583 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a: { a } }; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md index ec43972dd2..456c5aaeb6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a: { a } }; $[0] = a; $[1] = t0; @@ -36,9 +35,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z.a.a; let t1; - if (c_2) { + if ($[2] !== z.a.a) { t1 = function () { (function () { console.log(z.a.a); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md index 2be79b9fcb..e02f879899 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a: { a } }; $[0] = a; $[1] = t0; @@ -34,9 +33,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z.a.a; let t1; - if (c_2) { + if ($[2] !== z.a.a) { t1 = function () { console.log(z.a.a); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-reference-changes-type.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-reference-changes-type.expect.md index 9eb3a2da1b..0fea81ee0a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-reference-changes-type.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-reference-changes-type.expect.md @@ -20,9 +20,8 @@ function component(a) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let y; - if (c_0) { + if ($[0] !== a) { const x = { a }; y = 1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md index 66ca55f119..18e2f9c688 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -36,9 +35,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = function () { console.log(z); }; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md index 2f7ad7de80..43b8a4f22e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a }; $[0] = a; $[1] = t0; @@ -36,9 +35,8 @@ function component(a) { t0 = $[1]; } const z = t0; - const c_2 = $[2] !== z; let t1; - if (c_2) { + if ($[2] !== z) { t1 = function () { (function () { console.log(z); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-imports-same-source.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-imports-same-source.expect.md index 501f56c6f3..1ee3b6a5a6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-imports-same-source.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-imports-same-source.expect.md @@ -19,9 +19,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @enableEmitFre function useFoo(props) { if (__DEV__) useRenderCounter("useFoo"); const $ = useMemoCache(2); - const c_0 = $[0] !== props.x; let t0; - if (c_0) { + if ($[0] !== props.x) { t0 = foo(props.x); $[0] = props.x; $[1] = __DEV__ ? makeReadOnly(t0, "useFoo") : t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md index 4b6eb10ce8..0de0951ade 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md @@ -24,10 +24,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @enableEmitFre function MyComponentName(props) { const $ = useMemoCache(5); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let x; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { x = {}; foo(x, props.a); foo(x, props.b); @@ -37,9 +35,8 @@ function MyComponentName(props) { } else { x = $[2]; } - const c_3 = $[3] !== x; let y; - if (c_3) { + if ($[3] !== x) { y = []; y.push(x); $[3] = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-gating-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-gating-test.expect.md index 811d188e52..559bc6dc96 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-gating-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-gating-test.expect.md @@ -30,9 +30,8 @@ const Bar = isForgetEnabled_Fixtures() ? function Bar(props) { if (__DEV__) useRenderCounter("Bar"); const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -54,9 +53,8 @@ const Foo = isForgetEnabled_Fixtures() ? function Foo(props) { if (__DEV__) useRenderCounter("Foo"); const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-test.expect.md index b7bbb65fc9..d03a97a01e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/codegen-instrument-forget-test.expect.md @@ -29,9 +29,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @instrumentFor function Bar(props) { if (__DEV__) useRenderCounter("Bar"); const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -48,9 +47,8 @@ function NoForget(props) { function Foo(props) { if (__DEV__) useRenderCounter("Foo"); const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; 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 ad9dd87947..dd0f79f6ab 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 @@ -17,9 +17,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; export default function Foo(t7) { const $ = useMemoCache(2); const { bar } = t7; - const c_0 = $[0] !== bar; let t0; - if (c_0) { + if ($[0] !== bar) { t0 = ; $[0] = bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component.expect.md index 172978eb00..960f68fa7f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/component.expect.md @@ -45,10 +45,8 @@ function Component(props) { const $ = useMemoCache(8); const items = props.items; const maxItems = props.maxItems; - const c_0 = $[0] !== maxItems; - const c_1 = $[1] !== items; let renderedItems; - if (c_0 || c_1) { + if ($[0] !== maxItems || $[1] !== items) { renderedItems = []; const seen = new Set(); const max = Math.max(0, maxItems); @@ -72,19 +70,16 @@ function Component(props) { } const count = renderedItems.length; - const c_3 = $[3] !== count; let t0; - if (c_3) { + if ($[3] !== count) { t0 =

{count} Items

; $[3] = count; $[4] = t0; } else { t0 = $[4]; } - const c_5 = $[5] !== t0; - const c_6 = $[6] !== renderedItems; let t1; - if (c_5 || c_6) { + if ($[5] !== t0 || $[6] !== renderedItems) { t1 = (
{t0} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md index 04af67209d..6f5a492608 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md @@ -15,11 +15,8 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.method; - const c_1 = $[1] !== props.a; - const c_2 = $[2] !== props.b; let t0; - if (c_0 || c_1 || c_2) { + if ($[0] !== props.method || $[1] !== props.a || $[2] !== props.b) { t0 = foo[props.method](...props.a, null, ...props.b); $[0] = props.method; $[1] = props.a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md index 2f9e6f6f57..bcf4cbc25e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md @@ -23,9 +23,8 @@ function Component(props) { const a = foo(); const t0 = a[props.a] + 1; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = bar(t0); $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md index d2c9a0e405..b0e238605e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md @@ -18,10 +18,8 @@ function component(a, b) { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a, b) { const $ = useMemoCache(3); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; let x; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== b) { const y = { a }; x = { b }; x.y = y; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md index 9f31cdb980..0316beccaf 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md @@ -25,9 +25,8 @@ function component() { t0 = $[0]; } const handler = t0; - const c_1 = $[1] !== handler; let t1; - if (c_1) { + if ($[1] !== handler) { t1 = ; $[1] = handler; $[2] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md index b875068280..3c07349194 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md @@ -29,9 +29,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // To preserve th function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.a; let x; - if (c_0) { + if ($[0] !== props.a) { x = []; x.push(props.a?.b); $[0] = props.a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md index 9857e371f1..2f5773825e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md @@ -35,12 +35,13 @@ import { unstable_useMemoCache as useMemoCache } from "react"; */ function Component(props) { const $ = useMemoCache(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) { + if ( + $[0] !== props.a || + $[1] !== props.b || + $[2] !== props.c || + $[3] !== props.d + ) { a = []; a.push(props.a); bb1: { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break.expect.md index c2637c7b16..76fee65043 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-break.expect.md @@ -67,11 +67,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; */ function ComponentA(props) { const $ = useMemoCache(4); - 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) { + if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.d) { a_DEBUG = []; a_DEBUG.push(props.a); if (props.b) { @@ -94,9 +91,8 @@ function ComponentA(props) { */ function ComponentB(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let a; - if (c_0) { + if ($[0] !== props) { a = []; a.push(props.a); if (props.b) { @@ -117,9 +113,8 @@ function ComponentB(props) { */ function ComponentC(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let a; - if (c_0) { + if ($[0] !== props) { a = []; a.push(props.a); if (props.b) { @@ -141,9 +136,8 @@ function ComponentC(props) { */ function ComponentD(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let a; - if (c_0) { + if ($[0] !== props) { a = []; a.push(props.a); if (props.b) { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md index 86fa304bbb..4ab5599071 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md @@ -37,10 +37,9 @@ function mayMutate() {} import { unstable_useMemoCache as useMemoCache } from "react"; function ComponentA(props) { const $ = useMemoCache(6); - const c_0 = $[0] !== props; let a; let b; - if (c_0) { + if ($[0] !== props) { a = []; b = []; if (b) { @@ -56,10 +55,8 @@ function ComponentA(props) { a = $[1]; b = $[2]; } - const c_3 = $[3] !== a; - const c_4 = $[4] !== b; let t0; - if (c_3 || c_4) { + if ($[3] !== a || $[4] !== b) { t0 = ; $[3] = a; $[4] = b; @@ -72,10 +69,9 @@ function ComponentA(props) { function ComponentB(props) { const $ = useMemoCache(6); - const c_0 = $[0] !== props; let a; let b; - if (c_0) { + if ($[0] !== props) { a = []; b = []; if (mayMutate(b)) { @@ -91,10 +87,8 @@ function ComponentB(props) { a = $[1]; b = $[2]; } - const c_3 = $[3] !== a; - const c_4 = $[4] !== b; let t0; - if (c_3 || c_4) { + if ($[3] !== a || $[4] !== b) { t0 = ; $[3] = a; $[4] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/console-readonly.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/console-readonly.expect.md index 0c1286b72b..66900d06ae 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/console-readonly.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/console-readonly.expect.md @@ -32,9 +32,8 @@ import { shallowCopy } from "shared-runtime"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let t0; - if (c_0) { + if ($[0] !== props) { t0 = shallowCopy(props); $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-computed.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-computed.expect.md index 59a22741f5..8f0088e0ca 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-computed.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-computed.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.foo; let x; - if (c_0) { + if ($[0] !== props.foo) { x = {}; x.foo = x.foo + x.bar; x.foo(props.foo); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis.expect.md index b42871a3b4..7aafdc8064 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/constant-propagate-global-phis.expect.md @@ -39,9 +39,8 @@ function Test() { const $ = useMemoCache(2); const { tab } = useFoo(); const currentTab = tab === CONST_STRING0 ? CONST_STRING0 : CONST_STRING1; - const c_0 = $[0] !== currentTab; let t0; - if (c_0) { + if ($[0] !== currentTab) { t0 = ; $[0] = currentTab; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/controlled-input.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/controlled-input.expect.md index 5ca23b5f49..285ab4acc6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/controlled-input.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/controlled-input.expect.md @@ -32,10 +32,8 @@ function component() { t0 = $[0]; } const handler = t0; - const c_1 = $[1] !== handler; - const c_2 = $[2] !== x; let t1; - if (c_1 || c_2) { + if ($[1] !== handler || $[2] !== x) { t1 = ; $[1] = handler; $[2] = x; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/debugger-memoized.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/debugger-memoized.expect.md index b76c578c44..be49b921e3 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/debugger-memoized.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/debugger-memoized.expect.md @@ -23,9 +23,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.value; let x; - if (c_0) { + if ($[0] !== props.value) { x = []; debugger; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-array-with-unary.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-array-with-unary.expect.md index 3db2d45363..13ef0db583 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-array-with-unary.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-array-with-unary.expect.md @@ -19,9 +19,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t0) { const $ = useMemoCache(2); - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? [-1, 1] : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-calls-global-function.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-calls-global-function.expect.md index 7b3d629fa8..b4d1a2fdcc 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-calls-global-function.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-calls-global-function.expect.md @@ -23,9 +23,8 @@ import { identity } from "shared-runtime"; function Component(t0) { const $ = useMemoCache(2); - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? identity([() => {}, true, 42, "hello"]) : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-empty-callback.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-empty-callback.expect.md index 60c012bed9..e77eb1b181 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-empty-callback.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-empty-callback.expect.md @@ -19,9 +19,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t0) { const $ = useMemoCache(2); - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? () => {} : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.expect.md index 94705daf04..fce18ff379 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/default-param-with-reorderable-callback.expect.md @@ -19,9 +19,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t0) { const $ = useMemoCache(2); - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? () => [-1, true, 42, "hello"] : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md index 40aec57088..e0adcfeb08 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md @@ -23,10 +23,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(3); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let x; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { x = { a: props.a, b: props.b }; delete x["b"]; $[0] = props.a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-property.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-property.expect.md index b6c46c1652..b44af9cf1f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-property.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/delete-property.expect.md @@ -22,10 +22,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(3); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let x; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { x = { a: props.a, b: props.b }; delete x.b; $[0] = props.a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md index a1a77ad17f..2095376198 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md @@ -31,9 +31,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b) { const $ = useMemoCache(5); - const c_0 = $[0] !== a; let x; - if (c_0) { + if ($[0] !== a) { x = []; x.push(a); $[0] = a; @@ -41,10 +40,8 @@ function foo(a, b) { } else { x = $[1]; } - const c_2 = $[2] !== x; - const c_3 = $[3] !== b; let y; - if (c_2 || c_3) { + if ($[2] !== x || $[3] !== b) { y = []; if (x.length) { y.push(x); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies.expect.md index 506ca267a7..796e4db1df 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/dependencies.expect.md @@ -34,10 +34,8 @@ function foo(x, y, z) { const $ = useMemoCache(3); const items = [z]; items.push(x); - const c_0 = $[0] !== x; - const c_1 = $[1] !== y; let items2; - if (c_0 || c_1) { + if ($[0] !== x || $[1] !== y) { items2 = []; if (x) { items2.push(y); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md index 133bfc870e..38fa64cfa1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md @@ -23,9 +23,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; let someGlobal = {}; function component(a) { const $ = useMemoCache(2); - const c_0 = $[0] !== a; let t0; - if (c_0) { + if ($[0] !== a) { t0 = { a, someGlobal }; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.expect.md index cabb14eea1..cf0ab877d5 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructure-default-array-with-unary.expect.md @@ -21,9 +21,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); const [t0] = props.value; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? [-1, 1] : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md index 0c993195d4..7fb1cc2d79 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md @@ -22,9 +22,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); const [t0] = props.y; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? ["default"] : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md index d50b4a4911..4c7a5908a6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md @@ -29,9 +29,8 @@ function Component(props) { let x = undefined; if (props.cond) { const [t0] = props.y; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? ["default"] : t0; $[0] = t0; $[1] = t1; 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 0f996adb2c..f2c09bb122 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 @@ -44,12 +44,8 @@ function foo(a, b, c) { const { m: t58 } = t55; const [t60] = t58; const [n] = t60; - const c_0 = $[0] !== d; - const c_1 = $[1] !== g; - const c_2 = $[2] !== n; - const c_3 = $[3] !== o; let t0; - if (c_0 || c_1 || c_2 || c_3) { + if ($[0] !== d || $[1] !== g || $[2] !== n || $[3] !== o) { t0 = { d, g, n, o }; $[0] = d; $[1] = g; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md index f12061aa0a..f883f06bce 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md @@ -58,17 +58,15 @@ function useFragment(_arg1, _arg2) { function Component(props) { const $ = useMemoCache(16); const post = useFragment(graphql`...`, props.post); - const c_0 = $[0] !== post; let media; let allUrls; let onClick; - if (c_0) { + if ($[0] !== post) { allUrls = []; const { media: t0, comments: t2, urls: t4 } = post; - const c_4 = $[4] !== t0; let t1; - if (c_4) { + if ($[4] !== t0) { t1 = t0 === undefined ? null : t0; $[4] = t0; $[5] = t1; @@ -76,9 +74,8 @@ function Component(props) { t1 = $[5]; } media = t1; - const c_6 = $[6] !== t2; let t3; - if (c_6) { + if ($[6] !== t2) { t3 = t2 === undefined ? [] : t2; $[6] = t2; $[7] = t3; @@ -86,9 +83,8 @@ function Component(props) { t3 = $[7]; } const comments = t3; - const c_8 = $[8] !== t4; let t5; - if (c_8) { + if ($[8] !== t4) { t5 = t4 === undefined ? [] : t4; $[8] = t4; $[9] = t5; @@ -96,9 +92,8 @@ function Component(props) { t5 = $[9]; } const urls = t5; - const c_10 = $[10] !== comments.length; let t6; - if (c_10) { + if ($[10] !== comments.length) { t6 = (e) => { if (!comments.length) { return; @@ -123,11 +118,8 @@ function Component(props) { allUrls = $[2]; onClick = $[3]; } - const c_12 = $[12] !== media; - const c_13 = $[13] !== allUrls; - const c_14 = $[14] !== onClick; let t7; - if (c_12 || c_13 || c_14) { + if ($[12] !== media || $[13] !== allUrls || $[14] !== onClick) { t7 = ; $[12] = media; $[13] = allUrls; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md index 9d606ddc5b..83f9bb28a8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md @@ -32,17 +32,15 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(8); const post = useFragment(graphql`...`, props.post); - const c_0 = $[0] !== post; let media; let onClick; - if (c_0) { + if ($[0] !== post) { const allUrls = []; const { media: t83, comments, urls } = post; media = t83; - const c_3 = $[3] !== comments.length; let t0; - if (c_3) { + if ($[3] !== comments.length) { t0 = (e) => { if (!comments.length) { return; @@ -65,10 +63,8 @@ function Component(props) { media = $[1]; onClick = $[2]; } - const c_5 = $[5] !== media; - const c_6 = $[6] !== onClick; let t1; - if (c_5 || c_6) { + if ($[5] !== media || $[6] !== onClick) { t1 = ; $[5] = media; $[6] = onClick; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md index d78ade2d0e..5d9156f3be 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md @@ -22,9 +22,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); const { x: t0 } = props.y; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? { y: "default" } : t0; $[0] = t0; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-pattern-within-rest.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-pattern-within-rest.expect.md index 441af29219..091a674e0e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-pattern-within-rest.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-object-pattern-within-rest.expect.md @@ -20,10 +20,9 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(6); - const c_0 = $[0] !== props.value; let t0; let y; - if (c_0) { + if ($[0] !== props.value) { [y, ...t0] = props.value; $[0] = props.value; $[1] = t0; @@ -33,10 +32,8 @@ function Component(props) { y = $[2]; } const { z } = t0; - const c_3 = $[3] !== y; - const c_4 = $[4] !== z; let t1; - if (c_3 || c_4) { + if ($[3] !== y || $[4] !== z) { t1 = [y, z]; $[3] = y; $[4] = z; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-property-inference.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-property-inference.expect.md index 57536d03a9..0ec8987690 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-property-inference.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-property-inference.expect.md @@ -18,9 +18,8 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(5); - const c_0 = $[0] !== props.value; let x; - if (c_0) { + if ($[0] !== props.value) { x = []; x.push(props.value); $[0] = props.value; @@ -30,10 +29,8 @@ function Component(props) { } const { length: y } = x; foo(y); - const c_2 = $[2] !== x; - const c_3 = $[3] !== y; let t0; - if (c_2 || c_3) { + if ($[2] !== x || $[3] !== y) { t0 = [x, y]; $[2] = x; $[3] = y; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-typecast-as-default-value.flow.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-typecast-as-default-value.flow.expect.md index fe1f14ef73..1d929ee43f 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-typecast-as-default-value.flow.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/destructuring-with-typecast-as-default-value.flow.expect.md @@ -21,9 +21,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); const [t0] = props.y; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? ([]: Array) : t0; $[0] = t0; $[1] = t1; 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 334017e415..c716448ac0 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 @@ -36,11 +36,10 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c) { const $ = useMemoCache(18); - const c_0 = $[0] !== a; let t0; let d; let h; - if (c_0) { + if ($[0] !== a) { [d, t0, ...h] = a; $[0] = a; $[1] = t0; @@ -52,10 +51,9 @@ function foo(a, b, c) { h = $[3]; } const [t1] = t0; - const c_4 = $[4] !== t1; let t2; let g; - if (c_4) { + if ($[4] !== t1) { ({ e: t2, ...g } = t1); $[4] = t1; $[5] = t2; @@ -67,10 +65,9 @@ function foo(a, b, c) { const { f } = t2; const { l: t51, p } = b; const { m: t3 } = t51; - const c_7 = $[7] !== t3; let t4; let o; - if (c_7) { + if ($[7] !== t3) { [t4, ...o] = t3; $[7] = t3; $[8] = t4; @@ -80,15 +77,16 @@ function foo(a, b, c) { o = $[9]; } const [n] = t4; - const c_10 = $[10] !== d; - const c_11 = $[11] !== f; - const c_12 = $[12] !== g; - const c_13 = $[13] !== h; - const c_14 = $[14] !== n; - const c_15 = $[15] !== o; - const c_16 = $[16] !== p; let t5; - if (c_10 || c_11 || c_12 || c_13 || c_14 || c_15 || c_16) { + if ( + $[10] !== d || + $[11] !== f || + $[12] !== g || + $[13] !== h || + $[14] !== n || + $[15] !== o || + $[16] !== p + ) { t5 = [d, f, g, h, n, o, p]; $[10] = d; $[11] = f; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md index 7019e5c914..11fa43db32 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md @@ -26,9 +26,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let ret; - if (c_0) { + if ($[0] !== props) { const x = [1, 2, 3]; ret = []; do { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md index 857d4dbdbe..680bb4f9af 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md @@ -21,9 +21,8 @@ function Component(props) { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let x; - if (c_0) { + if ($[0] !== props) { x = [0, 1, 2, 3]; do { if (x === 0) { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usecallback.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usecallback.expect.md index e0552b2d8a..c84416138c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usecallback.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usecallback.expect.md @@ -26,9 +26,8 @@ import * as React from "react"; function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.value; let t0; - if (c_0) { + if ($[0] !== props.value) { t0 = () => { console.log(props.value); }; @@ -38,9 +37,8 @@ function Component(props) { t0 = $[1]; } const onClick = t0; - const c_2 = $[2] !== onClick; let t1; - if (c_2) { + if ($[2] !== onClick) { t1 =
; $[2] = onClick; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usememo.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usememo.expect.md index f181418a32..63622dd87d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usememo.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/drop-methodcall-usememo.expect.md @@ -29,9 +29,8 @@ import * as React from "react"; function Component(props) { const $ = useMemoCache(2); let t42; - const c_0 = $[0] !== props.value; let x; - if (c_0) { + if ($[0] !== props.value) { x = []; x.push(props.value); $[0] = props.value; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md index e4a62cccf6..b2167c3b55 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.a; let b; - if (c_0) { + if ($[0] !== props.a) { const { a, ...t29 } = props.a; b = t29; $[0] = props.a; @@ -34,9 +33,8 @@ function Component(props) { } else { b = $[1]; } - const c_2 = $[2] !== props.c; let d; - if (c_2) { + if ($[2] !== props.c) { const [c, ...t30] = props.c; d = t30; $[2] = props.c; @@ -44,10 +42,8 @@ function Component(props) { } else { d = $[3]; } - const c_4 = $[4] !== b; - const c_5 = $[5] !== d; let t0; - if (c_4 || c_5) { + if ($[4] !== b || $[5] !== d) { t0 =
; $[4] = b; $[5] = d; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md index 13f83fdc1b..910c184cdd 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md @@ -28,17 +28,12 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c) { const $ = useMemoCache(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) { + if ($[0] !== a || $[1] !== b || $[2] !== c) { x = []; if (a) { - const c_4 = $[4] !== b; - const c_5 = $[5] !== c; let y; - if (c_4 || c_5) { + if ($[4] !== b || $[5] !== c) { y = []; if (b) { y.push(c); @@ -49,9 +44,8 @@ function foo(a, b, c) { } else { y = $[6]; } - const c_7 = $[7] !== y; let t0; - if (c_7) { + if ($[7] !== y) { t0 =
{y}
; $[7] = y; $[8] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md index 54e17127f5..38ddc62798 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md @@ -25,9 +25,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(10); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 = [props.a]; $[0] = props.a; $[1] = t0; @@ -35,9 +34,8 @@ function Component(props) { t0 = $[1]; } const a = t0; - const c_2 = $[2] !== props.b; let t1; - if (c_2) { + if ($[2] !== props.b) { t1 = [props.b]; $[2] = props.b; $[3] = t1; @@ -45,9 +43,8 @@ function Component(props) { t1 = $[3]; } const b = t1; - const c_4 = $[4] !== props.c; let t2; - if (c_4) { + if ($[4] !== props.c) { t2 = [props.c]; $[4] = props.c; $[5] = t2; @@ -55,11 +52,8 @@ function Component(props) { t2 = $[5]; } const c = t2; - const c_6 = $[6] !== a; - const c_7 = $[7] !== b; - const c_8 = $[8] !== c; let t3; - if (c_6 || c_7 || c_8) { + if ($[6] !== a || $[7] !== b || $[8] !== c) { t3 = (a && b) || c; $[6] = a; $[7] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md index 709717619f..51f533a6b7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md @@ -32,9 +32,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(5); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 = [props.a]; $[0] = props.a; $[1] = t0; @@ -42,10 +41,8 @@ function Component(props) { t0 = $[1]; } const a = t0; - const c_2 = $[2] !== a; - const c_3 = $[3] !== props.b; let b; - if (c_2 || c_3) { + if ($[2] !== a || $[3] !== props.b) { b = []; const c = {}; c.a = a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md index 8f46c822a0..f2a350262d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md @@ -41,9 +41,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 = [props.a]; $[0] = props.a; $[1] = t0; @@ -51,9 +50,8 @@ function Component(props) { t0 = $[1]; } const a = t0; - const c_2 = $[2] !== a; let t1; - if (c_2) { + if ($[2] !== a) { t1 = [a]; $[2] = a; $[3] = t1; @@ -61,10 +59,8 @@ function Component(props) { t1 = $[3]; } const b = t1; - const c_4 = $[4] !== b; - const c_5 = $[5] !== props.b; let c; - if (c_4 || c_5) { + if ($[4] !== b || $[5] !== props.b) { c = []; const d = {}; d.b = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md index f1796beaf3..94cad821c2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md @@ -36,10 +36,8 @@ function Component(props) { const $ = useMemoCache(3); const a = props.a + props.b; - const c_0 = $[0] !== a; - const c_1 = $[1] !== props.c; let b; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== props.c) { b = []; const c = {}; c.a = a; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md index 479836af1b..a76139b660 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md @@ -31,11 +31,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; - const c_2 = $[2] !== c; let x; - if (c_0 || c_1 || c_2) { + if ($[0] !== a || $[1] !== b || $[2] !== c) { x = []; if (a) { if (b) { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md index 8e3d82f3d8..a48e57083e 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md @@ -22,9 +22,8 @@ import fbt from "fbt"; function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.name; let t0; - if (c_0) { + if ($[0] !== props.name) { t0 = fbt._( "Hello, {(key) name}!", [fbt._param("(key) name", capitalize(props.name))], @@ -36,9 +35,8 @@ function Component(props) { t0 = $[1]; } const text = t0; - const c_2 = $[2] !== text; let t1; - if (c_2) { + if ($[2] !== text) { t1 =
{text}
; $[2] = text; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call.expect.md index 2a431b6a61..daa927ea24 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-call.expect.md @@ -22,9 +22,8 @@ import fbt from "fbt"; function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.count; let t0; - if (c_0) { + if ($[0] !== props.count) { t0 = fbt._( "{(key) count} items", [fbt._param("(key) count", props.count)], @@ -36,9 +35,8 @@ function Component(props) { t0 = $[1]; } const text = t0; - const c_2 = $[2] !== text; let t1; - if (c_2) { + if ($[2] !== text) { t1 =
{text}
; $[2] = text; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md index 43e9aa7f7a..47e906e55a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md @@ -22,9 +22,8 @@ import fbt from "fbt"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.name; let t0; - if (c_0) { + if ($[0] !== props.name) { t0 = fbt._( "Hello {user name}", [fbt._param("user name", capitalize(props.name))], diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params.expect.md index 74b3c074c1..91fd02300d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-params.expect.md @@ -28,9 +28,8 @@ import fbt from "fbt"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.name; let t0; - if (c_0) { + if ($[0] !== props.name) { t0 = fbt._("Hello {user name}", [fbt._param("user name", props.name)], { hk: "2zEDKF", }); diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-preserve-jsxtext.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-preserve-jsxtext.expect.md index 1bb46e5cbc..3acc469508 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-preserve-jsxtext.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-preserve-jsxtext.expect.md @@ -27,9 +27,8 @@ import fbt from "fbt"; function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.value; let t0; - if (c_0) { + if ($[0] !== props.value) { t0 = fbt._( { "0": "hello {value},", "1": "goodbye {value}," }, [ diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-template-string-same-scope.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-template-string-same-scope.expect.md index 45ee3384b6..4e4a7c2225 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-template-string-same-scope.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt-template-string-same-scope.expect.md @@ -34,9 +34,8 @@ export function Component(props) { if (props.items) { count = props.items.length; } - const c_0 = $[0] !== count; let t0; - if (c_0) { + if ($[0] !== count) { t0 = fbt._("for {count} experiences", [fbt._param("count", count)], { hk: "nmYpm", }); @@ -45,9 +44,8 @@ export function Component(props) { } else { t0 = $[1]; } - const c_2 = $[2] !== t0; let t1; - if (c_2) { + if ($[2] !== t0) { t1 = {t0}; $[2] = t0; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-element-content.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-element-content.expect.md index 64db38edaf..83ffc40247 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-element-content.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-element-content.expect.md @@ -31,11 +31,8 @@ import fbt from "fbt"; function Component(t29) { const $ = useMemoCache(4); const { name, data, icon } = t29; - const c_0 = $[0] !== name; - const c_1 = $[1] !== icon; - const c_2 = $[2] !== data; let t0; - if (c_0 || c_1 || c_2) { + if ($[0] !== name || $[1] !== icon || $[2] !== data) { t0 = ( {fbt._( diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-fragment-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-fragment-value.expect.md index 38c76f4e25..11086737b7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-fragment-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbtparam-with-jsx-fragment-value.expect.md @@ -28,9 +28,8 @@ import { identity } from "shared-runtime"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.text; let t0; - if (c_0) { + if ($[0] !== props.text) { t0 = ( {key}
); @@ -35,9 +34,8 @@ function Component(props) { } else { items = $[1]; } - const c_2 = $[2] !== items; let t0; - if (c_2) { + if ($[2] !== items) { t0 =
{items}
; $[2] = items; $[3] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md index 257f42fd46..474cf9ace7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md @@ -25,9 +25,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function component(a) { const $ = useMemoCache(3); - const c_0 = $[0] !== a; let t; - if (c_0) { + if ($[0] !== a) { t = { a }; let t0; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md index f37b848b45..376ce0c157 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md @@ -24,9 +24,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(4); const id = useSelectedEntitytId(); - const c_0 = $[0] !== id; let t0; - if (c_0) { + if ($[0] !== id) { t0 = () => { log(id); }; @@ -36,9 +35,8 @@ function Component(props) { t0 = $[1]; } const onLoad = t0; - const c_2 = $[2] !== onLoad; let t1; - if (c_2) { + if ($[2] !== onLoad) { t1 = ; $[2] = onLoad; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-with-store-to-parameter.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-with-store-to-parameter.expect.md index 8d1c48f2c1..fe47a6d088 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-with-store-to-parameter.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/function-expression-with-store-to-parameter.expect.md @@ -31,9 +31,8 @@ function Component(props) { t0 = $[0]; } const mutate = t0; - const c_1 = $[1] !== props; let x; - if (c_1) { + if ($[1] !== props) { x = makeObject(props); mutate(x); $[1] = props; 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 9df35ddf40..a1a5de3220 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 @@ -21,9 +21,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t23, t0) { const $ = useMemoCache(5); const x = t23 === undefined ? "default" : t23; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = t0 === undefined ? [{}] : t0; $[0] = t0; $[1] = t1; @@ -31,10 +30,8 @@ function Component(t23, t0) { t1 = $[1]; } const y = t1; - const c_2 = $[2] !== x; - const c_3 = $[3] !== y; let t2; - if (c_2 || c_3) { + if ($[2] !== x || $[3] !== y) { t2 = [x, y]; $[2] = x; $[3] = y; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md index 7181c74896..d6a9af708d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md @@ -27,9 +27,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @compi export default isForgetEnabled_Fixtures() ? function Bar(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -49,9 +48,8 @@ function NoForget(props) { const Foo = isForgetEnabled_Fixtures() ? function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md index 25cebf9abc..afe7fbdd1d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md @@ -27,9 +27,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @compi export default isForgetEnabled_Fixtures() ? function Bar(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -50,9 +49,8 @@ function NoForget(props) { export const Foo = isForgetEnabled_Fixtures() ? function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md index 8c0b497327..c800dcd897 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md @@ -27,9 +27,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @compi export const Bar = isForgetEnabled_Fixtures() ? function Bar(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -50,9 +49,8 @@ export function NoForget(props) { export const Foo = isForgetEnabled_Fixtures() ? function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test.expect.md index 7a43fda3c3..11c1d920fd 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/gating-test.expect.md @@ -27,9 +27,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @compi const Bar = isForgetEnabled_Fixtures() ? function Bar(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 =
{props.bar}
; $[0] = props.bar; $[1] = t0; @@ -49,9 +48,8 @@ function NoForget(props) { const Foo = isForgetEnabled_Fixtures() ? function Foo(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.bar; let t0; - if (c_0) { + if ($[0] !== props.bar) { t0 = {props.bar}; $[0] = props.bar; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration-2.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration-2.expect.md index a386642ab4..63918c2c61 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration-2.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration-2.expect.md @@ -28,9 +28,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function hoisting(cond) { const $ = useMemoCache(3); - const c_0 = $[0] !== cond; let items; - if (c_0) { + if ($[0] !== cond) { items = []; if (cond) { const foo = () => { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/holey-array-expr.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/holey-array-expr.expect.md index 754dea459f..a4512548b2 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/holey-array-expr.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/holey-array-expr.expect.md @@ -25,9 +25,8 @@ import { CONST_STRING0 } from "shared-runtime"; function t(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props; let t0; - if (c_0) { + if ($[0] !== props) { t0 = [, CONST_STRING0, props]; $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-call.expect.md index b37d1d8c4b..2885090a6c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-call.expect.md @@ -38,9 +38,8 @@ function Component(props) { const x = t0; const y = useFreeze(x); foo(y, x); - const c_1 = $[1] !== y; let t1; - if (c_1) { + if ($[1] !== y) { t1 = ( {x} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-noAlias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-noAlias.expect.md index dc025f44e2..239cf8b6da 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-noAlias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-noAlias.expect.md @@ -32,9 +32,8 @@ import { useNoAlias } from "shared-runtime"; function Component(props) { const $ = useMemoCache(5); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 = { a: props.a }; $[0] = props.a; $[1] = t0; @@ -49,10 +48,8 @@ function Component(props) { }, [props.a] ); - const c_2 = $[2] !== x; - const c_3 = $[3] !== item; let t1; - if (c_2 || c_3) { + if ($[2] !== x || $[3] !== item) { t1 = [x, item]; $[2] = x; $[3] = item; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/immutable-hooks.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/immutable-hooks.expect.md index a4f065bb82..c926a98c32 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/immutable-hooks.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/immutable-hooks.expect.md @@ -32,9 +32,8 @@ function Component(props) { const y = useFoo(x); bar(x, y); - const c_1 = $[1] !== y; let t1; - if (c_1) { + if ($[1] !== y) { t1 = [x, y]; $[1] = y; $[2] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md index 22afe82a58..aeb4540a79 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md @@ -35,9 +35,8 @@ function Component(props) { const onChange = t0; useOtherHook(); - const c_1 = $[1] !== onChange; let x; - if (c_1) { + if ($[1] !== onChange) { x = {}; foo(x, onChange); $[1] = onChange; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md index 9e78cf11ca..27168b3915 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md @@ -58,12 +58,9 @@ function Foo() {} */ function Component(props) { const $ = useMemoCache(8); - 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) { + if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.c) { a = compute(props.a); b = compute(props.b); if (props.c) { @@ -79,10 +76,8 @@ function Component(props) { a = $[3]; b = $[4]; } - const c_5 = $[5] !== a; - const c_6 = $[6] !== b; let t0; - if (c_5 || c_6) { + if ($[5] !== a || $[6] !== b) { t0 = ; $[5] = a; $[6] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent.expect.md index 44f64ad0b5..29b9ac803a 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independent.expect.md @@ -40,9 +40,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; */ function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 = compute(props.a); $[0] = props.a; $[1] = t0; @@ -50,9 +49,8 @@ function Component(props) { t0 = $[1]; } const a = t0; - const c_2 = $[2] !== props.b; let t1; - if (c_2) { + if ($[2] !== props.b) { t1 = compute(props.b); $[2] = props.b; $[3] = t1; @@ -60,10 +58,8 @@ function Component(props) { t1 = $[3]; } const b = t1; - const c_4 = $[4] !== a; - const c_5 = $[5] !== b; let t2; - if (c_4 || c_5) { + if ($[4] !== a || $[5] !== b) { t2 = ; $[4] = a; $[5] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md index 3569a34c0e..5f5847f38d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md @@ -24,16 +24,11 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c) { const $ = useMemoCache(7); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; - const c_2 = $[2] !== c; let x; - if (c_0 || c_1 || c_2) { + if ($[0] !== a || $[1] !== b || $[2] !== c) { x = { a }; - const c_4 = $[4] !== b; - const c_5 = $[5] !== c; let t0; - if (c_4 || c_5) { + if ($[4] !== b || $[5] !== c) { t0 = [b, c]; $[4] = b; $[5] = c; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-hook-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-hook-call.expect.md index 152263f59c..08ab22f8eb 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-hook-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-component-with-hook-call.expect.md @@ -17,9 +17,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @compilationMo function Component(props) { const $ = useMemoCache(2); const [state] = useState(null); - const c_0 = $[0] !== state; let t0; - if (c_0) { + if ($[0] !== state) { t0 = [state]; $[0] = state; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-hook-with-hook-call.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-hook-with-hook-call.expect.md index 24e31a716a..997b99492c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-hook-with-hook-call.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-functions-hook-with-hook-call.expect.md @@ -17,9 +17,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // @compilationMo function useStateValue(props) { const $ = useMemoCache(2); const [state] = useState(null); - const c_0 = $[0] !== state; let t0; - if (c_0) { + if ($[0] !== state) { t0 = [state]; $[0] = state; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md index 3c750df8d8..e73ad7b6ad 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md @@ -36,9 +36,8 @@ import { identity, sum } from "shared-runtime"; // global object. function Component(props) { const $ = useMemoCache(4); - const c_0 = $[0] !== props.b; let t0; - if (c_0) { + if ($[0] !== props.b) { t0 = identity(props.b); $[0] = props.b; $[1] = t0; @@ -51,9 +50,8 @@ function Component(props) { const primitiveVal3 = globalThis.globalThis.NaN; sum(primitiveVal1, Infinity, primitiveVal3); - const c_2 = $[2] !== primitiveVal1; let t1; - if (c_2) { + if ($[2] !== primitiveVal1) { t1 = { primitiveVal1, primitiveVal2: Infinity, primitiveVal3 }; $[2] = primitiveVal1; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md index c189210d5b..97c6f6bae5 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md @@ -27,12 +27,11 @@ function Component(props) { const $ = useMemoCache(15); const item = useFragment(FRAGMENT, props.item); useFreeze(item); - const c_0 = $[0] !== item; let t1; let T2; let t0; let T3; - if (c_0) { + if ($[0] !== item) { const count = new MaybeMutable(item); T3 = View; @@ -55,20 +54,16 @@ function Component(props) { t0 = $[3]; T3 = $[4]; } - const c_6 = $[6] !== t1; let t4; - if (c_6) { + if ($[6] !== t1) { t4 = {t1}; $[6] = t1; $[7] = t4; } else { t4 = $[7]; } - const c_8 = $[8] !== T2; - const c_9 = $[9] !== t0; - const c_10 = $[10] !== t4; let t5; - if (c_8 || c_9 || c_10) { + if ($[8] !== T2 || $[9] !== t0 || $[10] !== t4) { t5 = ( {t0} @@ -82,10 +77,8 @@ function Component(props) { } else { t5 = $[11]; } - const c_12 = $[12] !== T3; - const c_13 = $[13] !== t5; let t6; - if (c_12 || c_13) { + if ($[12] !== T3 || $[13] !== t5) { t6 = {t5}; $[12] = T3; $[13] = t5; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md index 322965a4aa..13db4c01f7 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md @@ -47,12 +47,9 @@ function Foo() {} */ function Component(props) { const $ = useMemoCache(8); - 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) { + if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.c) { a = compute(props.a); b = compute(props.b); if (props.c) { @@ -67,10 +64,8 @@ function Component(props) { a = $[3]; b = $[4]; } - const c_5 = $[5] !== a; - const c_6 = $[6] !== b; let t0; - if (c_5 || c_6) { + if ($[5] !== a || $[6] !== b) { t0 = ; $[5] = a; $[6] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent.expect.md index 13f481ad4b..c936856579 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/interdependent.expect.md @@ -39,11 +39,9 @@ import { unstable_useMemoCache as useMemoCache } from "react"; */ function Component(props) { const $ = useMemoCache(7); - const c_0 = $[0] !== props.a; - const c_1 = $[1] !== props.b; let a; let b; - if (c_0 || c_1) { + if ($[0] !== props.a || $[1] !== props.b) { a = compute(props.a); b = compute(props.b); foo(a, b); @@ -55,10 +53,8 @@ function Component(props) { a = $[2]; b = $[3]; } - const c_4 = $[4] !== a; - const c_5 = $[5] !== b; let t0; - if (c_4 || c_5) { + if ($[4] !== a || $[5] !== b) { t0 = ; $[4] = a; $[5] = b; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inverted-if.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inverted-if.expect.md index d12da540e2..13fc9aeaee 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inverted-if.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/inverted-if.expect.md @@ -28,12 +28,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function foo(a, b, c, d) { const $ = useMemoCache(5); - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; - const c_2 = $[2] !== c; - const c_3 = $[3] !== d; let y; - if (c_0 || c_1 || c_2 || c_3) { + if ($[0] !== a || $[1] !== b || $[2] !== c || $[3] !== d) { y = []; bb1: if (a) { if (b) { 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 53166f4c9d..7267900037 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 @@ -46,9 +46,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t27) { const $ = useMemoCache(2); const { items } = t27; - const c_0 = $[0] !== items; let t0; - if (c_0) { + if ($[0] !== items) { t0 = items.length > 0 ? ( {children}
; $[0] = children; $[1] = t0; @@ -92,9 +90,8 @@ function Bar(t6) { function Item(t7) { const $ = useMemoCache(2); const { item } = t7; - const c_0 = $[0] !== item.name; let t0; - if (c_0) { + if ($[0] !== item.name) { t0 =
{item.name}
; $[0] = item.name; $[1] = t0; 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 e6c996a4f4..9edf316fe5 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 @@ -33,9 +33,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; function Component(t26) { const $ = useMemoCache(2); const { items } = t26; - const c_0 = $[0] !== items; let t0; - if (c_0) { + if ($[0] !== items) { t0 = items.length > 0 ? ( {item.name}
; $[0] = item.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md index 42a592d35a..a4c2b2ada6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md @@ -25,9 +25,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; export function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.a; let t0; - if (c_0) { + if ($[0] !== props.a) { t0 =
{props.a}
; $[0] = props.a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md index d2ba9cbde0..2bc34d21d5 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md @@ -38,9 +38,8 @@ function Foo(props) { } else { t0 = $[0]; } - const c_1 = $[1] !== props.greeting; let t1; - if (c_1) { + if ($[1] !== props.greeting) { t1 = ( <> Hello {props.greeting} {t0} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md index 9f51f232d2..2508db3c59 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md @@ -20,9 +20,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function Component(props) { const $ = useMemoCache(2); - const c_0 = $[0] !== props.version; let t0; - if (c_0) { + if ($[0] !== props.version) { t0 = ; $[0] = props.version; $[1] = t0; 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 48504a1171..3cda1f4dd3 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 @@ -31,9 +31,8 @@ function Component(t13) { const { something } = t13; const Foo = something.StaticText1; - const c_0 = $[0] !== Foo; let t0; - if (c_0) { + if ($[0] !== Foo) { t0 = () => ; $[0] = Foo; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md index 27b813adf3..9638d37754 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md @@ -18,19 +18,16 @@ function Component(props) { const $ = useMemoCache(5); const t0 = props.cond ? props.foo : props.bar; - const c_0 = $[0] !== t0; let t1; - if (c_0) { + if ($[0] !== t0) { t1 = { bar: t0 }; $[0] = t0; $[1] = t1; } else { t1 = $[1]; } - const c_2 = $[2] !== props; - const c_3 = $[3] !== t1; let t2; - if (c_2 || c_3) { + if ($[2] !== props || $[3] !== t1) { t2 = ; $[2] = props; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md index 02a874861f..9eb47244e6 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md @@ -53,12 +53,10 @@ function maybeMutate(x) {} function Component(props) { const $ = useMemoCache(11); - const c_0 = $[0] !== props.component; - const c_1 = $[1] !== props.alternateComponent; let Tag; let T0; let t1; - if (c_0 || c_1) { + if ($[0] !== props.component || $[1] !== props.alternateComponent) { const maybeMutable = new MaybeMutable(); Tag = props.component; @@ -74,20 +72,16 @@ function Component(props) { T0 = $[3]; t1 = $[4]; } - const c_5 = $[5] !== Tag; let t2; - if (c_5) { + if ($[5] !== Tag) { t2 = ; $[5] = Tag; $[6] = t2; } else { t2 = $[6]; } - const c_7 = $[7] !== T0; - const c_8 = $[8] !== t1; - const c_9 = $[9] !== t2; let t3; - if (c_7 || c_8 || c_9) { + if ($[7] !== T0 || $[8] !== t1 || $[9] !== t2) { t3 = ( {t1} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md index 7118915f1b..a2950ccae9 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md @@ -39,9 +39,8 @@ function Component(props) { } else { t0 = $[0]; } - const c_1 = $[1] !== t1; let t2; - if (c_1) { + if ($[1] !== t1) { t2 = ( {t1} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-ternary-local-variable.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-ternary-local-variable.expect.md index 9529acd2d1..ec77e60b39 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-ternary-local-variable.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/jsx-ternary-local-variable.expect.md @@ -26,9 +26,8 @@ import { RenderPropAsChild, StaticText1, StaticText2 } from "shared-runtime"; function Component(props) { const $ = useMemoCache(2); const Foo = props.showText1 ? StaticText1 : StaticText2; - const c_0 = $[0] !== Foo; let t0; - if (c_0) { + if ($[0] !== Foo) { t0 = ]} />; $[0] = Foo; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md index b811bbb873..26e11ed2e8 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md @@ -34,9 +34,8 @@ import { unstable_useMemoCache as useMemoCache } from "react"; // Here, element // them to reads function CaptureNotMutate(props) { const $ = useMemoCache(5); - const c_0 = $[0] !== props.x; let t0; - if (c_0) { + if ($[0] !== props.x) { t0 = foo(props.x); $[0] = props.x; $[1] = t0; @@ -44,10 +43,8 @@ function CaptureNotMutate(props) { t0 = $[1]; } const idx = t0; - const c_2 = $[2] !== props.el; - const c_3 = $[3] !== idx; let aliasedElement; - if (c_2 || c_3) { + if ($[2] !== props.el || $[3] !== idx) { const element = bar(props.el); const fn = function () { diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-mutated-non-reactive-to-reactive.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-mutated-non-reactive-to-reactive.expect.md index 5a1eff9101..12053fbfb3 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-mutated-non-reactive-to-reactive.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/lambda-mutated-non-reactive-to-reactive.expect.md @@ -24,9 +24,8 @@ export const FIXTURE_ENTRYPOINT = { import { unstable_useMemoCache as useMemoCache } from "react"; function f(a) { const $ = useMemoCache(4); - const c_0 = $[0] !== a; let x; - if (c_0) { + if ($[0] !== a) { x; x = { a }; $[0] = a; @@ -36,9 +35,8 @@ function f(a) { } const t0 = x; - const c_2 = $[2] !== t0; let t1; - if (c_2) { + if ($[2] !== t0) { t1 =
; $[2] = t0; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md index 7b058365de..d0474dda5c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md @@ -30,10 +30,8 @@ function component(props) { const a = props.a || (props.b && props.c && props.d); const b = (props.a && props.b && props.c) || props.d; - const c_0 = $[0] !== a; - const c_1 = $[1] !== b; let t0; - if (c_0 || c_1) { + if ($[0] !== a || $[1] !== b) { t0 = { a, b }; $[0] = a; $[1] = b; 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 3820e0283f..438e10b215 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 @@ -51,9 +51,8 @@ function Component(props) { t1 = $[1]; } const onClick = t1; - const c_2 = $[2] !== props.children; let t2; - if (c_2) { + if ($[2] !== props.children) { t2 = {props.children}; $[2] = props.children; $[3] = t2; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-objects.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-objects.expect.md index 1c9addf746..b16e1465ac 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-objects.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes-objects.expect.md @@ -48,18 +48,16 @@ function Component(props) { } else { t0 = $[0]; } - const c_1 = $[1] !== state; let t1; - if (c_1) { + if ($[1] !== state) { t1 = { component: "span", props: { children: [state] } }; $[1] = state; $[2] = t1; } else { t1 = $[2]; } - const c_3 = $[3] !== state; let t2; - if (c_3) { + if ($[3] !== state) { t2 = () => setState(state + 1); $[3] = state; $[4] = t2; @@ -73,9 +71,8 @@ function Component(props) { } else { t3 = $[5]; } - const c_6 = $[6] !== t2; let t4; - if (c_6) { + if ($[6] !== t2) { t4 = { component: "button", props: { "data-testid": "button", onClick: t2, children: t3 }, @@ -85,10 +82,8 @@ function Component(props) { } else { t4 = $[7]; } - const c_8 = $[8] !== t1; - const c_9 = $[9] !== t4; let t5; - if (c_8 || c_9) { + if ($[8] !== t1 || $[9] !== t4) { t5 = [t0, t1, t4]; $[8] = t1; $[9] = t4; diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md index a767519e03..43da5bb515 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merge-consecutive-scopes.expect.md @@ -37,18 +37,16 @@ function Component() { } else { t0 = $[0]; } - const c_1 = $[1] !== state; let t1; - if (c_1) { + if ($[1] !== state) { t1 = {state}; $[1] = state; $[2] = t1; } else { t1 = $[2]; } - const c_3 = $[3] !== state; let t2; - if (c_3) { + if ($[3] !== state) { t2 = (