diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index 297c7712546c9..167db6dedeccc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -34,6 +34,7 @@ import { ReactiveInstruction, ReactiveScope, ReactiveScopeBlock, + ReactiveScopeDeclaration, ReactiveScopeDependency, ReactiveTerminal, ReactiveValue, @@ -572,7 +573,8 @@ function codegenReactiveScope( const changeExpressions: Array = []; const changeExpressionComments: Array = []; const outputComments: Array = []; - for (const dep of scope.dependencies) { + + for (const dep of [...scope.dependencies].sort(compareScopeDependency)) { const index = cx.nextCacheIndex; changeExpressionComments.push(printDependencyComment(dep)); const comparison = t.binaryExpression( @@ -615,7 +617,10 @@ function codegenReactiveScope( ); } let firstOutputIndex: number | null = null; - for (const [, {identifier}] of scope.declarations) { + + for (const [, {identifier}] of [...scope.declarations].sort(([, a], [, b]) => + compareScopeDeclaration(a, b), + )) { const index = cx.nextCacheIndex; if (firstOutputIndex === null) { firstOutputIndex = index; @@ -2566,3 +2571,45 @@ function convertIdentifier(identifier: Identifier): t.Identifier { ); return t.identifier(identifier.name.value); } + +function compareScopeDependency( + a: ReactiveScopeDependency, + b: ReactiveScopeDependency, +): number { + CompilerError.invariant( + a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named', + { + reason: '[Codegen] Expected named identifier for dependency', + loc: a.identifier.loc, + }, + ); + const aName = [ + a.identifier.name.value, + ...a.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`), + ].join('.'); + const bName = [ + b.identifier.name.value, + ...b.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`), + ].join('.'); + if (aName < bName) return -1; + else if (aName > bName) return 1; + else return 0; +} + +function compareScopeDeclaration( + a: ReactiveScopeDeclaration, + b: ReactiveScopeDeclaration, +): number { + CompilerError.invariant( + a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named', + { + reason: '[Codegen] Expected named identifier for declaration', + loc: a.identifier.loc, + }, + ); + const aName = a.identifier.name.value; + const bName = b.identifier.name.value; + if (aName < bName) return -1; + else if (aName > bName) return 1; + else return 0; +} diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-effect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-effect.expect.md index 3aa51ba6d6f3b..a8bad51215473 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-effect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-effect.expect.md @@ -41,7 +41,7 @@ function ArrayAtTest(props) { } const arr = t1; let t2; - if ($[4] !== props.y || $[5] !== arr) { + if ($[4] !== arr || $[5] !== props.y) { let t3; if ($[7] !== props.y) { t3 = bar(props.y); @@ -51,8 +51,8 @@ function ArrayAtTest(props) { t3 = $[8]; } t2 = arr.at(t3); - $[4] = props.y; - $[5] = arr; + $[4] = arr; + $[5] = props.y; $[6] = t2; } else { t2 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-property-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-property-call.expect.md index 7aa47c5803a22..6618be4a6c04c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-property-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-property-call.expect.md @@ -24,18 +24,18 @@ export const FIXTURE_ENTRYPOINT = { import { c as _c } from "react/compiler-runtime"; function Component(props) { const $ = _c(11); - let t0; let a; + let t0; if ($[0] !== props.a || $[1] !== props.b) { a = [props.a, props.b, "hello"]; t0 = a.push(42); $[0] = props.a; $[1] = props.b; - $[2] = t0; - $[3] = a; + $[2] = a; + $[3] = t0; } else { - t0 = $[2]; - a = $[3]; + a = $[2]; + t0 = $[3]; } const x = t0; let t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-invalid-phi-as-dependency.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-invalid-phi-as-dependency.expect.md index 32e2c9fd6483e..09d2d8800b789 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-invalid-phi-as-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-invalid-phi-as-dependency.expect.md @@ -70,10 +70,10 @@ function Component() { throw new Error("invariant broken"); } let t1; - if ($[1] !== obj || $[2] !== boxedInner) { + if ($[1] !== boxedInner || $[2] !== obj) { t1 = ; - $[1] = obj; - $[2] = boxedInner; + $[1] = boxedInner; + $[2] = obj; $[3] = t1; } else { t1 = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md index 65ab9c277c2d1..5e0b32709b32e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md @@ -32,7 +32,7 @@ import { mutate } from "shared-runtime"; function component(foo, bar) { const $ = _c(3); let x; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { x = { foo }; const y = { bar }; @@ -41,8 +41,8 @@ function component(foo, bar) { a.x = b; mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md index 170f68badeffe..f9ce3f2e98cf5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md @@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime"; function component(foo, bar) { const $ = _c(3); let x; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { x = { foo }; const y = { bar }; const f0 = function () { @@ -35,8 +35,8 @@ function component(foo, bar) { f0(); mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md index e315cd401d433..81737a1ed500f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md @@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = _c(3); let x; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { x = { foo }; const y = { bar }; @@ -41,8 +41,8 @@ function component(foo, bar) { a.x = b; mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md index 7371f3d27a29d..38590d1559bb5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md @@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime"; function component(foo, bar) { const $ = _c(3); let x; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { x = { foo }; const y = { bar }; const f0 = function () { @@ -35,8 +35,8 @@ function component(foo, bar) { f0(); mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md index cc41adcbbcff9..4882aa822f430 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md @@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = _c(3); let y; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { const x = { foo }; y = { bar }; @@ -41,8 +41,8 @@ function component(foo, bar) { a.x = b; mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = y; } else { y = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md index 34f6a55740c31..7c94c33e495a8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md @@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime"; function component(foo, bar) { const $ = _c(3); let y; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { const x = { foo }; y = { bar }; const f0 = function () { @@ -35,8 +35,8 @@ function component(foo, bar) { f0(); mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = y; } else { y = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md index b2d704875631e..60493dd25ad74 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md @@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime"); function component(foo, bar) { const $ = _c(3); let y; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { const x = { foo }; y = { bar }; @@ -41,8 +41,8 @@ function component(foo, bar) { a.x = b; mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = y; } else { y = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md index a68e919c9678f..14532562fb153 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md @@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime"; function component(foo, bar) { const $ = _c(3); let y; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { const x = { foo }; y = { bar }; const f0 = function () { @@ -35,8 +35,8 @@ function component(foo, bar) { f0(); mutate(y); - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = y; } else { y = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md index 51679299fee72..cab9c9a500b9c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md @@ -46,10 +46,10 @@ function component(t0) { } const hide = t2; let t3; - if ($[4] !== poke || $[5] !== hide) { + if ($[4] !== hide || $[5] !== poke) { t3 = ; - $[4] = poke; - $[5] = hide; + $[4] = hide; + $[5] = poke; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.expect.md index 80d6e6df8c086..c6037fd2bb390 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.expect.md @@ -46,7 +46,7 @@ function Component(props) { const items = props.items; const maxItems = props.maxItems; let renderedItems; - if ($[0] !== maxItems || $[1] !== items) { + if ($[0] !== items || $[1] !== maxItems) { renderedItems = []; const seen = new Set(); const max = Math.max(0, maxItems); @@ -62,8 +62,8 @@ function Component(props) { break; } } - $[0] = maxItems; - $[1] = items; + $[0] = items; + $[1] = maxItems; $[2] = renderedItems; } else { renderedItems = $[2]; @@ -79,15 +79,15 @@ function Component(props) { t0 = $[4]; } let t1; - if ($[5] !== t0 || $[6] !== renderedItems) { + if ($[5] !== renderedItems || $[6] !== t0) { t1 = (
{t0} {renderedItems}
); - $[5] = t0; - $[6] = renderedItems; + $[5] = renderedItems; + $[6] = t0; $[7] = t1; } else { t1 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md index 6fc686cb197fc..f0f9911c07e92 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md @@ -41,7 +41,7 @@ function foo(a, b) { x = $[1]; } let y; - if ($[2] !== x || $[3] !== b) { + if ($[2] !== b || $[3] !== x) { y = []; if (x.length) { y.push(x); @@ -49,8 +49,8 @@ function foo(a, b) { if (b) { y.push(b); } - $[2] = x; - $[3] = b; + $[2] = b; + $[3] = x; $[4] = y; } else { y = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md index d65082cbc87c7..b159789106267 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md @@ -61,11 +61,11 @@ function useFoo(props) { z = $[4]; } let t0; - if ($[5] !== x || $[6] !== y || $[7] !== myList) { + if ($[5] !== myList || $[6] !== x || $[7] !== y) { t0 = { x, y, myList }; - $[5] = x; - $[6] = y; - $[7] = myList; + $[5] = myList; + $[6] = x; + $[7] = y; $[8] = t0; } else { t0 = $[8]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md index b86498b922d38..3e1c4771eabfb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md @@ -41,10 +41,10 @@ function Component(props) { } const sameName = t1; let t2; - if ($[2] !== sameName || $[3] !== renamed) { + if ($[2] !== renamed || $[3] !== sameName) { t2 = [sameName, renamed]; - $[2] = sameName; - $[3] = renamed; + $[2] = renamed; + $[3] = sameName; $[4] = t2; } else { t2 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring.expect.md index c175cc558cf06..f292e83e16438 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring.expect.md @@ -36,45 +36,45 @@ export const FIXTURE_ENTRYPOINT = { import { c as _c } from "react/compiler-runtime"; function foo(a, b, c) { const $ = _c(18); - let t0; let d; let h; + let t0; if ($[0] !== a) { [d, t0, ...h] = a; $[0] = a; - $[1] = t0; - $[2] = d; - $[3] = h; + $[1] = d; + $[2] = h; + $[3] = t0; } else { - t0 = $[1]; - d = $[2]; - h = $[3]; + d = $[1]; + h = $[2]; + t0 = $[3]; } const [t1] = t0; - let t2; let g; + let t2; if ($[4] !== t1) { ({ e: t2, ...g } = t1); $[4] = t1; - $[5] = t2; - $[6] = g; + $[5] = g; + $[6] = t2; } else { - t2 = $[5]; - g = $[6]; + g = $[5]; + t2 = $[6]; } const { f } = t2; const { l: t3, p } = b; const { m: t4 } = t3; - let t5; let o; + let t5; if ($[7] !== t4) { [t5, ...o] = t4; $[7] = t4; - $[8] = t5; - $[9] = o; + $[8] = o; + $[9] = t5; } else { - t5 = $[8]; - o = $[9]; + o = $[8]; + t5 = $[9]; } const [n] = t5; let t6; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md index 29780eb76c2b6..ce5bfda64406b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md @@ -53,8 +53,8 @@ import { ValidateMemoization } from "shared-runtime"; function Component(t0) { const $ = _c(25); const { a, b, c } = t0; - let y; let x; + let y; if ($[0] !== a || $[1] !== b || $[2] !== c) { x = []; if (a) { @@ -73,11 +73,11 @@ function Component(t0) { $[0] = a; $[1] = b; $[2] = c; - $[3] = y; - $[4] = x; + $[3] = x; + $[4] = y; } else { - y = $[3]; - x = $[4]; + x = $[3]; + y = $[4]; } let t1; if ($[7] !== y) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/existing-variables-with-c-name.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/existing-variables-with-c-name.expect.md index 0d671a3de2032..5cde3bde23cf1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/existing-variables-with-c-name.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/existing-variables-with-c-name.expect.md @@ -61,10 +61,10 @@ function Component(props) { t2 = $[3]; } let t3; - if ($[4] !== t2 || $[5] !== array) { + if ($[4] !== array || $[5] !== t2) { t3 = ; - $[4] = t2; - $[5] = array; + $[4] = array; + $[5] = t2; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fast-refresh-reloading.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fast-refresh-reloading.expect.md index ecd03a0b10231..4175d23fdab57 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fast-refresh-reloading.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fast-refresh-reloading.expect.md @@ -59,10 +59,10 @@ function Component(props) { t3 = $[4]; } let t4; - if ($[5] !== t3 || $[6] !== doubled) { + if ($[5] !== doubled || $[6] !== t3) { t4 = ; - $[5] = t3; - $[6] = doubled; + $[5] = doubled; + $[6] = t3; $[7] = t4; } else { t4 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-repro-invalid-mutable-range-destructured-prop.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-repro-invalid-mutable-range-destructured-prop.expect.md index d56f7a98ad1ad..9bb651aa676e6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-repro-invalid-mutable-range-destructured-prop.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-repro-invalid-mutable-range-destructured-prop.expect.md @@ -61,10 +61,10 @@ function Component(t0) { t3 = $[3]; } let t4; - if ($[4] !== t3 || $[5] !== el) { + if ($[4] !== el || $[5] !== t3) { t4 = ; - $[4] = t3; - $[5] = el; + $[4] = el; + $[5] = t3; $[6] = t4; } else { t4 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md index d58c25b51046a..56ffb70cb0aeb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md @@ -32,7 +32,7 @@ function Component(t0) { const $ = _c(4); const { name, data, icon } = t0; let t1; - if ($[0] !== name || $[1] !== icon || $[2] !== data) { + if ($[0] !== data || $[1] !== icon || $[2] !== name) { t1 = ( {fbt._( @@ -61,9 +61,9 @@ function Component(t0) { )} ); - $[0] = name; + $[0] = data; $[1] = icon; - $[2] = data; + $[2] = name; $[3] = t1; } else { t1 = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-nonmutating-loop-local-collection.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-nonmutating-loop-local-collection.expect.md index cff8c5bd13cfa..4abe630044084 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-nonmutating-loop-local-collection.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-nonmutating-loop-local-collection.expect.md @@ -91,10 +91,10 @@ function Component(t0) { t5 = $[9]; } let t6; - if ($[10] !== x || $[11] !== b) { + if ($[10] !== b || $[11] !== x) { t6 = [x, b]; - $[10] = x; - $[11] = b; + $[10] = b; + $[11] = x; $[12] = t6; } else { t6 = $[12]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call-mutating.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call-mutating.expect.md index be59673c157e0..9888e96222b3d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call-mutating.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call-mutating.expect.md @@ -59,10 +59,10 @@ function Component(props) { t1 = $[3]; } let t2; - if ($[4] !== t1 || $[5] !== a_0) { + if ($[4] !== a_0 || $[5] !== t1) { t2 = ; - $[4] = t1; - $[5] = a_0; + $[4] = a_0; + $[5] = t1; $[6] = t2; } else { t2 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr-conditional-access-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr-conditional-access-2.expect.md index 8cbaeb3f89465..32498e1379206 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr-conditional-access-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr-conditional-access-2.expect.md @@ -36,10 +36,10 @@ function Component(t0) { } const f = t1; let t2; - if ($[2] !== props || $[3] !== f) { + if ($[2] !== f || $[3] !== props) { t2 = props == null ? _temp : f; - $[2] = props; - $[3] = f; + $[2] = f; + $[3] = props; $[4] = t2; } else { t2 = $[4]; diff --git "a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr\342\200\223conditional-access.expect.md" "b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr\342\200\223conditional-access.expect.md" index f2fa20feb5477..4a62bf6f249bb 100644 --- "a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr\342\200\223conditional-access.expect.md" +++ "b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr\342\200\223conditional-access.expect.md" @@ -36,10 +36,10 @@ function Component(props) { } const getLength = t0; let t1; - if ($[2] !== props.bar || $[3] !== getLength) { + if ($[2] !== getLength || $[3] !== props.bar) { t1 = props.bar && getLength(); - $[2] = props.bar; - $[3] = getLength; + $[2] = getLength; + $[3] = props.bar; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/globals-dont-resolve-local-useState.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/globals-dont-resolve-local-useState.expect.md index 7548a3b6392f5..be7f3f1bd28d8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/globals-dont-resolve-local-useState.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/globals-dont-resolve-local-useState.expect.md @@ -56,10 +56,10 @@ function Component() { t0 = $[1]; } let t1; - if ($[2] !== t0 || $[3] !== state) { + if ($[2] !== state || $[3] !== t0) { t1 =
{state}
; - $[2] = t0; - $[3] = state; + $[2] = state; + $[3] = t0; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md index 96ccd1e2f1c20..329d57a035192 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md @@ -41,10 +41,10 @@ function Component(props) { console.log(props); }, [props.a]); let t1; - if ($[2] !== x || $[3] !== item) { + if ($[2] !== item || $[3] !== x) { t1 = [x, item]; - $[2] = x; - $[3] = item; + $[2] = item; + $[3] = x; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md index f7e02a53f161a..085df625f5544 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md @@ -73,15 +73,15 @@ function Component() { t1 = $[4]; } let t3; - if ($[5] !== t2 || $[6] !== json) { + if ($[5] !== json || $[6] !== t2) { t3 = (
{t2} {json}
); - $[5] = t2; - $[6] = json; + $[5] = json; + $[6] = t2; $[7] = t3; } else { t3 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md index 970cc50f03f27..8afc59a80ba02 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md @@ -29,22 +29,22 @@ import { Stringify } from "shared-runtime"; function Component(t0) { const $ = _c(4); - let t1; let a; let b; + let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { a = "a"; const [t2, t3] = [null, null]; t1 = t3; a = t2; - $[0] = t1; - $[1] = a; - $[2] = b; + $[0] = a; + $[1] = b; + $[2] = t1; } else { - t1 = $[0]; - a = $[1]; - b = $[2]; + a = $[0]; + b = $[1]; + t1 = $[2]; } b = t1; let t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md index becc4066e7d76..735462657f93e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md @@ -27,10 +27,10 @@ function Component(props) { const $ = _c(15); const item = useFragment(FRAGMENT, props.item); useFreeze(item); - let t0; let T0; - let t1; let T1; + let t0; + let t1; if ($[0] !== item) { const count = new MaybeMutable(item); @@ -44,15 +44,15 @@ function Component(props) { } t0 = maybeMutate(count); $[0] = item; - $[1] = t0; - $[2] = T0; - $[3] = t1; - $[4] = T1; + $[1] = T0; + $[2] = T1; + $[3] = t0; + $[4] = t1; } else { - t0 = $[1]; - T0 = $[2]; - t1 = $[3]; - T1 = $[4]; + T0 = $[1]; + T1 = $[2]; + t0 = $[3]; + t1 = $[4]; } let t2; if ($[6] !== t0) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-child-stored-in-id.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-child-stored-in-id.expect.md index fd7ca41bcffa3..b84229156bc14 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-child-stored-in-id.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-child-stored-in-id.expect.md @@ -83,10 +83,10 @@ function _temp(t0) { t1 = $[1]; } let t2; - if ($[2] !== x || $[3] !== t1) { + if ($[2] !== t1 || $[3] !== x) { t2 = {t1}; - $[2] = x; - $[3] = t1; + $[2] = t1; + $[3] = x; $[4] = t2; } else { t2 = $[4]; @@ -98,15 +98,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-jsx-stored-in-id.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-jsx-stored-in-id.expect.md index 496282e1ef611..7fca963134b71 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-jsx-stored-in-id.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-jsx-stored-in-id.expect.md @@ -52,7 +52,7 @@ function Component(t0) { const { arr } = t0; const x = useX(); let t1; - if ($[0] !== x || $[1] !== arr) { + if ($[0] !== arr || $[1] !== x) { let t2; if ($[3] !== x) { t2 = (i, id) => { @@ -66,8 +66,8 @@ function Component(t0) { t2 = $[4]; } t1 = arr.map(t2); - $[0] = x; - $[1] = arr; + $[0] = arr; + $[1] = x; $[2] = t1; } else { t1 = $[2]; @@ -94,10 +94,10 @@ function _temp(t0) { t1 = $[1]; } let t2; - if ($[2] !== x || $[3] !== t1) { + if ($[2] !== t1 || $[3] !== x) { t2 = {t1}; - $[2] = x; - $[3] = t1; + $[2] = t1; + $[3] = x; $[4] = t2; } else { t2 = $[4]; @@ -109,15 +109,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-separate-nested.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-separate-nested.expect.md index 7f86546cd4d19..9d2b254c063d7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-separate-nested.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-separate-nested.expect.md @@ -60,7 +60,7 @@ function Component(t0) { const { arr } = t0; const x = useX(); let t1; - if ($[0] !== x || $[1] !== arr) { + if ($[0] !== arr || $[1] !== x) { let t2; if ($[3] !== x) { t2 = (i, id) => { @@ -73,8 +73,8 @@ function Component(t0) { t2 = $[4]; } t1 = arr.map(t2); - $[0] = x; - $[1] = arr; + $[0] = arr; + $[1] = x; $[2] = t1; } else { t1 = $[2]; @@ -117,7 +117,7 @@ function _temp(t0) { t3 = $[5]; } let t4; - if ($[6] !== x || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) { + if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3 || $[9] !== x) { t4 = ( {t1} @@ -125,10 +125,10 @@ function _temp(t0) { {t3} ); - $[6] = x; - $[7] = t1; - $[8] = t2; - $[9] = t3; + $[6] = t1; + $[7] = t2; + $[8] = t3; + $[9] = x; $[10] = t4; } else { t4 = $[10]; @@ -140,15 +140,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-simple.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-simple.expect.md index 9e268227a2383..09323f5ac65e1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-simple.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-simple.expect.md @@ -50,7 +50,7 @@ function Component(t0) { const { arr } = t0; const x = useX(); let t1; - if ($[0] !== x || $[1] !== arr) { + if ($[0] !== arr || $[1] !== x) { let t2; if ($[3] !== x) { t2 = (i, id) => { @@ -63,8 +63,8 @@ function Component(t0) { t2 = $[4]; } t1 = arr.map(t2); - $[0] = x; - $[1] = arr; + $[0] = arr; + $[1] = x; $[2] = t1; } else { t1 = $[2]; @@ -91,10 +91,10 @@ function _temp(t0) { t1 = $[1]; } let t2; - if ($[2] !== x || $[3] !== t1) { + if ($[2] !== t1 || $[3] !== x) { t2 = {t1}; - $[2] = x; - $[3] = t1; + $[2] = t1; + $[3] = x; $[4] = t2; } else { t2 = $[4]; @@ -106,15 +106,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md index b1dfbc61c39fc..aeb0cdf88ccef 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md @@ -53,8 +53,8 @@ function maybeMutate(x) {} function Component(props) { const $ = _c(11); - let Tag; let T0; + let Tag; let t0; if ($[0] !== props.component || $[1] !== props.alternateComponent) { const maybeMutable = new MaybeMutable(); @@ -64,12 +64,12 @@ function Component(props) { t0 = ((Tag = props.alternateComponent), maybeMutate(maybeMutable)); $[0] = props.component; $[1] = props.alternateComponent; - $[2] = Tag; - $[3] = T0; + $[2] = T0; + $[3] = Tag; $[4] = t0; } else { - Tag = $[2]; - T0 = $[3]; + T0 = $[2]; + Tag = $[3]; t0 = $[4]; } let t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md index e172ee1039343..bac21217c75f3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md @@ -44,7 +44,7 @@ function CaptureNotMutate(props) { } const idx = t0; let aliasedElement; - if ($[2] !== props.el || $[3] !== idx) { + if ($[2] !== idx || $[3] !== props.el) { const element = bar(props.el); const fn = function () { @@ -54,8 +54,8 @@ function CaptureNotMutate(props) { aliasedElement = fn(); mutate(aliasedElement); - $[2] = props.el; - $[3] = idx; + $[2] = idx; + $[3] = props.el; $[4] = aliasedElement; } else { aliasedElement = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.expect.md index 47c7a2d74327b..af9b1df36ad01 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.expect.md @@ -21,10 +21,10 @@ function App() { const { foo } = useContext_withSelector(MyContext, _temp); const { bar } = useContext_withSelector(MyContext, _temp2); let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.expect.md index 0b12c2e250875..d13682467b3ed 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.expect.md @@ -19,10 +19,10 @@ function App() { const $ = _c(3); const { foo, bar } = useContext_withSelector(MyContext, _temp); let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-reordering.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-reordering.expect.md index 5bf1f2cf4d483..e5a9081137a20 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-reordering.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-reordering.expect.md @@ -60,7 +60,7 @@ function Component() { t2 = $[3]; } let t3; - if ($[4] !== t1 || $[5] !== t0) { + if ($[4] !== t0 || $[5] !== t1) { t3 = (
{t2} @@ -68,8 +68,8 @@ function Component() { {t0}
); - $[4] = t1; - $[5] = t0; + $[4] = t0; + $[5] = t1; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-computed.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-computed.expect.md index 887479c01eb01..2fc302c8b4287 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-computed.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-computed.expect.md @@ -43,11 +43,11 @@ function foo(a, b, c) { } const y = t1; let t2; - if ($[4] !== x || $[5] !== y.method || $[6] !== b) { + if ($[4] !== b || $[5] !== x || $[6] !== y.method) { t2 = x[y.method](b); - $[4] = x; - $[5] = y.method; - $[6] = b; + $[4] = b; + $[5] = x; + $[6] = y.method; $[7] = t2; } else { t2 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md index c32777534b8d4..58c06101d38eb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md @@ -33,11 +33,11 @@ function foo(a, b, c) { const method = x.method; let t1; - if ($[2] !== method || $[3] !== x || $[4] !== b) { + if ($[2] !== b || $[3] !== method || $[4] !== x) { t1 = method.call(x, b); - $[2] = method; - $[3] = x; - $[4] = b; + $[2] = b; + $[3] = method; + $[4] = x; $[5] = t1; } else { t1 = $[5]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call.expect.md index ad45287d1ff5e..fd8a4935a8253 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call.expect.md @@ -40,10 +40,10 @@ function foo(a, b, c) { } const x = t0; let t1; - if ($[2] !== x || $[3] !== b) { + if ($[2] !== b || $[3] !== x) { t1 = x.foo(b); - $[2] = x; - $[3] = b; + $[2] = b; + $[3] = x; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutating-capture-in-unsplittable-memo-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutating-capture-in-unsplittable-memo-block.expect.md index 090e9d889cfd9..a3403e6c8d812 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutating-capture-in-unsplittable-memo-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutating-capture-in-unsplittable-memo-block.expect.md @@ -73,8 +73,8 @@ import { identity, mutate } from "shared-runtime"; function useFoo(t0) { const $ = _c(4); const { a, b } = t0; - let z; let y; + let z; if ($[0] !== a || $[1] !== b) { const x = { a }; y = {}; @@ -83,11 +83,11 @@ function useFoo(t0) { mutate(y); $[0] = a; $[1] = b; - $[2] = z; - $[3] = y; + $[2] = y; + $[3] = z; } else { - z = $[2]; - y = $[3]; + y = $[2]; + z = $[3]; } if (z[0] !== y) { throw new Error("oh no!"); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md index 4b500f52d6773..dc1cd699d295c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md @@ -40,7 +40,7 @@ function useHook(t0) { const { value } = t0; const [state] = useState(false); let t1; - if ($[0] !== value || $[1] !== state) { + if ($[0] !== state || $[1] !== value) { t1 = { getX() { return { @@ -52,8 +52,8 @@ function useHook(t0) { }; }, }; - $[0] = value; - $[1] = state; + $[0] = state; + $[1] = value; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md index 77875f789d7a8..3dd8e730325ea 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md @@ -63,10 +63,10 @@ function Component(t0) { t4 = $[3]; } let t5; - if ($[4] !== t4 || $[5] !== data) { + if ($[4] !== data || $[5] !== t4) { t5 = ; - $[4] = t4; - $[5] = data; + $[4] = data; + $[5] = t4; $[6] = t5; } else { t5 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md index 46767056bdcdf..3cd9877813c58 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md @@ -45,10 +45,10 @@ function Component(props) { t1 = $[3]; } let t2; - if ($[4] !== t1 || $[5] !== data) { + if ($[4] !== data || $[5] !== t1) { t2 = ; - $[4] = t1; - $[5] = data; + $[4] = data; + $[5] = t1; $[6] = t2; } else { t2 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md index 6e44a97b456b3..60a6171ab1ea1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md @@ -60,10 +60,10 @@ function Component(t0) { t3 = $[3]; } let t4; - if ($[4] !== t3 || $[5] !== data) { + if ($[4] !== data || $[5] !== t3) { t4 = ; - $[4] = t3; - $[5] = data; + $[4] = data; + $[5] = t3; $[6] = t4; } else { t4 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md index 77ded20d939bd..2674d78c997e7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md @@ -48,19 +48,19 @@ function Component(props) { const t1 = props?.items; let t2; - if ($[3] !== t1 || $[4] !== props.cond) { + if ($[3] !== props.cond || $[4] !== t1) { t2 = [t1, props.cond]; - $[3] = t1; - $[4] = props.cond; + $[3] = props.cond; + $[4] = t1; $[5] = t2; } else { t2 = $[5]; } let t3; - if ($[6] !== t2 || $[7] !== data) { + if ($[6] !== data || $[7] !== t2) { t3 = ; - $[6] = t2; - $[7] = data; + $[6] = data; + $[7] = t2; $[8] = t3; } else { t3 = $[8]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md index 10c23085d8e6b..1d4a50d2858ea 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md @@ -48,19 +48,19 @@ function Component(props) { const t1 = props?.items; let t2; - if ($[3] !== t1 || $[4] !== props.cond) { + if ($[3] !== props.cond || $[4] !== t1) { t2 = [t1, props.cond]; - $[3] = t1; - $[4] = props.cond; + $[3] = props.cond; + $[4] = t1; $[5] = t2; } else { t2 = $[5]; } let t3; - if ($[6] !== t2 || $[7] !== data) { + if ($[6] !== data || $[7] !== t2) { t3 = ; - $[6] = t2; - $[7] = data; + $[6] = data; + $[7] = t2; $[8] = t3; } else { t3 = $[8]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/partial-early-return-within-reactive-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/partial-early-return-within-reactive-scope.expect.md index 398161f0c6a24..42b3b21a20903 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/partial-early-return-within-reactive-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/partial-early-return-within-reactive-scope.expect.md @@ -31,8 +31,8 @@ export const FIXTURE_ENTRYPOINT = { import { c as _c } from "react/compiler-runtime"; function Component(props) { const $ = _c(4); - let y; let t0; + let y; if ($[0] !== props) { t0 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -57,11 +57,11 @@ function Component(props) { } } $[0] = props; - $[1] = y; - $[2] = t0; + $[1] = t0; + $[2] = y; } else { - y = $[1]; - t0 = $[2]; + t0 = $[1]; + y = $[2]; } if (t0 !== Symbol.for("react.early_return_sentinel")) { return t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md index 9ca63e23c4d72..3da133e9295bc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md @@ -40,7 +40,7 @@ function useFoo(minWidth, otherProp) { const $ = _c(7); const [width] = useState(1); let t0; - if ($[0] !== width || $[1] !== minWidth || $[2] !== otherProp) { + if ($[0] !== minWidth || $[1] !== otherProp || $[2] !== width) { const x = []; let t1; if ($[4] !== minWidth || $[5] !== width) { @@ -55,9 +55,9 @@ function useFoo(minWidth, otherProp) { arrayPush(x, otherProp); t0 = [style, x]; - $[0] = width; - $[1] = minWidth; - $[2] = otherProp; + $[0] = minWidth; + $[1] = otherProp; + $[2] = width; $[3] = t0; } else { t0 = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md index 947e3bd2eb8ff..ee4e4634cbc21 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md @@ -42,9 +42,9 @@ import { Stringify } from "shared-runtime"; function Foo(t0) { const $ = _c(8); const { arr1, arr2, foo } = t0; - let t1; let getVal1; - if ($[0] !== arr1 || $[1] !== foo || $[2] !== arr2) { + let t1; + if ($[0] !== arr1 || $[1] !== arr2 || $[2] !== foo) { const x = [arr1]; let y; @@ -55,13 +55,13 @@ function Foo(t0) { t1 = () => [y]; foo ? (y = x.concat(arr2)) : y; $[0] = arr1; - $[1] = foo; - $[2] = arr2; - $[3] = t1; - $[4] = getVal1; + $[1] = arr2; + $[2] = foo; + $[3] = getVal1; + $[4] = t1; } else { - t1 = $[3]; - getVal1 = $[4]; + getVal1 = $[3]; + t1 = $[4]; } const getVal2 = t1; let t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-alloc.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-alloc.expect.md index 3a7016f803d4e..f7353ddd5e97c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-alloc.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-alloc.expect.md @@ -44,10 +44,10 @@ function Component(t0) { t3 = $[1]; } let t4; - if ($[2] !== t3 || $[3] !== propA) { + if ($[2] !== propA || $[3] !== t3) { t4 = { value: t3, other: propA }; - $[2] = t3; - $[3] = propA; + $[2] = propA; + $[3] = t3; $[4] = t4; } else { t4 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-noAlloc.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-noAlloc.expect.md index f0ce9b9114fc4..c6ad9bcdac356 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-noAlloc.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-noAlloc.expect.md @@ -34,10 +34,10 @@ function Component(t0) { const t2 = propB?.x.y; let t3; - if ($[0] !== t2 || $[1] !== propA) { + if ($[0] !== propA || $[1] !== t2) { t3 = { value: t2, other: propA }; - $[0] = t2; - $[1] = propA; + $[0] = propA; + $[1] = t2; $[2] = t3; } else { t3 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md index 9d7feacd6d7f1..7a27bb8521ed5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md @@ -40,7 +40,7 @@ function useFoo(minWidth, otherProp) { const $ = _c(6); const [width] = useState(1); let t0; - if ($[0] !== width || $[1] !== minWidth || $[2] !== otherProp) { + if ($[0] !== minWidth || $[1] !== otherProp || $[2] !== width) { const x = []; let t1; @@ -58,9 +58,9 @@ function useFoo(minWidth, otherProp) { arrayPush(x, otherProp); t0 = [style, x]; - $[0] = width; - $[1] = minWidth; - $[2] = otherProp; + $[0] = minWidth; + $[1] = otherProp; + $[2] = width; $[3] = t0; } else { t0 = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md index e9d2bffb30513..5fc0ec510b3d1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md @@ -44,7 +44,7 @@ function Foo(t0) { const { arr1, arr2, foo } = t0; let t1; let val1; - if ($[0] !== arr1 || $[1] !== foo || $[2] !== arr2) { + if ($[0] !== arr1 || $[1] !== arr2 || $[2] !== foo) { const x = [arr1]; let y; @@ -63,8 +63,8 @@ function Foo(t0) { foo ? (y = x.concat(arr2)) : y; t1 = (() => [y])(); $[0] = arr1; - $[1] = foo; - $[2] = arr2; + $[1] = arr2; + $[2] = foo; $[3] = t1; $[4] = val1; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-reassigned-loop-force-scopes-enabled.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-reassigned-loop-force-scopes-enabled.expect.md index 594e68f24feca..de39fc9706a69 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-reassigned-loop-force-scopes-enabled.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-reassigned-loop-force-scopes-enabled.expect.md @@ -32,15 +32,15 @@ function Component(t0) { const $ = _c(5); const { base, start, increment, test } = t0; let value; - if ($[0] !== base || $[1] !== start || $[2] !== test || $[3] !== increment) { + if ($[0] !== base || $[1] !== increment || $[2] !== start || $[3] !== test) { value = base; for (let i = start; i < test; i = i + increment, i) { value = value + i; } $[0] = base; - $[1] = start; - $[2] = test; - $[3] = increment; + $[1] = increment; + $[2] = start; + $[3] = test; $[4] = value; } else { value = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md index d0486cd8c29fd..28612f2d738dd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md @@ -63,10 +63,10 @@ function Component(t0) { t4 = $[3]; } let t5; - if ($[4] !== t4 || $[5] !== data) { + if ($[4] !== data || $[5] !== t4) { t5 = ; - $[4] = t4; - $[5] = data; + $[4] = data; + $[5] = t4; $[6] = t5; } else { t5 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md index b4a55fcb61eee..2861ab71c6e97 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md @@ -45,10 +45,10 @@ function Component(props) { t1 = $[3]; } let t2; - if ($[4] !== t1 || $[5] !== data) { + if ($[4] !== data || $[5] !== t1) { t2 = ; - $[4] = t1; - $[5] = data; + $[4] = data; + $[5] = t1; $[6] = t2; } else { t2 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md index f15b9b8e9b816..b5db44aa2b6c0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md @@ -60,10 +60,10 @@ function Component(t0) { t3 = $[3]; } let t4; - if ($[4] !== t3 || $[5] !== data) { + if ($[4] !== data || $[5] !== t3) { t4 = ; - $[4] = t3; - $[5] = data; + $[4] = data; + $[5] = t3; $[6] = t4; } else { t4 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/partial-early-return-within-reactive-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/partial-early-return-within-reactive-scope.expect.md index 324eb714fc89b..acc72529ee96d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/partial-early-return-within-reactive-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/partial-early-return-within-reactive-scope.expect.md @@ -32,8 +32,8 @@ export const FIXTURE_ENTRYPOINT = { import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR function Component(props) { const $ = _c(6); - let y; let t0; + let y; if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) { t0 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -60,11 +60,11 @@ function Component(props) { $[0] = props.cond; $[1] = props.a; $[2] = props.b; - $[3] = y; - $[4] = t0; + $[3] = t0; + $[4] = y; } else { - y = $[3]; - t0 = $[4]; + t0 = $[3]; + y = $[4]; } if (t0 !== Symbol.for("react.early_return_sentinel")) { return t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-local-var.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-local-var.expect.md index c0f8aa97cd47e..673dd0d5fdf5c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-local-var.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-local-var.expect.md @@ -58,7 +58,7 @@ function useFoo(t0) { local = $[1]; } let t1; - if ($[2] !== shouldReadA || $[3] !== local) { + if ($[2] !== local || $[3] !== shouldReadA) { t1 = ( { @@ -70,8 +70,8 @@ function useFoo(t0) { shouldInvokeFns={true} /> ); - $[2] = shouldReadA; - $[3] = local; + $[2] = local; + $[3] = shouldReadA; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-not-hoisted.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-not-hoisted.expect.md index e37b8365a2faf..abf4c98f23278 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-not-hoisted.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-cond-access-not-hoisted.expect.md @@ -41,7 +41,7 @@ function Foo(t0) { const $ = _c(3); const { a, shouldReadA } = t0; let t1; - if ($[0] !== shouldReadA || $[1] !== a) { + if ($[0] !== a || $[1] !== shouldReadA) { t1 = ( { @@ -53,8 +53,8 @@ function Foo(t0) { shouldInvokeFns={true} /> ); - $[0] = shouldReadA; - $[1] = a; + $[0] = a; + $[1] = shouldReadA; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-access-hoists-other-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-access-hoists-other-dep.expect.md index 89b4d281f86dc..d82956e4a0dbc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-access-hoists-other-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-access-hoists-other-dep.expect.md @@ -51,13 +51,13 @@ function Foo(t0) { const fn = t1; useIdentity(null); let x; - if ($[2] !== cond || $[3] !== a.b.c) { + if ($[2] !== a.b.c || $[3] !== cond) { x = makeArray(); if (cond) { x.push(identity(a.b.c)); } - $[2] = cond; - $[3] = a.b.c; + $[2] = a.b.c; + $[3] = cond; $[4] = x; } else { x = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-optional-hoists-other-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-optional-hoists-other-dep.expect.md index 591e04de7ba15..c81e59eceaf94 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-optional-hoists-other-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-function-uncond-optional-hoists-other-dep.expect.md @@ -50,22 +50,22 @@ function Foo(t0) { const fn = t1; useIdentity(null); let arr; - if ($[2] !== cond || $[3] !== a.b?.c.e) { + if ($[2] !== a.b?.c.e || $[3] !== cond) { arr = makeArray(); if (cond) { arr.push(identity(a.b?.c.e)); } - $[2] = cond; - $[3] = a.b?.c.e; + $[2] = a.b?.c.e; + $[3] = cond; $[4] = arr; } else { arr = $[4]; } let t2; - if ($[5] !== fn || $[6] !== arr) { + if ($[5] !== arr || $[6] !== fn) { t2 = ; - $[5] = fn; - $[6] = arr; + $[5] = arr; + $[6] = fn; $[7] = t2; } else { t2 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md index 902a1578c8870..30cea1e2c8ebb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md @@ -38,15 +38,15 @@ import { identity } from "shared-runtime"; function usePromoteUnconditionalAccessToDependency(props, other) { const $ = _c(4); let x; - if ($[0] !== props.a.a.a || $[1] !== props.a.b || $[2] !== other) { + if ($[0] !== other || $[1] !== props.a.a.a || $[2] !== props.a.b) { x = {}; x.a = props.a.a.a; if (identity(other)) { x.c = props.a.b.c; } - $[0] = props.a.a.a; - $[1] = props.a.b; - $[2] = other; + $[0] = other; + $[1] = props.a.a.a; + $[2] = props.a.b; $[3] = x; } else { x = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md index 37846215b1d9e..fee31c9fafb87 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md @@ -35,8 +35,8 @@ function Component(props) { import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR function Component(props) { const $ = _c(8); - let y; let t0; + let y; if ($[0] !== props.p0 || $[1] !== props.p2) { const x = []; bb0: switch (props.p0) { @@ -65,19 +65,19 @@ function Component(props) { t0 = ; $[0] = props.p0; $[1] = props.p2; - $[2] = y; - $[3] = t0; + $[2] = t0; + $[3] = y; } else { - y = $[2]; - t0 = $[3]; + t0 = $[2]; + y = $[3]; } const child = t0; y.push(props.p4); let t1; - if ($[5] !== y || $[6] !== child) { + if ($[5] !== child || $[6] !== y) { t1 = {child}; - $[5] = y; - $[6] = child; + $[5] = child; + $[6] = y; $[7] = t1; } else { t1 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md index 1be4143849266..62906680155df 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md @@ -30,8 +30,8 @@ function Component(props) { import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR function Component(props) { const $ = _c(8); - let y; let t0; + let y; if ($[0] !== props.p0 || $[1] !== props.p2 || $[2] !== props.p3) { const x = []; switch (props.p0) { @@ -48,19 +48,19 @@ function Component(props) { $[0] = props.p0; $[1] = props.p2; $[2] = props.p3; - $[3] = y; - $[4] = t0; + $[3] = t0; + $[4] = y; } else { - y = $[3]; - t0 = $[4]; + t0 = $[3]; + y = $[4]; } const child = t0; y.push(props.p4); let t1; - if ($[5] !== y || $[6] !== child) { + if ($[5] !== child || $[6] !== y) { t1 = {child}; - $[5] = y; - $[6] = child; + $[5] = child; + $[6] = y; $[7] = t1; } else { t1 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md index 7480362a43798..c6331bd4a0873 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md @@ -54,10 +54,10 @@ function Component(props) { } const c = t0; let t1; - if ($[3] !== c || $[4] !== a) { + if ($[3] !== a || $[4] !== c) { t1 = [c, a]; - $[3] = c; - $[4] = a; + $[3] = a; + $[4] = c; $[5] = t1; } else { t1 = $[5]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md index 29e3e2757ff68..35637b1a59df3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md @@ -41,10 +41,10 @@ function Component(props) { } const count = t1; let t2; - if ($[5] !== items || $[6] !== count) { + if ($[5] !== count || $[6] !== items) { t2 = { items, count }; - $[5] = items; - $[6] = count; + $[5] = count; + $[6] = items; $[7] = t2; } else { t2 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md index 3408f707d67a9..bb76df4de029b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md @@ -40,10 +40,10 @@ function Component(props) { } const count = t1; let t2; - if ($[4] !== items || $[5] !== count) { + if ($[4] !== count || $[5] !== items) { t2 = { items, count }; - $[4] = items; - $[5] = count; + $[4] = count; + $[5] = items; $[6] = t2; } else { t2 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md index e682a01086546..422f4cf54754a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md @@ -42,8 +42,8 @@ export const FIXTURE_ENTRYPOINT = { import { c as _c } from "react/compiler-runtime"; function foo(a, b, c) { const $ = _c(10); - let x; let t0; + let x; if ($[0] !== a) { x = []; if (a) { @@ -52,11 +52,11 @@ function foo(a, b, c) { t0 =
{x}
; $[0] = a; - $[1] = x; - $[2] = t0; + $[1] = t0; + $[2] = x; } else { - x = $[1]; - t0 = $[2]; + t0 = $[1]; + x = $[2]; } const y = t0; bb0: switch (b) { @@ -83,15 +83,15 @@ function foo(a, b, c) { } } let t1; - if ($[7] !== y || $[8] !== x) { + if ($[7] !== x || $[8] !== y) { t1 = (
{y} {x}
); - $[7] = y; - $[8] = x; + $[7] = x; + $[8] = y; $[9] = t1; } else { t1 = $[9]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-break-in-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-break-in-scope.expect.md index 3ad544344d6d9..f3ddf57ec0099 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-break-in-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-break-in-scope.expect.md @@ -34,7 +34,7 @@ function useFoo(t0) { const $ = _c(3); const { obj, objIsNull } = t0; let x; - if ($[0] !== objIsNull || $[1] !== obj) { + if ($[0] !== obj || $[1] !== objIsNull) { x = []; bb0: { if (objIsNull) { @@ -45,8 +45,8 @@ function useFoo(t0) { x.push(obj.b); } - $[0] = objIsNull; - $[1] = obj; + $[0] = obj; + $[1] = objIsNull; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-return-in-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-return-in-scope.expect.md index 449aa6d3d86f5..5700634449eae 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-return-in-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-return-in-scope.expect.md @@ -31,9 +31,9 @@ import { c as _c } from "react/compiler-runtime"; function useFoo(t0) { const $ = _c(4); const { obj, objIsNull } = t0; - let x; let t1; - if ($[0] !== objIsNull || $[1] !== obj) { + let x; + if ($[0] !== obj || $[1] !== objIsNull) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { x = []; @@ -46,13 +46,13 @@ function useFoo(t0) { x.push(obj.b); } - $[0] = objIsNull; - $[1] = obj; - $[2] = x; - $[3] = t1; + $[0] = obj; + $[1] = objIsNull; + $[2] = t1; + $[3] = x; } else { - x = $[2]; - t1 = $[3]; + t1 = $[2]; + x = $[3]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/bug-infer-function-cond-access-not-hoisted.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/bug-infer-function-cond-access-not-hoisted.expect.md index 4d45d3f3c6da6..18e9faf63b5dc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/bug-infer-function-cond-access-not-hoisted.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/bug-infer-function-cond-access-not-hoisted.expect.md @@ -38,7 +38,7 @@ function Foo(t0) { const $ = _c(3); const { a, shouldReadA } = t0; let t1; - if ($[0] !== shouldReadA || $[1] !== a.b.c) { + if ($[0] !== a.b.c || $[1] !== shouldReadA) { t1 = ( { @@ -50,8 +50,8 @@ function Foo(t0) { shouldInvokeFns={true} /> ); - $[0] = shouldReadA; - $[1] = a.b.c; + $[0] = a.b.c; + $[1] = shouldReadA; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance.expect.md index 701702f9dd7ff..2dd9362404931 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance.expect.md @@ -80,10 +80,10 @@ function useFoo(t0) { x = $[6]; } let t1; - if ($[7] !== y || $[8] !== x.a.b) { + if ($[7] !== x.a.b || $[8] !== y) { t1 = [y, x.a.b]; - $[7] = y; - $[8] = x.a.b; + $[7] = x.a.b; + $[8] = y; $[9] = t1; } else { t1 = $[9]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/break-in-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/break-in-scope.expect.md index b4c25d5f45041..e024bc893a034 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/break-in-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/break-in-scope.expect.md @@ -36,7 +36,7 @@ function useFoo(t0) { const $ = _c(3); const { obj, objIsNull } = t0; let x; - if ($[0] !== objIsNull || $[1] !== obj) { + if ($[0] !== obj || $[1] !== objIsNull) { x = []; bb0: { if (objIsNull) { @@ -45,8 +45,8 @@ function useFoo(t0) { x.push(obj.a); } - $[0] = objIsNull; - $[1] = obj; + $[0] = obj; + $[1] = objIsNull; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/loop-break-in-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/loop-break-in-scope.expect.md index 359ba0dcde90f..055d1ce12e4f0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/loop-break-in-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/loop-break-in-scope.expect.md @@ -36,7 +36,7 @@ function useFoo(t0) { const $ = _c(3); const { obj, objIsNull } = t0; let x; - if ($[0] !== objIsNull || $[1] !== obj) { + if ($[0] !== obj || $[1] !== objIsNull) { x = []; for (let i = 0; i < 5; i++) { if (objIsNull) { @@ -45,8 +45,8 @@ function useFoo(t0) { x.push(obj.a); } - $[0] = objIsNull; - $[1] = obj; + $[0] = obj; + $[1] = objIsNull; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps.expect.md index bb4758768738d..1c2162352b3b1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps.expect.md @@ -42,8 +42,8 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(9); const { input, cond, hasAB } = t0; - let x; let t1; + let x; if ($[0] !== cond || $[1] !== hasAB || $[2] !== input) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -77,11 +77,11 @@ function useFoo(t0) { $[0] = cond; $[1] = hasAB; $[2] = input; - $[3] = x; - $[4] = t1; + $[3] = t1; + $[4] = x; } else { - x = $[3]; - t1 = $[4]; + t1 = $[3]; + x = $[4]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps1.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps1.expect.md index 59225b51551bc..ca8228e2db0b0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps1.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps1.expect.md @@ -43,8 +43,8 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(11); const { input, cond, hasAB } = t0; - let x; let t1; + let x; if ($[0] !== cond || $[1] !== hasAB || $[2] !== input) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -88,11 +88,11 @@ function useFoo(t0) { $[0] = cond; $[1] = hasAB; $[2] = input; - $[3] = x; - $[4] = t1; + $[3] = t1; + $[4] = x; } else { - x = $[3]; - t1 = $[4]; + t1 = $[3]; + x = $[4]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-in-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-in-scope.expect.md index 7a7f9a4b6ec29..ce12fb17b068f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-in-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-in-scope.expect.md @@ -33,9 +33,9 @@ import { c as _c } from "react/compiler-runtime"; function useFoo(t0) { const $ = _c(4); const { obj, objIsNull } = t0; - let x; let t1; - if ($[0] !== objIsNull || $[1] !== obj) { + let x; + if ($[0] !== obj || $[1] !== objIsNull) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { x = []; @@ -46,13 +46,13 @@ function useFoo(t0) { x.push(obj.b); } - $[0] = objIsNull; - $[1] = obj; - $[2] = x; - $[3] = t1; + $[0] = obj; + $[1] = objIsNull; + $[2] = t1; + $[3] = x; } else { - x = $[2]; - t1 = $[3]; + t1 = $[2]; + x = $[3]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-poisons-outer-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-poisons-outer-scope.expect.md index 2b925c24797e1..058bf85b69f3f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-poisons-outer-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-poisons-outer-scope.expect.md @@ -39,8 +39,8 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(6); const { input, cond } = t0; - let x; let t1; + let x; if ($[0] !== cond || $[1] !== input) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -61,11 +61,11 @@ function useFoo(t0) { } $[0] = cond; $[1] = input; - $[2] = x; - $[3] = t1; + $[2] = t1; + $[3] = x; } else { - x = $[2]; - t1 = $[3]; + t1 = $[2]; + x = $[3]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/jump-target-within-scope-loop-break.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/jump-target-within-scope-loop-break.expect.md index 291998c8ad718..2715a0c92dac3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/jump-target-within-scope-loop-break.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/jump-target-within-scope-loop-break.expect.md @@ -40,7 +40,7 @@ function useFoo(t0) { const $ = _c(3); const { input, max } = t0; let x; - if ($[0] !== max || $[1] !== input.a.b) { + if ($[0] !== input.a.b || $[1] !== max) { x = []; let i = 0; while (true) { @@ -52,8 +52,8 @@ function useFoo(t0) { x.push(i); x.push(input.a.b); - $[0] = max; - $[1] = input.a.b; + $[0] = input.a.b; + $[1] = max; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps.expect.md index 84b8fa1d43d54..845ea4b5ac2d4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps.expect.md @@ -33,8 +33,8 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(9); const { input, hasAB, returnNull } = t0; - let x; let t1; + let x; if ($[0] !== hasAB || $[1] !== input.a || $[2] !== returnNull) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -68,11 +68,11 @@ function useFoo(t0) { $[0] = hasAB; $[1] = input.a; $[2] = returnNull; - $[3] = x; - $[4] = t1; + $[3] = t1; + $[4] = x; } else { - x = $[3]; - t1 = $[4]; + t1 = $[3]; + x = $[4]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps1.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps1.expect.md index a55922f610486..d3e463495bb34 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps1.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps1.expect.md @@ -43,8 +43,8 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(11); const { input, cond2, cond1 } = t0; - let x; let t1; + let x; if ($[0] !== cond1 || $[1] !== cond2 || $[2] !== input.a.b) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -88,11 +88,11 @@ function useFoo(t0) { $[0] = cond1; $[1] = cond2; $[2] = input.a.b; - $[3] = x; - $[4] = t1; + $[3] = t1; + $[4] = x; } else { - x = $[3]; - t1 = $[4]; + t1 = $[3]; + x = $[4]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/promote-uncond.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/promote-uncond.expect.md index 09806d8b4b15d..d3a61a1019c4b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/promote-uncond.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/promote-uncond.expect.md @@ -36,14 +36,14 @@ import { identity } from "shared-runtime"; function usePromoteUnconditionalAccessToDependency(props, other) { const $ = _c(3); let x; - if ($[0] !== props.a || $[1] !== other) { + if ($[0] !== other || $[1] !== props.a) { x = {}; x.a = props.a.a.a; if (identity(other)) { x.c = props.a.b.c; } - $[0] = props.a; - $[1] = other; + $[0] = other; + $[1] = props.a; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/reduce-if-exhaustive-poisoned-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/reduce-if-exhaustive-poisoned-deps.expect.md index 01ab4f6b0a537..41a7a25d63a31 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/reduce-if-exhaustive-poisoned-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/reduce-if-exhaustive-poisoned-deps.expect.md @@ -34,9 +34,9 @@ import { identity } from "shared-runtime"; function useFoo(t0) { const $ = _c(11); const { input, inputHasAB, inputHasABC } = t0; - let x; let t1; - if ($[0] !== inputHasABC || $[1] !== input.a || $[2] !== inputHasAB) { + let x; + if ($[0] !== input.a || $[1] !== inputHasAB || $[2] !== inputHasABC) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { x = []; @@ -75,14 +75,14 @@ function useFoo(t0) { x.push(t2); } } - $[0] = inputHasABC; - $[1] = input.a; - $[2] = inputHasAB; - $[3] = x; - $[4] = t1; + $[0] = input.a; + $[1] = inputHasAB; + $[2] = inputHasABC; + $[3] = t1; + $[4] = x; } else { - x = $[3]; - t1 = $[4]; + t1 = $[3]; + x = $[4]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/subpath-order1.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/subpath-order1.expect.md index a62223d72d993..03e3e96397958 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/subpath-order1.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/subpath-order1.expect.md @@ -40,14 +40,14 @@ import { identity } from "shared-runtime"; function useConditionalSubpath1(props, cond) { const $ = _c(3); let x; - if ($[0] !== props.a || $[1] !== cond) { + if ($[0] !== cond || $[1] !== props.a) { x = {}; x.b = props.a.b; if (identity(cond)) { x.a = props.a; } - $[0] = props.a; - $[1] = cond; + $[0] = cond; + $[1] = props.a; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/superpath-order1.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/superpath-order1.expect.md index 02117feee2c2c..5b246175f9644 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/superpath-order1.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/superpath-order1.expect.md @@ -48,14 +48,14 @@ function useConditionalSuperpath1(t0) { const $ = _c(3); const { props, cond } = t0; let x; - if ($[0] !== props.a || $[1] !== cond) { + if ($[0] !== cond || $[1] !== props.a) { x = {}; x.a = props.a; if (identity(cond)) { x.b = props.a.b; } - $[0] = props.a; - $[1] = cond; + $[0] = cond; + $[1] = props.a; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-access-in-mutable-range.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-access-in-mutable-range.expect.md index 34979e9de9485..c91cf94445ca9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-access-in-mutable-range.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-access-in-mutable-range.expect.md @@ -49,15 +49,15 @@ function Component(t0) { const $ = _c(8); const { cond, other } = t0; let x; - if ($[0] !== other || $[1] !== cond) { + if ($[0] !== cond || $[1] !== other) { x = makeObject_Primitives(); setProperty(x, { b: 3, other }, "a"); identity(x.a.b); if (!cond) { x.a = null; } - $[0] = other; - $[1] = cond; + $[0] = cond; + $[1] = other; $[2] = x; } else { x = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.expect.md index da6912d35e0b4..a2bd99e9a7691 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.expect.md @@ -82,10 +82,10 @@ function Component(t0) { } const b = t3; let t4; - if ($[4] !== b || $[5] !== a) { + if ($[4] !== a || $[5] !== b) { t4 = { b, a }; - $[4] = b; - $[5] = a; + $[4] = a; + $[5] = b; $[6] = t4; } else { t4 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md index bba0b3f1392ba..0089d20af2ff3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md @@ -59,7 +59,7 @@ function Component(t0) { const serverTime = useServerTime(); let t1; let timestampLabel; - if ($[0] !== highlightedItem || $[1] !== serverTime || $[2] !== label) { + if ($[0] !== highlightedItem || $[1] !== label || $[2] !== serverTime) { const highlight = new Highlight(highlightedItem); const time = serverTime.get(); @@ -68,8 +68,8 @@ function Component(t0) { t1 = highlight.render(); $[0] = highlightedItem; - $[1] = serverTime; - $[2] = label; + $[1] = label; + $[2] = serverTime; $[3] = t1; $[4] = timestampLabel; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value-via-alias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value-via-alias.expect.md index 9c21dc84004f7..ecdfa88b98013 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value-via-alias.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value-via-alias.expect.md @@ -66,10 +66,10 @@ function MyApp(t0) { const z = makeObject_Primitives(); const x = useIdentity(2); let t1; - if ($[0] !== x || $[1] !== count) { + if ($[0] !== count || $[1] !== x) { t1 = sum(x, count); - $[0] = x; - $[1] = count; + $[0] = count; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.expect.md index 1b6e91a6fdd3d..f9d725e0b3558 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.expect.md @@ -65,10 +65,10 @@ function MyApp(t0) { const z = makeObject_Primitives(); const x = useIdentity(2); let t1; - if ($[0] !== x || $[1] !== count) { + if ($[0] !== count || $[1] !== x) { t1 = sum(x, count); - $[0] = x; - $[1] = count; + $[0] = count; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-reactivity-value-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-reactivity-value-block.expect.md index 2dabc256f9ec2..1ad6f6a0477c3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-reactivity-value-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-reactivity-value-block.expect.md @@ -71,10 +71,10 @@ function Foo() { const shouldCaptureObj = obj != null && CONST_TRUE; const t0 = shouldCaptureObj ? identity(obj) : null; let t1; - if ($[0] !== t0 || $[1] !== obj) { + if ($[0] !== obj || $[1] !== t0) { t1 = [t0, obj]; - $[0] = t0; - $[1] = obj; + $[0] = obj; + $[1] = t0; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types-explicit-types.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types-explicit-types.expect.md index 4921fd340b1ce..d35cbe266f631 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types-explicit-types.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types-explicit-types.expect.md @@ -77,15 +77,15 @@ function Component() { const map = t3; const index = filtered.findIndex(_temp3); let t5; - if ($[8] !== map || $[9] !== index) { + if ($[8] !== index || $[9] !== map) { t5 = (
{map} {index}
); - $[8] = map; - $[9] = index; + $[8] = index; + $[9] = map; $[10] = t5; } else { t5 = $[10]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types.expect.md index 80d046ec1807a..eda7a0cbfebc5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types.expect.md @@ -74,15 +74,15 @@ function Component() { const map = t3; const index = filtered.findIndex(_temp3); let t5; - if ($[8] !== map || $[9] !== index) { + if ($[8] !== index || $[9] !== map) { t5 = (
{map} {index}
); - $[8] = map; - $[9] = index; + $[8] = index; + $[9] = map; $[10] = t5; } else { t5 = $[10]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary.expect.md index 5eff1aa0fe5e2..b5a78277288d8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary.expect.md @@ -21,13 +21,13 @@ function Component(listItem, thread) { let t0; let t1; let t2; - if ($[0] !== thread.threadType || $[1] !== listItem) { + if ($[0] !== listItem || $[1] !== thread.threadType) { const isFoo = isFooThread(thread.threadType); t1 = useBar; t2 = listItem; t0 = getBadgeText(listItem, isFoo); - $[0] = thread.threadType; - $[1] = listItem; + $[0] = listItem; + $[1] = thread.threadType; $[2] = t0; $[3] = t1; $[4] = t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-propagate-type-of-ternary-jsx.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-propagate-type-of-ternary-jsx.expect.md index 1d4a4b5d671ed..32cbbb2b918a2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-propagate-type-of-ternary-jsx.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-propagate-type-of-ternary-jsx.expect.md @@ -28,7 +28,7 @@ function V0(t0) { const { v1, v2 } = t0; const v5 = v1.v6?.v7; let t1; - if ($[0] !== v5 || $[1] !== v1 || $[2] !== v2) { + if ($[0] !== v1 || $[1] !== v2 || $[2] !== v5) { t1 = ( {v5 != null ? ( @@ -40,9 +40,9 @@ function V0(t0) { )} ); - $[0] = v5; - $[1] = v1; - $[2] = v2; + $[0] = v1; + $[1] = v2; + $[2] = v5; $[3] = t1; } else { t1 = $[3]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-slow-validate-preserve-memo.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-slow-validate-preserve-memo.expect.md index cec64e8cf0d9e..ab409b366d9c2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-slow-validate-preserve-memo.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-slow-validate-preserve-memo.expect.md @@ -36,7 +36,7 @@ function useTest(t0) { const $ = _c(3); const { isNull, data } = t0; let t1; - if ($[0] !== isNull || $[1] !== data) { + if ($[0] !== data || $[1] !== isNull) { t1 = Builder.makeBuilder(isNull, "hello world") ?.push("1", 2) ?.push(3, { a: 4, b: 5, c: data }) @@ -47,8 +47,8 @@ function useTest(t0) { ) ?.push(7, "8") ?.push("8", Builder.makeBuilder(!isNull)?.push(9).vals)?.vals; - $[0] = isNull; - $[1] = data; + $[0] = data; + $[1] = isNull; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unreachable-code-early-return-in-useMemo.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unreachable-code-early-return-in-useMemo.expect.md index 73674e5ffff43..496d80d52b027 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unreachable-code-early-return-in-useMemo.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unreachable-code-early-return-in-useMemo.expect.md @@ -77,10 +77,10 @@ function Component(t0) { t2 = $[3]; } let t3; - if ($[4] !== t2 || $[5] !== result) { + if ($[4] !== result || $[5] !== t2) { t3 = ; - $[4] = t2; - $[5] = result; + $[4] = result; + $[5] = t2; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro.expect.md index 2e9daceed798a..1b49552bea135 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro.expect.md @@ -26,8 +26,8 @@ import { c as _c } from "react/compiler-runtime"; function Component(props) { const $ = _c(7); const item = props.item; - let t0; let baseVideos; + let t0; let thumbnails; if ($[0] !== item) { thumbnails = []; @@ -40,12 +40,12 @@ function Component(props) { } }); $[0] = item; - $[1] = t0; - $[2] = baseVideos; + $[1] = baseVideos; + $[2] = t0; $[3] = thumbnails; } else { - t0 = $[1]; - baseVideos = $[2]; + baseVideos = $[1]; + t0 = $[2]; thumbnails = $[3]; } t0 = undefined; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md index 9aa75b2162515..aece9665c920c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md @@ -21,10 +21,10 @@ function Component(foo, ...t0) { const $ = _c(3); const [bar] = t0; let t1; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t1 = [foo, bar]; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md index ded1eb4006100..3681e9c469955 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md @@ -21,10 +21,10 @@ function Component(foo, ...t0) { const $ = _c(3); const bar = t0; let t1; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t1 = [foo, bar]; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md index f0a46be168a06..3e66b200411b1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md @@ -21,10 +21,10 @@ function Component(foo, ...t0) { const $ = _c(3); const { bar } = t0; let t1; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t1 = [foo, bar]; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md index 7c9c6a50289f2..1201a9a737439 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md @@ -73,14 +73,14 @@ function foo(props) { } const header = t0; let y; - if ($[5] !== x || $[6] !== props.b || $[7] !== props.c) { + if ($[5] !== props.b || $[6] !== props.c || $[7] !== x) { y = [x]; x = []; y.push(props.b); x.push(props.c); - $[5] = x; - $[6] = props.b; - $[7] = props.c; + $[5] = props.b; + $[6] = props.c; + $[7] = x; $[8] = y; $[9] = x; } else { @@ -103,15 +103,15 @@ function foo(props) { } const content = t1; let t2; - if ($[13] !== header || $[14] !== content) { + if ($[13] !== content || $[14] !== header) { t2 = ( <> {header} {content} ); - $[13] = header; - $[14] = content; + $[13] = content; + $[14] = header; $[15] = t2; } else { t2 = $[15]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md index 36b1d4541ae57..143496678edd3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md @@ -53,30 +53,30 @@ import { c as _c } from "react/compiler-runtime"; // note: comments are for the // emitted function foo(props) { const $ = _c(14); - let x; let t0; + let x; if ($[0] !== props.a) { x = []; x.push(props.a); t0 =
{x}
; $[0] = props.a; - $[1] = x; - $[2] = t0; + $[1] = t0; + $[2] = x; } else { - x = $[1]; - t0 = $[2]; + t0 = $[1]; + x = $[2]; } const header = t0; let y; - if ($[3] !== x || $[4] !== props.b || $[5] !== props.c) { + if ($[3] !== props.b || $[4] !== props.c || $[5] !== x) { y = [x]; x = []; y.push(props.b); x.push(props.c); - $[3] = x; - $[4] = props.b; - $[5] = props.c; + $[3] = props.b; + $[4] = props.c; + $[5] = x; $[6] = y; $[7] = x; } else { @@ -99,15 +99,15 @@ function foo(props) { } const content = t1; let t2; - if ($[11] !== header || $[12] !== content) { + if ($[11] !== content || $[12] !== header) { t2 = ( <> {header} {content} ); - $[11] = header; - $[12] = content; + $[11] = content; + $[12] = header; $[13] = t2; } else { t2 = $[13]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md index 5f10f44202d02..36a68d07c46c9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md @@ -43,9 +43,9 @@ import { identity } from "shared-runtime"; function Component(statusName) { const $ = _c(12); - let text; let t0; let t1; + let text; if ($[0] !== statusName) { const { status, text: t2 } = foo(statusName); text = t2; @@ -54,13 +54,13 @@ function Component(statusName) { t1 = identity(bg); t0 = identity(color); $[0] = statusName; - $[1] = text; - $[2] = t0; - $[3] = t1; + $[1] = t0; + $[2] = t1; + $[3] = text; } else { - text = $[1]; - t0 = $[2]; - t1 = $[3]; + t0 = $[1]; + t1 = $[2]; + text = $[3]; } let t2; if ($[4] !== text) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md index e2cd53bd0d03a..d8e991dc46a08 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md @@ -46,9 +46,9 @@ import { identity } from "shared-runtime"; function Component(statusName) { const $ = _c(12); + let font; let t0; let text; - let font; if ($[0] !== statusName) { const { status, text: t1 } = foo(statusName); text = t1; @@ -58,13 +58,13 @@ function Component(statusName) { t0 = identity(color); $[0] = statusName; - $[1] = t0; - $[2] = text; - $[3] = font; + $[1] = font; + $[2] = t0; + $[3] = text; } else { - t0 = $[1]; - text = $[2]; - font = $[3]; + font = $[1]; + t0 = $[2]; + text = $[3]; } const bg = t0; let t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md index 915218fcfa467..788109636b680 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md @@ -34,8 +34,8 @@ function Component(props) { import { c as _c } from "react/compiler-runtime"; function Component(props) { const $ = _c(7); - let y; let t0; + let y; if ($[0] !== props) { const x = []; bb0: switch (props.p0) { @@ -63,19 +63,19 @@ function Component(props) { t0 = ; $[0] = props; - $[1] = y; - $[2] = t0; + $[1] = t0; + $[2] = y; } else { - y = $[1]; - t0 = $[2]; + t0 = $[1]; + y = $[2]; } const child = t0; y.push(props.p4); let t1; - if ($[4] !== y || $[5] !== child) { + if ($[4] !== child || $[5] !== y) { t1 = {child}; - $[4] = y; - $[5] = child; + $[4] = child; + $[5] = y; $[6] = t1; } else { t1 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md index 0c5aea9c7da9c..2628982655deb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md @@ -29,8 +29,8 @@ function Component(props) { import { c as _c } from "react/compiler-runtime"; function Component(props) { const $ = _c(6); - let y; let t0; + let y; if ($[0] !== props) { const x = []; switch (props.p0) { @@ -45,19 +45,19 @@ function Component(props) { t0 = ; $[0] = props; - $[1] = y; - $[2] = t0; + $[1] = t0; + $[2] = y; } else { - y = $[1]; - t0 = $[2]; + t0 = $[1]; + y = $[2]; } const child = t0; y.push(props.p4); let t1; - if ($[3] !== y || $[4] !== child) { + if ($[3] !== child || $[4] !== y) { t1 = {child}; - $[3] = y; - $[4] = child; + $[3] = child; + $[4] = y; $[5] = t1; } else { t1 = $[5]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-children.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-children.expect.md index f106382d64176..4864c51a1fe25 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-children.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-children.expect.md @@ -50,7 +50,7 @@ function Component(t0) { const { arr } = t0; const x = useX(); let t1; - if ($[0] !== x || $[1] !== arr) { + if ($[0] !== arr || $[1] !== x) { let t2; if ($[3] !== x) { t2 = (i, id) => ( @@ -64,8 +64,8 @@ function Component(t0) { t2 = $[4]; } t1 = arr.map(t2); - $[0] = x; - $[1] = arr; + $[0] = arr; + $[1] = x; $[2] = t1; } else { t1 = $[2]; @@ -85,15 +85,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-duplicate-prop.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-duplicate-prop.expect.md index 77fd38aea1eb5..c661094fdd455 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-duplicate-prop.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-duplicate-prop.expect.md @@ -55,7 +55,7 @@ function Component(t0) { const { arr } = t0; const x = useX(); let t1; - if ($[0] !== x || $[1] !== arr) { + if ($[0] !== arr || $[1] !== x) { let t2; if ($[3] !== x) { t2 = (i, id) => ( @@ -70,8 +70,8 @@ function Component(t0) { t2 = $[4]; } t1 = arr.map(t2); - $[0] = x; - $[1] = arr; + $[0] = arr; + $[1] = x; $[2] = t1; } else { t1 = $[2]; @@ -91,15 +91,15 @@ function Bar(t0) { const $ = _c(3); const { x, children } = t0; let t1; - if ($[0] !== x || $[1] !== children) { + if ($[0] !== children || $[1] !== x) { t1 = ( <> {x} {children} ); - $[0] = x; - $[1] = children; + $[0] = children; + $[1] = x; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.expect.md index d064a48b7197a..7ac6486b47037 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.expect.md @@ -18,10 +18,10 @@ function App() { const $ = _c(3); const [foo, bar] = useContext(MyContext); let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.expect.md index f82af06866b76..3eac66304be68 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.expect.md @@ -22,10 +22,10 @@ function App() { const { foo } = context; const { bar } = context; let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.expect.md index 573b6db231c1e..4cca8b19d95cd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.expect.md @@ -22,10 +22,10 @@ function App() { const [foo] = context; const { bar } = context; let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.expect.md index 03ce7f97ba357..f5a3916626913 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.expect.md @@ -22,10 +22,10 @@ function App() { const { joe: t0, bar } = useContext(MyContext); const { foo } = t0; let t1; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t1 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t1; } else { t1 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.expect.md index 55387503cf744..0888d67b2aa94 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.expect.md @@ -22,10 +22,10 @@ function App() { const foo = context.foo; const bar = context.bar; let t0; - if ($[0] !== foo || $[1] !== bar) { + if ($[0] !== bar || $[1] !== foo) { t0 = ; - $[0] = foo; - $[1] = bar; + $[0] = bar; + $[1] = foo; $[2] = t0; } else { t0 = $[2]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-in-nested-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-in-nested-scope.expect.md index 268fa8d7eba35..2c27360c9fede 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-in-nested-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-in-nested-scope.expect.md @@ -42,9 +42,9 @@ import { mutate, setProperty, throwErrorWithMessageIf } from "shared-runtime"; function useFoo(t0) { const $ = _c(6); const { value, cond } = t0; - let y; let t1; - if ($[0] !== value || $[1] !== cond) { + let y; + if ($[0] !== cond || $[1] !== value) { t1 = Symbol.for("react.early_return_sentinel"); bb0: { y = [value]; @@ -68,13 +68,13 @@ function useFoo(t0) { } y.push(x); } - $[0] = value; - $[1] = cond; - $[2] = y; - $[3] = t1; + $[0] = cond; + $[1] = value; + $[2] = t1; + $[3] = y; } else { - y = $[2]; - t1 = $[3]; + t1 = $[2]; + y = $[3]; } if (t1 !== Symbol.for("react.early_return_sentinel")) { return t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md index b04bd5345817b..562c0bc1c86b5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md @@ -32,8 +32,8 @@ const { throwInput } = require("shared-runtime"); function Component(props) { const $ = _c(2); - let x; let t0; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -47,11 +47,11 @@ function Component(props) { break bb0; } } - $[0] = x; - $[1] = t0; + $[0] = t0; + $[1] = x; } else { - x = $[0]; - t0 = $[1]; + t0 = $[0]; + x = $[1]; } if (t0 !== Symbol.for("react.early_return_sentinel")) { return t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md index af5f2ebfcfea5..71a59aba2f758 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md @@ -33,8 +33,8 @@ const { shallowCopy, throwInput } = require("shared-runtime"); function Component(props) { const $ = _c(2); - let x; let t0; + let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = Symbol.for("react.early_return_sentinel"); bb0: { @@ -52,11 +52,11 @@ function Component(props) { break bb0; } } - $[0] = x; - $[1] = t0; + $[0] = t0; + $[1] = x; } else { - x = $[0]; - t0 = $[1]; + t0 = $[0]; + x = $[1]; } if (t0 !== Symbol.for("react.early_return_sentinel")) { return t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log-default-import.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log-default-import.expect.md index 54d5be2d6bf44..c3c45beb86544 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log-default-import.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log-default-import.expect.md @@ -78,10 +78,10 @@ export function Component(t0) { t5 = $[5]; } let t6; - if ($[6] !== t5 || $[7] !== item1) { + if ($[6] !== item1 || $[7] !== t5) { t6 = ; - $[6] = t5; - $[7] = item1; + $[6] = item1; + $[7] = t5; $[8] = t6; } else { t6 = $[8]; @@ -95,10 +95,10 @@ export function Component(t0) { t7 = $[10]; } let t8; - if ($[11] !== t7 || $[12] !== item2) { + if ($[11] !== item2 || $[12] !== t7) { t8 = ; - $[11] = t7; - $[12] = item2; + $[11] = item2; + $[12] = t7; $[13] = t8; } else { t8 = $[13]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log.expect.md index 072c6d03d9adb..4acbd2dfdb3be 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log.expect.md @@ -76,10 +76,10 @@ export function Component(t0) { t5 = $[5]; } let t6; - if ($[6] !== t5 || $[7] !== item1) { + if ($[6] !== item1 || $[7] !== t5) { t6 = ; - $[6] = t5; - $[7] = item1; + $[6] = item1; + $[7] = t5; $[8] = t6; } else { t6 = $[8]; @@ -93,10 +93,10 @@ export function Component(t0) { t7 = $[10]; } let t8; - if ($[11] !== t7 || $[12] !== item2) { + if ($[11] !== item2 || $[12] !== t7) { t8 = ; - $[11] = t7; - $[12] = item2; + $[11] = item2; + $[12] = t7; $[13] = t8; } else { t8 = $[13]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture-namespace-import.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture-namespace-import.expect.md index caa74267f326b..5016b0c4dfdfd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture-namespace-import.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture-namespace-import.expect.md @@ -114,10 +114,10 @@ export function Component(t0) { } const t10 = items_0[1]; let t11; - if ($[14] !== t9 || $[15] !== t10) { + if ($[14] !== t10 || $[15] !== t9) { t11 = ; - $[14] = t9; - $[15] = t10; + $[14] = t10; + $[15] = t9; $[16] = t11; } else { t11 = $[16]; @@ -132,16 +132,16 @@ export function Component(t0) { t12 = $[19]; } let t13; - if ($[20] !== t12 || $[21] !== items_0) { + if ($[20] !== items_0 || $[21] !== t12) { t13 = ; - $[20] = t12; - $[21] = items_0; + $[20] = items_0; + $[21] = t12; $[22] = t13; } else { t13 = $[22]; } let t14; - if ($[23] !== t8 || $[24] !== t11 || $[25] !== t13) { + if ($[23] !== t11 || $[24] !== t13 || $[25] !== t8) { t14 = ( <> {t8} @@ -149,9 +149,9 @@ export function Component(t0) { {t13} ); - $[23] = t8; - $[24] = t11; - $[25] = t13; + $[23] = t11; + $[24] = t13; + $[25] = t8; $[26] = t14; } else { t14 = $[26]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture.expect.md index a92abd4ca597c..3f341fc6650d5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture.expect.md @@ -114,10 +114,10 @@ export function Component(t0) { } const t10 = items_0[1]; let t11; - if ($[14] !== t9 || $[15] !== t10) { + if ($[14] !== t10 || $[15] !== t9) { t11 = ; - $[14] = t9; - $[15] = t10; + $[14] = t10; + $[15] = t9; $[16] = t11; } else { t11 = $[16]; @@ -132,16 +132,16 @@ export function Component(t0) { t12 = $[19]; } let t13; - if ($[20] !== t12 || $[21] !== items_0) { + if ($[20] !== items_0 || $[21] !== t12) { t13 = ; - $[20] = t12; - $[21] = items_0; + $[20] = items_0; + $[21] = t12; $[22] = t13; } else { t13 = $[22]; } let t14; - if ($[23] !== t8 || $[24] !== t11 || $[25] !== t13) { + if ($[23] !== t11 || $[24] !== t13 || $[25] !== t8) { t14 = ( <> {t8} @@ -149,9 +149,9 @@ export function Component(t0) { {t13} ); - $[23] = t8; - $[24] = t11; - $[25] = t13; + $[23] = t11; + $[24] = t13; + $[25] = t8; $[26] = t14; } else { t14 = $[26]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unary-expr.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unary-expr.expect.md index fbd13dc1b06b2..7fa86838e8c2a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unary-expr.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unary-expr.expect.md @@ -38,22 +38,22 @@ function component(a) { const f = typeof t.t; let t0; if ( - $[0] !== z || - $[1] !== p || - $[2] !== q || + $[0] !== e || + $[1] !== f || + $[2] !== m || $[3] !== n || - $[4] !== m || - $[5] !== e || - $[6] !== f + $[4] !== p || + $[5] !== q || + $[6] !== z ) { t0 = { z, p, q, n, m, e, f }; - $[0] = z; - $[1] = p; - $[2] = q; + $[0] = e; + $[1] = f; + $[2] = m; $[3] = n; - $[4] = m; - $[5] = e; - $[6] = f; + $[4] = p; + $[5] = q; + $[6] = z; $[7] = t0; } else { t0 = $[7]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-call-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-call-expression.expect.md index 663a6788f345b..7f79cae4a0361 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-call-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-call-expression.expect.md @@ -89,10 +89,10 @@ function Inner(props) { t2 = $[3]; } let t3; - if ($[4] !== t2 || $[5] !== output) { + if ($[4] !== output || $[5] !== t2) { t3 = ; - $[4] = t2; - $[5] = output; + $[4] = output; + $[5] = t2; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-conditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-conditional.expect.md index ffa5f57b437d5..d94a5e7e375b3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-conditional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-conditional.expect.md @@ -109,10 +109,10 @@ function Inner(props) { t4 = $[3]; } let t5; - if ($[4] !== t4 || $[5] !== output) { + if ($[4] !== output || $[5] !== t4) { t5 = ; - $[4] = t4; - $[5] = output; + $[4] = output; + $[5] = t4; $[6] = t5; } else { t5 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-method-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-method-call.expect.md index 99effce93483c..cf0093ea941bf 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-method-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-method-call.expect.md @@ -91,10 +91,10 @@ function Inner(props) { t2 = $[3]; } let t3; - if ($[4] !== t2 || $[5] !== output) { + if ($[4] !== output || $[5] !== t2) { t3 = ; - $[4] = t2; - $[5] = output; + $[4] = output; + $[5] = t2; $[6] = t3; } else { t3 = $[6]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md index 1292ea14890e1..c3e115fa0d1cf 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md @@ -51,7 +51,7 @@ function Component(props) { } const exit = t0; let t1; - if ($[2] !== item.value || $[3] !== exit) { + if ($[2] !== exit || $[3] !== item.value) { t1 = () => { const cleanup = GlobalEventEmitter.addListener("onInput", () => { if (item.value) { @@ -60,8 +60,8 @@ function Component(props) { }); return () => cleanup.remove(); }; - $[2] = item.value; - $[3] = exit; + $[2] = exit; + $[3] = item.value; $[4] = t1; } else { t1 = $[4]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-unpruned-dependency.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-unpruned-dependency.expect.md index b6a4187355c14..28d3e333594a7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-unpruned-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-unpruned-dependency.expect.md @@ -62,13 +62,13 @@ function Component(props) { {w} ); - let condition = $[2] !== x || $[3] !== w; + let condition = $[2] !== w || $[3] !== x; if (!condition) { let old$t1 = $[4]; $structuralCheck(old$t1, t1, "t1", "Component", "cached", "(7:10)"); } - $[2] = x; - $[3] = w; + $[2] = w; + $[3] = x; $[4] = t1; if (condition) { t1 = (