[compiler][be] Stabilize compiler output: sort deps and decls by name (#31362)
All dependencies and declarations of a reactive scope can be reordered to scope start/end. i.e. generated code does not depend on conditional short-circuiting logic as dependencies are inferred to have no side effects. Sorting these by name helps us get higher signal compilation snapshot diffs when upgrading the compiler and testing PRs
mofeiZ committed
Nov 5, 2024 at 18:26 UTC
f2f002c7c19e273f3f31289d6f288c3248f10183
154 files changed
+732
-685
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts
+49
-2
@@ -34,6 +34,7 @@ import {
34
ReactiveInstruction,
35
ReactiveScope,
36
ReactiveScopeBlock,
37
+ ReactiveScopeDeclaration,
38
ReactiveScopeDependency,
39
ReactiveTerminal,
40
ReactiveValue,
@@ -572,7 +573,8 @@ function codegenReactiveScope(
573
const changeExpressions: Array<t.Expression> = [];
574
const changeExpressionComments: Array<string> = [];
575
const outputComments: Array<string> = [];
575
- for (const dep of scope.dependencies) {
576
+
577
+ for (const dep of [...scope.dependencies].sort(compareScopeDependency)) {
578
const index = cx.nextCacheIndex;
579
changeExpressionComments.push(printDependencyComment(dep));
580
const comparison = t.binaryExpression(
@@ -615,7 +617,10 @@ function codegenReactiveScope(
617
);
618
}
619
let firstOutputIndex: number | null = null;
618
- for (const [, {identifier}] of scope.declarations) {
620
+
621
+ for (const [, {identifier}] of [...scope.declarations].sort(([, a], [, b]) =>
622
+ compareScopeDeclaration(a, b),
623
+ )) {
624
const index = cx.nextCacheIndex;
625
if (firstOutputIndex === null) {
626
firstOutputIndex = index;
@@ -2566,3 +2571,45 @@ function convertIdentifier(identifier: Identifier): t.Identifier {
2571
);
2572
return t.identifier(identifier.name.value);
2573
}
2574
+
2575
+function compareScopeDependency(
2576
+ a: ReactiveScopeDependency,
2577
+ b: ReactiveScopeDependency,
2578
+): number {
2579
+ CompilerError.invariant(
2580
+ a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named',
2581
+ {
2582
+ reason: '[Codegen] Expected named identifier for dependency',
2583
+ loc: a.identifier.loc,
2584
+ },
2585
+ );
2586
+ const aName = [
2587
+ a.identifier.name.value,
2588
+ ...a.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`),
2589
+ ].join('.');
2590
+ const bName = [
2591
+ b.identifier.name.value,
2592
+ ...b.path.map(entry => `${entry.optional ? '?' : ''}${entry.property}`),
2593
+ ].join('.');
2594
+ if (aName < bName) return -1;
2595
+ else if (aName > bName) return 1;
2596
+ else return 0;
2597
+}
2598
+
2599
+function compareScopeDeclaration(
2600
+ a: ReactiveScopeDeclaration,
2601
+ b: ReactiveScopeDeclaration,
2602
+): number {
2603
+ CompilerError.invariant(
2604
+ a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named',
2605
+ {
2606
+ reason: '[Codegen] Expected named identifier for declaration',
2607
+ loc: a.identifier.loc,
2608
+ },
2609
+ );
2610
+ const aName = a.identifier.name.value;
2611
+ const bName = b.identifier.name.value;
2612
+ if (aName < bName) return -1;
2613
+ else if (aName > bName) return 1;
2614
+ else return 0;
2615
+}
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md
+3
-3
@@ -47,7 +47,7 @@ import { identity, mutate, setProperty } from "shared-runtime";
47
function AllocatingPrimitiveAsDepNested(props) {
48
const $ = _c(5);
49
let t0;
50
- if ($[0] !== props.b || $[1] !== props.a) {
50
+ if ($[0] !== props.a || $[1] !== props.b) {
51
const x = {};
52
mutate(x);
53
const t1 = identity(props.b) + 1;
@@ -62,8 +62,8 @@ function AllocatingPrimitiveAsDepNested(props) {
62
const y = t2;
63
setProperty(x, props.a);
64
t0 = [x, y];
65
- $[0] = props.b;
66
- $[1] = props.a;
65
+ $[0] = props.a;
66
+ $[1] = props.b;
67
$[2] = t0;
68
} else {
69
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-effect.expect.md
+3
-3
@@ -41,7 +41,7 @@ function ArrayAtTest(props) {
41
}
42
const arr = t1;
43
let t2;
44
- if ($[4] !== props.y || $[5] !== arr) {
44
+ if ($[4] !== arr || $[5] !== props.y) {
45
let t3;
46
if ($[7] !== props.y) {
47
t3 = bar(props.y);
@@ -51,8 +51,8 @@ function ArrayAtTest(props) {
51
t3 = $[8];
52
}
53
t2 = arr.at(t3);
54
- $[4] = props.y;
55
- $[5] = arr;
54
+ $[4] = arr;
55
+ $[5] = props.y;
56
$[6] = t2;
57
} else {
58
t2 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-expression-spread.expect.md
+3
-3
@@ -22,10 +22,10 @@ import { c as _c } from "react/compiler-runtime";
22
function Component(props) {
23
const $ = _c(3);
24
let t0;
25
- if ($[0] !== props.foo || $[1] !== props.bar) {
25
+ if ($[0] !== props.bar || $[1] !== props.foo) {
26
t0 = [0, ...props.foo, null, ...props.bar, "z"];
27
- $[0] = props.foo;
28
- $[1] = props.bar;
27
+ $[0] = props.bar;
28
+ $[1] = props.foo;
29
$[2] = t0;
30
} else {
31
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-property-call.expect.md
+5
-5
@@ -24,18 +24,18 @@ export const FIXTURE_ENTRYPOINT = {
24
import { c as _c } from "react/compiler-runtime";
25
function Component(props) {
26
const $ = _c(11);
27
- let t0;
27
let a;
28
+ let t0;
29
if ($[0] !== props.a || $[1] !== props.b) {
30
a = [props.a, props.b, "hello"];
31
t0 = a.push(42);
32
$[0] = props.a;
33
$[1] = props.b;
34
- $[2] = t0;
35
- $[3] = a;
34
+ $[2] = a;
35
+ $[3] = t0;
36
} else {
37
- t0 = $[2];
38
- a = $[3];
37
+ a = $[2];
38
+ t0 = $[3];
39
}
40
const x = t0;
41
let t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-invalid-phi-as-dependency.expect.md
+3
-3
@@ -70,10 +70,10 @@ function Component() {
70
throw new Error("invariant broken");
71
}
72
let t1;
73
- if ($[1] !== obj || $[2] !== boxedInner) {
73
+ if ($[1] !== boxedInner || $[2] !== obj) {
74
t1 = <Stringify obj={obj} inner={boxedInner} />;
75
- $[1] = obj;
76
- $[2] = boxedInner;
75
+ $[1] = boxedInner;
76
+ $[2] = obj;
77
$[3] = t1;
78
} else {
79
t1 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-object-expression-computed-key-modified-during-after-construction-hoisted-sequence-expr.expect.md
+5
-5
@@ -57,16 +57,16 @@ import { identity, mutate } from "shared-runtime";
57
*/
58
function Component(props) {
59
const $ = _c(8);
60
- let t0;
60
let key;
61
+ let t0;
62
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
63
key = {};
64
t0 = (mutate(key), key);
65
- $[0] = t0;
66
- $[1] = key;
65
+ $[0] = key;
66
+ $[1] = t0;
67
} else {
68
- t0 = $[0];
69
- key = $[1];
68
+ key = $[0];
69
+ t0 = $[1];
70
}
71
const tmp = t0;
72
let t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2-iife.expect.md
+3
-3
@@ -32,7 +32,7 @@ import { mutate } from "shared-runtime";
32
function component(foo, bar) {
33
const $ = _c(3);
34
let x;
35
- if ($[0] !== foo || $[1] !== bar) {
35
+ if ($[0] !== bar || $[1] !== foo) {
36
x = { foo };
37
const y = { bar };
38
@@ -41,8 +41,8 @@ function component(foo, bar) {
41
a.x = b;
42
43
mutate(y);
44
- $[0] = foo;
45
- $[1] = bar;
44
+ $[0] = bar;
45
+ $[1] = foo;
46
$[2] = x;
47
} else {
48
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md
+3
-3
@@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime";
24
function component(foo, bar) {
25
const $ = _c(3);
26
let x;
27
- if ($[0] !== foo || $[1] !== bar) {
27
+ if ($[0] !== bar || $[1] !== foo) {
28
x = { foo };
29
const y = { bar };
30
const f0 = function () {
@@ -35,8 +35,8 @@ function component(foo, bar) {
35
36
f0();
37
mutate(y);
38
- $[0] = foo;
39
- $[1] = bar;
38
+ $[0] = bar;
39
+ $[1] = foo;
40
$[2] = x;
41
} else {
42
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2-iife.expect.md
+3
-3
@@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime");
32
function component(foo, bar) {
33
const $ = _c(3);
34
let x;
35
- if ($[0] !== foo || $[1] !== bar) {
35
+ if ($[0] !== bar || $[1] !== foo) {
36
x = { foo };
37
const y = { bar };
38
@@ -41,8 +41,8 @@ function component(foo, bar) {
41
a.x = b;
42
43
mutate(y);
44
- $[0] = foo;
45
- $[1] = bar;
44
+ $[0] = bar;
45
+ $[1] = foo;
46
$[2] = x;
47
} else {
48
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md
+3
-3
@@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime";
24
function component(foo, bar) {
25
const $ = _c(3);
26
let x;
27
- if ($[0] !== foo || $[1] !== bar) {
27
+ if ($[0] !== bar || $[1] !== foo) {
28
x = { foo };
29
const y = { bar };
30
const f0 = function () {
@@ -35,8 +35,8 @@ function component(foo, bar) {
35
36
f0();
37
mutate(y);
38
- $[0] = foo;
39
- $[1] = bar;
38
+ $[0] = bar;
39
+ $[1] = foo;
40
$[2] = x;
41
} else {
42
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr-iife.expect.md
+3
-3
@@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime");
32
function component(foo, bar) {
33
const $ = _c(3);
34
let y;
35
- if ($[0] !== foo || $[1] !== bar) {
35
+ if ($[0] !== bar || $[1] !== foo) {
36
const x = { foo };
37
y = { bar };
38
@@ -41,8 +41,8 @@ function component(foo, bar) {
41
a.x = b;
42
43
mutate(y);
44
- $[0] = foo;
45
- $[1] = bar;
44
+ $[0] = bar;
45
+ $[1] = foo;
46
$[2] = y;
47
} else {
48
y = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md
+3
-3
@@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime";
24
function component(foo, bar) {
25
const $ = _c(3);
26
let y;
27
- if ($[0] !== foo || $[1] !== bar) {
27
+ if ($[0] !== bar || $[1] !== foo) {
28
const x = { foo };
29
y = { bar };
30
const f0 = function () {
@@ -35,8 +35,8 @@ function component(foo, bar) {
35
36
f0();
37
mutate(y);
38
- $[0] = foo;
39
- $[1] = bar;
38
+ $[0] = bar;
39
+ $[1] = foo;
40
$[2] = y;
41
} else {
42
y = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-iife.expect.md
+3
-3
@@ -32,7 +32,7 @@ const { mutate } = require("shared-runtime");
32
function component(foo, bar) {
33
const $ = _c(3);
34
let y;
35
- if ($[0] !== foo || $[1] !== bar) {
35
+ if ($[0] !== bar || $[1] !== foo) {
36
const x = { foo };
37
y = { bar };
38
@@ -41,8 +41,8 @@ function component(foo, bar) {
41
a.x = b;
42
43
mutate(y);
44
- $[0] = foo;
45
- $[1] = bar;
44
+ $[0] = bar;
45
+ $[1] = foo;
46
$[2] = y;
47
} else {
48
y = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md
+3
-3
@@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime";
24
function component(foo, bar) {
25
const $ = _c(3);
26
let y;
27
- if ($[0] !== foo || $[1] !== bar) {
27
+ if ($[0] !== bar || $[1] !== foo) {
28
const x = { foo };
29
y = { bar };
30
const f0 = function () {
@@ -35,8 +35,8 @@ function component(foo, bar) {
35
36
f0();
37
mutate(y);
38
- $[0] = foo;
39
- $[1] = bar;
38
+ $[0] = bar;
39
+ $[1] = foo;
40
$[2] = y;
41
} else {
42
y = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md
+3
-3
@@ -46,10 +46,10 @@ function component(t0) {
46
}
47
const hide = t2;
48
let t3;
49
- if ($[4] !== poke || $[5] !== hide) {
49
+ if ($[4] !== hide || $[5] !== poke) {
50
t3 = <Foo poke={poke} hide={hide} />;
51
- $[4] = poke;
52
- $[5] = hide;
51
+ $[4] = hide;
52
+ $[5] = poke;
53
$[6] = t3;
54
} else {
55
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.expect.md
+6
-6
@@ -46,7 +46,7 @@ function Component(props) {
46
const items = props.items;
47
const maxItems = props.maxItems;
48
let renderedItems;
49
- if ($[0] !== maxItems || $[1] !== items) {
49
+ if ($[0] !== items || $[1] !== maxItems) {
50
renderedItems = [];
51
const seen = new Set();
52
const max = Math.max(0, maxItems);
@@ -62,8 +62,8 @@ function Component(props) {
62
break;
63
}
64
}
65
- $[0] = maxItems;
66
- $[1] = items;
65
+ $[0] = items;
66
+ $[1] = maxItems;
67
$[2] = renderedItems;
68
} else {
69
renderedItems = $[2];
@@ -79,15 +79,15 @@ function Component(props) {
79
t0 = $[4];
80
}
81
let t1;
82
- if ($[5] !== t0 || $[6] !== renderedItems) {
82
+ if ($[5] !== renderedItems || $[6] !== t0) {
83
t1 = (
84
<div>
85
{t0}
86
{renderedItems}
87
</div>
88
);
89
- $[5] = t0;
90
- $[6] = renderedItems;
89
+ $[5] = renderedItems;
90
+ $[6] = t0;
91
$[7] = t1;
92
} else {
93
t1 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/computed-call-spread.expect.md
+4
-4
@@ -16,11 +16,11 @@ import { c as _c } from "react/compiler-runtime";
16
function Component(props) {
17
const $ = _c(4);
18
let t0;
19
- if ($[0] !== props.method || $[1] !== props.a || $[2] !== props.b) {
19
+ if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.method) {
20
t0 = foo[props.method](...props.a, null, ...props.b);
21
- $[0] = props.method;
22
- $[1] = props.a;
23
- $[2] = props.b;
21
+ $[0] = props.a;
22
+ $[1] = props.b;
23
+ $[2] = props.method;
24
$[3] = t0;
25
} else {
26
t0 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md
+3
-3
@@ -41,7 +41,7 @@ function foo(a, b) {
41
x = $[1];
42
}
43
let y;
44
- if ($[2] !== x || $[3] !== b) {
44
+ if ($[2] !== b || $[3] !== x) {
45
y = [];
46
if (x.length) {
47
y.push(x);
@@ -49,8 +49,8 @@ function foo(a, b) {
49
if (b) {
50
y.push(b);
51
}
52
- $[2] = x;
53
- $[3] = b;
52
+ $[2] = b;
53
+ $[3] = x;
54
$[4] = y;
55
} else {
56
y = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructure-in-branch-ssa.expect.md
+4
-4
@@ -61,11 +61,11 @@ function useFoo(props) {
61
z = $[4];
62
}
63
let t0;
64
- if ($[5] !== x || $[6] !== y || $[7] !== myList) {
64
+ if ($[5] !== myList || $[6] !== x || $[7] !== y) {
65
t0 = { x, y, myList };
66
- $[5] = x;
67
- $[6] = y;
68
- $[7] = myList;
66
+ $[5] = myList;
67
+ $[6] = x;
68
+ $[7] = y;
69
$[8] = t0;
70
} else {
71
t0 = $[8];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-same-property-identifier-names.expect.md
+3
-3
@@ -41,10 +41,10 @@ function Component(props) {
41
}
42
const sameName = t1;
43
let t2;
44
- if ($[2] !== sameName || $[3] !== renamed) {
44
+ if ($[2] !== renamed || $[3] !== sameName) {
45
t2 = [sameName, renamed];
46
- $[2] = sameName;
47
- $[3] = renamed;
46
+ $[2] = renamed;
47
+ $[3] = sameName;
48
$[4] = t2;
49
} else {
50
t2 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring.expect.md
+17
-17
@@ -36,45 +36,45 @@ export const FIXTURE_ENTRYPOINT = {
36
import { c as _c } from "react/compiler-runtime";
37
function foo(a, b, c) {
38
const $ = _c(18);
39
- let t0;
39
let d;
40
let h;
41
+ let t0;
42
if ($[0] !== a) {
43
[d, t0, ...h] = a;
44
$[0] = a;
45
- $[1] = t0;
46
- $[2] = d;
47
- $[3] = h;
45
+ $[1] = d;
46
+ $[2] = h;
47
+ $[3] = t0;
48
} else {
49
- t0 = $[1];
50
- d = $[2];
51
- h = $[3];
49
+ d = $[1];
50
+ h = $[2];
51
+ t0 = $[3];
52
}
53
const [t1] = t0;
54
- let t2;
54
let g;
55
+ let t2;
56
if ($[4] !== t1) {
57
({ e: t2, ...g } = t1);
58
$[4] = t1;
59
- $[5] = t2;
60
- $[6] = g;
59
+ $[5] = g;
60
+ $[6] = t2;
61
} else {
62
- t2 = $[5];
63
- g = $[6];
62
+ g = $[5];
63
+ t2 = $[6];
64
}
65
const { f } = t2;
66
const { l: t3, p } = b;
67
const { m: t4 } = t3;
68
- let t5;
68
let o;
69
+ let t5;
70
if ($[7] !== t4) {
71
[t5, ...o] = t4;
72
$[7] = t4;
73
- $[8] = t5;
74
- $[9] = o;
73
+ $[8] = o;
74
+ $[9] = t5;
75
} else {
76
- t5 = $[8];
77
- o = $[9];
76
+ o = $[8];
77
+ t5 = $[9];
78
}
79
const [n] = t5;
80
let t6;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md
+5
-5
@@ -53,8 +53,8 @@ import { ValidateMemoization } from "shared-runtime";
53
function Component(t0) {
54
const $ = _c(25);
55
const { a, b, c } = t0;
56
- let y;
56
let x;
57
+ let y;
58
if ($[0] !== a || $[1] !== b || $[2] !== c) {
59
x = [];
60
if (a) {
@@ -73,11 +73,11 @@ function Component(t0) {
73
$[0] = a;
74
$[1] = b;
75
$[2] = c;
76
- $[3] = y;
77
- $[4] = x;
76
+ $[3] = x;
77
+ $[4] = y;
78
} else {
79
- y = $[3];
80
- x = $[4];
79
+ x = $[3];
80
+ y = $[4];
81
}
82
let t1;
83
if ($[7] !== y) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/existing-variables-with-c-name.expect.md
+3
-3
@@ -61,10 +61,10 @@ function Component(props) {
61
t2 = $[3];
62
}
63
let t3;
64
- if ($[4] !== t2 || $[5] !== array) {
64
+ if ($[4] !== array || $[5] !== t2) {
65
t3 = <ValidateMemoization inputs={t2} output={array} />;
66
- $[4] = t2;
67
- $[5] = array;
66
+ $[4] = array;
67
+ $[5] = t2;
68
$[6] = t3;
69
} else {
70
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fast-refresh-reloading.expect.md
+3
-3
@@ -59,10 +59,10 @@ function Component(props) {
59
t3 = $[4];
60
}
61
let t4;
62
- if ($[5] !== t3 || $[6] !== doubled) {
62
+ if ($[5] !== doubled || $[6] !== t3) {
63
t4 = <ValidateMemoization inputs={t3} output={doubled} />;
64
- $[5] = t3;
65
- $[6] = doubled;
64
+ $[5] = doubled;
65
+ $[6] = t3;
66
$[7] = t4;
67
} else {
68
t4 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-repro-invalid-mutable-range-destructured-prop.expect.md
+3
-3
@@ -61,10 +61,10 @@ function Component(t0) {
61
t3 = $[3];
62
}
63
let t4;
64
- if ($[4] !== t3 || $[5] !== el) {
64
+ if ($[4] !== el || $[5] !== t3) {
65
t4 = <ValidateMemoization inputs={t3} output={el} />;
66
- $[4] = t3;
67
- $[5] = el;
66
+ $[4] = el;
67
+ $[5] = t3;
68
$[6] = t4;
69
} else {
70
t4 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbtparam-with-jsx-element-content.expect.md
+3
-3
@@ -32,7 +32,7 @@ function Component(t0) {
32
const $ = _c(4);
33
const { name, data, icon } = t0;
34
let t1;
35
- if ($[0] !== name || $[1] !== icon || $[2] !== data) {
35
+ if ($[0] !== data || $[1] !== icon || $[2] !== name) {
36
t1 = (
37
<Text type="body4">
38
{fbt._(
@@ -61,9 +61,9 @@ function Component(t0) {
61
)}
62
</Text>
63
);
64
- $[0] = name;
64
+ $[0] = data;
65
$[1] = icon;
66
- $[2] = data;
66
+ $[2] = name;
67
$[3] = t1;
68
} else {
69
t1 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-loop-with-value-block-initializer.expect.md
+3
-3
@@ -67,7 +67,7 @@ const TOTAL = 10;
67
function Component(props) {
68
const $ = _c(3);
69
let t0;
70
- if ($[0] !== props.start || $[1] !== props.items) {
70
+ if ($[0] !== props.items || $[1] !== props.start) {
71
const items = [];
72
for (let i = props.start ?? 0; i < props.items.length; i++) {
73
const item = props.items[i];
@@ -75,8 +75,8 @@ function Component(props) {
75
}
76
77
t0 = <div>{items}</div>;
78
- $[0] = props.start;
79
- $[1] = props.items;
78
+ $[0] = props.items;
79
+ $[1] = props.start;
80
$[2] = t0;
81
} else {
82
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-nonmutating-loop-local-collection.expect.md
+3
-3
@@ -91,10 +91,10 @@ function Component(t0) {
91
t5 = $[9];
92
}
93
let t6;
94
- if ($[10] !== x || $[11] !== b) {
94
+ if ($[10] !== b || $[11] !== x) {
95
t6 = [x, b];
96
- $[10] = x;
97
- $[11] = b;
96
+ $[10] = b;
97
+ $[11] = x;
98
$[12] = t6;
99
} else {
100
t6 = $[12];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call-mutating.expect.md
+3
-3
@@ -59,10 +59,10 @@ function Component(props) {
59
t1 = $[3];
60
}
61
let t2;
62
- if ($[4] !== t1 || $[5] !== a_0) {
62
+ if ($[4] !== a_0 || $[5] !== t1) {
63
t2 = <ValidateMemoization inputs={t1} output={a_0} />;
64
- $[4] = t1;
65
- $[5] = a_0;
64
+ $[4] = a_0;
65
+ $[5] = t1;
66
$[6] = t2;
67
} else {
68
t2 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr-conditional-access-2.expect.md
+3
-3
@@ -36,10 +36,10 @@ function Component(t0) {
36
}
37
const f = t1;
38
let t2;
39
- if ($[2] !== props || $[3] !== f) {
39
+ if ($[2] !== f || $[3] !== props) {
40
t2 = props == null ? _temp : f;
41
- $[2] = props;
42
- $[3] = f;
41
+ $[2] = f;
42
+ $[3] = props;
43
$[4] = t2;
44
} else {
45
t2 = $[4];
"b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/functionexpr\342\200\223conditional-access.expect.md"
renamed
+3
-3
@@ -36,10 +36,10 @@ function Component(props) {
36
}
37
const getLength = t0;
38
let t1;
39
- if ($[2] !== props.bar || $[3] !== getLength) {
39
+ if ($[2] !== getLength || $[3] !== props.bar) {
40
t1 = props.bar && getLength();
41
- $[2] = props.bar;
42
- $[3] = getLength;
41
+ $[2] = getLength;
42
+ $[3] = props.bar;
43
$[4] = t1;
44
} else {
45
t1 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/globals-dont-resolve-local-useState.expect.md
+3
-3
@@ -56,10 +56,10 @@ function Component() {
56
t0 = $[1];
57
}
58
let t1;
59
- if ($[2] !== t0 || $[3] !== state) {
59
+ if ($[2] !== state || $[3] !== t0) {
60
t1 = <div onClick={t0}>{state}</div>;
61
- $[2] = t0;
62
- $[3] = state;
61
+ $[2] = state;
62
+ $[3] = t0;
63
$[4] = t1;
64
} else {
65
t1 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-noAlias.expect.md
+3
-3
@@ -41,10 +41,10 @@ function Component(props) {
41
console.log(props);
42
}, [props.a]);
43
let t1;
44
- if ($[2] !== x || $[3] !== item) {
44
+ if ($[2] !== item || $[3] !== x) {
45
t1 = [x, item];
46
- $[2] = x;
47
- $[3] = item;
46
+ $[2] = item;
47
+ $[3] = x;
48
$[4] = t1;
49
} else {
50
t1 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md
+3
-3
@@ -73,15 +73,15 @@ function Component() {
73
t1 = $[4];
74
}
75
let t3;
76
- if ($[5] !== t2 || $[6] !== json) {
76
+ if ($[5] !== json || $[6] !== t2) {
77
t3 = (
78
<div>
79
{t2}
80
{json}
81
</div>
82
);
83
- $[5] = t2;
84
- $[6] = json;
83
+ $[5] = json;
84
+ $[6] = t2;
85
$[7] = t3;
86
} else {
87
t3 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md
+7
-7
@@ -29,22 +29,22 @@ import { Stringify } from "shared-runtime";
29
30
function Component(t0) {
31
const $ = _c(4);
32
- let t1;
32
let a;
33
let b;
34
+ let t1;
35
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
36
a = "a";
37
38
const [t2, t3] = [null, null];
39
t1 = t3;
40
a = t2;
41
- $[0] = t1;
42
- $[1] = a;
43
- $[2] = b;
41
+ $[0] = a;
42
+ $[1] = b;
43
+ $[2] = t1;
44
} else {
45
- t1 = $[0];
46
- a = $[1];
47
- b = $[2];
45
+ a = $[0];
46
+ b = $[1];
47
+ t1 = $[2];
48
}
49
b = t1;
50
let t2;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md
+10
-10
@@ -27,10 +27,10 @@ function Component(props) {
27
const $ = _c(15);
28
const item = useFragment(FRAGMENT, props.item);
29
useFreeze(item);
30
- let t0;
30
let T0;
32
- let t1;
31
let T1;
32
+ let t0;
33
+ let t1;
34
if ($[0] !== item) {
35
const count = new MaybeMutable(item);
36
@@ -44,15 +44,15 @@ function Component(props) {
44
}
45
t0 = maybeMutate(count);
46
$[0] = item;
47
- $[1] = t0;
48
- $[2] = T0;
49
- $[3] = t1;
50
- $[4] = T1;
47
+ $[1] = T0;
48
+ $[2] = T1;
49
+ $[3] = t0;
50
+ $[4] = t1;
51
} else {
52
- t0 = $[1];
53
- T0 = $[2];
54
- t1 = $[3];
55
- T1 = $[4];
52
+ T0 = $[1];
53
+ T1 = $[2];
54
+ t0 = $[3];
55
+ t1 = $[4];
56
}
57
let t2;
58
if ($[6] !== t0) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-child-stored-in-id.expect.md
+6
-6
@@ -83,10 +83,10 @@ function _temp(t0) {
83
t1 = $[1];
84
}
85
let t2;
86
- if ($[2] !== x || $[3] !== t1) {
86
+ if ($[2] !== t1 || $[3] !== x) {
87
t2 = <Bar x={x}>{t1}</Bar>;
88
- $[2] = x;
89
- $[3] = t1;
88
+ $[2] = t1;
89
+ $[3] = x;
90
$[4] = t2;
91
} else {
92
t2 = $[4];
@@ -98,15 +98,15 @@ function Bar(t0) {
98
const $ = _c(3);
99
const { x, children } = t0;
100
let t1;
101
- if ($[0] !== x || $[1] !== children) {
101
+ if ($[0] !== children || $[1] !== x) {
102
t1 = (
103
<>
104
{x}
105
{children}
106
</>
107
);
108
- $[0] = x;
109
- $[1] = children;
108
+ $[0] = children;
109
+ $[1] = x;
110
$[2] = t1;
111
} else {
112
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-jsx-stored-in-id.expect.md
+9
-9
@@ -52,7 +52,7 @@ function Component(t0) {
52
const { arr } = t0;
53
const x = useX();
54
let t1;
55
- if ($[0] !== x || $[1] !== arr) {
55
+ if ($[0] !== arr || $[1] !== x) {
56
let t2;
57
if ($[3] !== x) {
58
t2 = (i, id) => {
@@ -66,8 +66,8 @@ function Component(t0) {
66
t2 = $[4];
67
}
68
t1 = arr.map(t2);
69
- $[0] = x;
70
- $[1] = arr;
69
+ $[0] = arr;
70
+ $[1] = x;
71
$[2] = t1;
72
} else {
73
t1 = $[2];
@@ -94,10 +94,10 @@ function _temp(t0) {
94
t1 = $[1];
95
}
96
let t2;
97
- if ($[2] !== x || $[3] !== t1) {
97
+ if ($[2] !== t1 || $[3] !== x) {
98
t2 = <Bar x={x}>{t1}</Bar>;
99
- $[2] = x;
100
- $[3] = t1;
99
+ $[2] = t1;
100
+ $[3] = x;
101
$[4] = t2;
102
} else {
103
t2 = $[4];
@@ -109,15 +109,15 @@ function Bar(t0) {
109
const $ = _c(3);
110
const { x, children } = t0;
111
let t1;
112
- if ($[0] !== x || $[1] !== children) {
112
+ if ($[0] !== children || $[1] !== x) {
113
t1 = (
114
<>
115
{x}
116
{children}
117
</>
118
);
119
- $[0] = x;
120
- $[1] = children;
119
+ $[0] = children;
120
+ $[1] = x;
121
$[2] = t1;
122
} else {
123
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-separate-nested.expect.md
+11
-11
@@ -60,7 +60,7 @@ function Component(t0) {
60
const { arr } = t0;
61
const x = useX();
62
let t1;
63
- if ($[0] !== x || $[1] !== arr) {
63
+ if ($[0] !== arr || $[1] !== x) {
64
let t2;
65
if ($[3] !== x) {
66
t2 = (i, id) => {
@@ -73,8 +73,8 @@ function Component(t0) {
73
t2 = $[4];
74
}
75
t1 = arr.map(t2);
76
- $[0] = x;
77
- $[1] = arr;
76
+ $[0] = arr;
77
+ $[1] = x;
78
$[2] = t1;
79
} else {
80
t1 = $[2];
@@ -117,7 +117,7 @@ function _temp(t0) {
117
t3 = $[5];
118
}
119
let t4;
120
- if ($[6] !== x || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
120
+ if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3 || $[9] !== x) {
121
t4 = (
122
<Bar x={x}>
123
{t1}
@@ -125,10 +125,10 @@ function _temp(t0) {
125
{t3}
126
</Bar>
127
);
128
- $[6] = x;
129
- $[7] = t1;
130
- $[8] = t2;
131
- $[9] = t3;
128
+ $[6] = t1;
129
+ $[7] = t2;
130
+ $[8] = t3;
131
+ $[9] = x;
132
$[10] = t4;
133
} else {
134
t4 = $[10];
@@ -140,15 +140,15 @@ function Bar(t0) {
140
const $ = _c(3);
141
const { x, children } = t0;
142
let t1;
143
- if ($[0] !== x || $[1] !== children) {
143
+ if ($[0] !== children || $[1] !== x) {
144
t1 = (
145
<>
146
{x}
147
{children}
148
</>
149
);
150
- $[0] = x;
151
- $[1] = children;
150
+ $[0] = children;
151
+ $[1] = x;
152
$[2] = t1;
153
} else {
154
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-outlining-simple.expect.md
+9
-9
@@ -50,7 +50,7 @@ function Component(t0) {
50
const { arr } = t0;
51
const x = useX();
52
let t1;
53
- if ($[0] !== x || $[1] !== arr) {
53
+ if ($[0] !== arr || $[1] !== x) {
54
let t2;
55
if ($[3] !== x) {
56
t2 = (i, id) => {
@@ -63,8 +63,8 @@ function Component(t0) {
63
t2 = $[4];
64
}
65
t1 = arr.map(t2);
66
- $[0] = x;
67
- $[1] = arr;
66
+ $[0] = arr;
67
+ $[1] = x;
68
$[2] = t1;
69
} else {
70
t1 = $[2];
@@ -91,10 +91,10 @@ function _temp(t0) {
91
t1 = $[1];
92
}
93
let t2;
94
- if ($[2] !== x || $[3] !== t1) {
94
+ if ($[2] !== t1 || $[3] !== x) {
95
t2 = <Bar x={x}>{t1}</Bar>;
96
- $[2] = x;
97
- $[3] = t1;
96
+ $[2] = t1;
97
+ $[3] = x;
98
$[4] = t2;
99
} else {
100
t2 = $[4];
@@ -106,15 +106,15 @@ function Bar(t0) {
106
const $ = _c(3);
107
const { x, children } = t0;
108
let t1;
109
- if ($[0] !== x || $[1] !== children) {
109
+ if ($[0] !== children || $[1] !== x) {
110
t1 = (
111
<>
112
{x}
113
{children}
114
</>
115
);
116
- $[0] = x;
117
- $[1] = children;
116
+ $[0] = children;
117
+ $[1] = x;
118
$[2] = t1;
119
} else {
120
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md
+8
-8
@@ -53,23 +53,23 @@ function maybeMutate(x) {}
53
54
function Component(props) {
55
const $ = _c(11);
56
- let Tag;
56
let T0;
57
+ let Tag;
58
let t0;
59
- if ($[0] !== props.component || $[1] !== props.alternateComponent) {
59
+ if ($[0] !== props.alternateComponent || $[1] !== props.component) {
60
const maybeMutable = new MaybeMutable();
61
Tag = props.component;
62
63
T0 = Tag;
64
t0 = ((Tag = props.alternateComponent), maybeMutate(maybeMutable));
65
- $[0] = props.component;
66
- $[1] = props.alternateComponent;
67
- $[2] = Tag;
68
- $[3] = T0;
65
+ $[0] = props.alternateComponent;
66
+ $[1] = props.component;
67
+ $[2] = T0;
68
+ $[3] = Tag;
69
$[4] = t0;
70
} else {
71
- Tag = $[2];
72
- T0 = $[3];
71
+ T0 = $[2];
72
+ Tag = $[3];
73
t0 = $[4];
74
}
75
let t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md
+3
-3
@@ -44,7 +44,7 @@ function CaptureNotMutate(props) {
44
}
45
const idx = t0;
46
let aliasedElement;
47
- if ($[2] !== props.el || $[3] !== idx) {
47
+ if ($[2] !== idx || $[3] !== props.el) {
48
const element = bar(props.el);
49
50
const fn = function () {
@@ -54,8 +54,8 @@ function CaptureNotMutate(props) {
54
55
aliasedElement = fn();
56
mutate(aliasedElement);
57
- $[2] = props.el;
58
- $[3] = idx;
57
+ $[2] = idx;
58
+ $[3] = props.el;
59
$[4] = aliasedElement;
60
} else {
61
aliasedElement = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-acess-multiple.expect.md
+3
-3
@@ -21,10 +21,10 @@ function App() {
21
const { foo } = useContext_withSelector(MyContext, _temp);
22
const { bar } = useContext_withSelector(MyContext, _temp2);
23
let t0;
24
- if ($[0] !== foo || $[1] !== bar) {
24
+ if ($[0] !== bar || $[1] !== foo) {
25
t0 = <Bar foo={foo} bar={bar} />;
26
- $[0] = foo;
27
- $[1] = bar;
26
+ $[0] = bar;
27
+ $[1] = foo;
28
$[2] = t0;
29
} else {
30
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lower-context-selector-simple.expect.md
+3
-3
@@ -19,10 +19,10 @@ function App() {
19
const $ = _c(3);
20
const { foo, bar } = useContext_withSelector(MyContext, _temp);
21
let t0;
22
- if ($[0] !== foo || $[1] !== bar) {
22
+ if ($[0] !== bar || $[1] !== foo) {
23
t0 = <Bar foo={foo} bar={bar} />;
24
- $[0] = foo;
25
- $[1] = bar;
24
+ $[0] = bar;
25
+ $[1] = foo;
26
$[2] = t0;
27
} else {
28
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-reordering.expect.md
+3
-3
@@ -60,7 +60,7 @@ function Component() {
60
t2 = $[3];
61
}
62
let t3;
63
- if ($[4] !== t1 || $[5] !== t0) {
63
+ if ($[4] !== t0 || $[5] !== t1) {
64
t3 = (
65
<div>
66
{t2}
@@ -68,8 +68,8 @@ function Component() {
68
{t0}
69
</div>
70
);
71
- $[4] = t1;
72
- $[5] = t0;
71
+ $[4] = t0;
72
+ $[5] = t1;
73
$[6] = t3;
74
} else {
75
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-computed.expect.md
+4
-4
@@ -43,11 +43,11 @@ function foo(a, b, c) {
43
}
44
const y = t1;
45
let t2;
46
- if ($[4] !== x || $[5] !== y.method || $[6] !== b) {
46
+ if ($[4] !== b || $[5] !== x || $[6] !== y.method) {
47
t2 = x[y.method](b);
48
- $[4] = x;
49
- $[5] = y.method;
50
- $[6] = b;
48
+ $[4] = b;
49
+ $[5] = x;
50
+ $[6] = y.method;
51
$[7] = t2;
52
} else {
53
t2 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md
+4
-4
@@ -33,11 +33,11 @@ function foo(a, b, c) {
33
34
const method = x.method;
35
let t1;
36
- if ($[2] !== method || $[3] !== x || $[4] !== b) {
36
+ if ($[2] !== b || $[3] !== method || $[4] !== x) {
37
t1 = method.call(x, b);
38
- $[2] = method;
39
- $[3] = x;
40
- $[4] = b;
38
+ $[2] = b;
39
+ $[3] = method;
40
+ $[4] = x;
41
$[5] = t1;
42
} else {
43
t1 = $[5];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/method-call.expect.md
+3
-3
@@ -40,10 +40,10 @@ function foo(a, b, c) {
40
}
41
const x = t0;
42
let t1;
43
- if ($[2] !== x || $[3] !== b) {
43
+ if ($[2] !== b || $[3] !== x) {
44
t1 = x.foo(b);
45
- $[2] = x;
46
- $[3] = b;
45
+ $[2] = b;
46
+ $[3] = x;
47
$[4] = t1;
48
} else {
49
t1 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nonmutating-capture-in-unsplittable-memo-block.expect.md
+5
-5
@@ -73,8 +73,8 @@ import { identity, mutate } from "shared-runtime";
73
function useFoo(t0) {
74
const $ = _c(4);
75
const { a, b } = t0;
76
- let z;
76
let y;
77
+ let z;
78
if ($[0] !== a || $[1] !== b) {
79
const x = { a };
80
y = {};
@@ -83,11 +83,11 @@ function useFoo(t0) {
83
mutate(y);
84
$[0] = a;
85
$[1] = b;
86
- $[2] = z;
87
- $[3] = y;
86
+ $[2] = y;
87
+ $[3] = z;
88
} else {
89
- z = $[2];
90
- y = $[3];
89
+ y = $[2];
90
+ z = $[3];
91
}
92
if (z[0] !== y) {
93
throw new Error("oh no!");
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-shorthand-method-nested.expect.md
+3
-3
@@ -40,7 +40,7 @@ function useHook(t0) {
40
const { value } = t0;
41
const [state] = useState(false);
42
let t1;
43
- if ($[0] !== value || $[1] !== state) {
43
+ if ($[0] !== state || $[1] !== value) {
44
t1 = {
45
getX() {
46
return {
@@ -52,8 +52,8 @@ function useHook(t0) {
52
};
53
},
54
};
55
- $[0] = value;
56
- $[1] = state;
55
+ $[0] = state;
56
+ $[1] = value;
57
$[2] = t1;
58
} else {
59
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.expect.md
+3
-3
@@ -63,10 +63,10 @@ function Component(t0) {
63
t4 = $[3];
64
}
65
let t5;
66
- if ($[4] !== t4 || $[5] !== data) {
66
+ if ($[4] !== data || $[5] !== t4) {
67
t5 = <ValidateMemoization inputs={t4} output={data} />;
68
- $[4] = t4;
69
- $[5] = data;
68
+ $[4] = data;
69
+ $[5] = t4;
70
$[6] = t5;
71
} else {
72
t5 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.expect.md
+3
-3
@@ -45,10 +45,10 @@ function Component(props) {
45
t1 = $[3];
46
}
47
let t2;
48
- if ($[4] !== t1 || $[5] !== data) {
48
+ if ($[4] !== data || $[5] !== t1) {
49
t2 = <ValidateMemoization inputs={t1} output={data} />;
50
- $[4] = t1;
51
- $[5] = data;
50
+ $[4] = data;
51
+ $[5] = t1;
52
$[6] = t2;
53
} else {
54
t2 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.expect.md
+3
-3
@@ -60,10 +60,10 @@ function Component(t0) {
60
t3 = $[3];
61
}
62
let t4;
63
- if ($[4] !== t3 || $[5] !== data) {
63
+ if ($[4] !== data || $[5] !== t3) {
64
t4 = <ValidateMemoization inputs={t3} output={data} />;
65
- $[4] = t3;
66
- $[5] = data;
65
+ $[4] = data;
66
+ $[5] = t3;
67
$[6] = t4;
68
} else {
69
t4 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.expect.md
+6
-6
@@ -48,19 +48,19 @@ function Component(props) {
48
49
const t1 = props?.items;
50
let t2;
51
- if ($[3] !== t1 || $[4] !== props.cond) {
51
+ if ($[3] !== props.cond || $[4] !== t1) {
52
t2 = [t1, props.cond];
53
- $[3] = t1;
54
- $[4] = props.cond;
53
+ $[3] = props.cond;
54
+ $[4] = t1;
55
$[5] = t2;
56
} else {
57
t2 = $[5];
58
}
59
let t3;
60
- if ($[6] !== t2 || $[7] !== data) {
60
+ if ($[6] !== data || $[7] !== t2) {
61
t3 = <ValidateMemoization inputs={t2} output={data} />;
62
- $[6] = t2;
63
- $[7] = data;
62
+ $[6] = data;
63
+ $[7] = t2;
64
$[8] = t3;
65
} else {
66
t3 = $[8];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.expect.md
+6
-6
@@ -48,19 +48,19 @@ function Component(props) {
48
49
const t1 = props?.items;
50
let t2;
51
- if ($[3] !== t1 || $[4] !== props.cond) {
51
+ if ($[3] !== props.cond || $[4] !== t1) {
52
t2 = [t1, props.cond];
53
- $[3] = t1;
54
- $[4] = props.cond;
53
+ $[3] = props.cond;
54
+ $[4] = t1;
55
$[5] = t2;
56
} else {
57
t2 = $[5];
58
}
59
let t3;
60
- if ($[6] !== t2 || $[7] !== data) {
60
+ if ($[6] !== data || $[7] !== t2) {
61
t3 = <ValidateMemoization inputs={t2} output={data} />;
62
- $[6] = t2;
63
- $[7] = data;
62
+ $[6] = data;
63
+ $[7] = t2;
64
$[8] = t3;
65
} else {
66
t3 = $[8];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/partial-early-return-within-reactive-scope.expect.md
+5
-5
@@ -31,8 +31,8 @@ export const FIXTURE_ENTRYPOINT = {
31
import { c as _c } from "react/compiler-runtime";
32
function Component(props) {
33
const $ = _c(4);
34
- let y;
34
let t0;
35
+ let y;
36
if ($[0] !== props) {
37
t0 = Symbol.for("react.early_return_sentinel");
38
bb0: {
@@ -57,11 +57,11 @@ function Component(props) {
57
}
58
}
59
$[0] = props;
60
- $[1] = y;
61
- $[2] = t0;
60
+ $[1] = t0;
61
+ $[2] = y;
62
} else {
63
- y = $[1];
64
- t0 = $[2];
63
+ t0 = $[1];
64
+ y = $[2];
65
}
66
if (t0 !== Symbol.for("react.early_return_sentinel")) {
67
return t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md
+4
-4
@@ -40,7 +40,7 @@ function useFoo(minWidth, otherProp) {
40
const $ = _c(7);
41
const [width] = useState(1);
42
let t0;
43
- if ($[0] !== width || $[1] !== minWidth || $[2] !== otherProp) {
43
+ if ($[0] !== minWidth || $[1] !== otherProp || $[2] !== width) {
44
const x = [];
45
let t1;
46
if ($[4] !== minWidth || $[5] !== width) {
@@ -55,9 +55,9 @@ function useFoo(minWidth, otherProp) {
55
56
arrayPush(x, otherProp);
57
t0 = [style, x];
58
- $[0] = width;
59
- $[1] = minWidth;
60
- $[2] = otherProp;
58
+ $[0] = minWidth;
59
+ $[1] = otherProp;
60
+ $[2] = width;
61
$[3] = t0;
62
} else {
63
t0 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md
+8
-8
@@ -42,9 +42,9 @@ import { Stringify } from "shared-runtime";
42
function Foo(t0) {
43
const $ = _c(8);
44
const { arr1, arr2, foo } = t0;
45
- let t1;
45
let getVal1;
47
- if ($[0] !== arr1 || $[1] !== foo || $[2] !== arr2) {
46
+ let t1;
47
+ if ($[0] !== arr1 || $[1] !== arr2 || $[2] !== foo) {
48
const x = [arr1];
49
50
let y;
@@ -55,13 +55,13 @@ function Foo(t0) {
55
t1 = () => [y];
56
foo ? (y = x.concat(arr2)) : y;
57
$[0] = arr1;
58
- $[1] = foo;
59
- $[2] = arr2;
60
- $[3] = t1;
61
- $[4] = getVal1;
58
+ $[1] = arr2;
59
+ $[2] = foo;
60
+ $[3] = getVal1;
61
+ $[4] = t1;
62
} else {
63
- t1 = $[3];
64
- getVal1 = $[4];
63
+ getVal1 = $[3];
64
+ t1 = $[4];
65
}
66
const getVal2 = t1;
67
let t2;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-alloc.expect.md
+3
-3
@@ -44,10 +44,10 @@ function Component(t0) {
44
t3 = $[1];
45
}
46
let t4;
47
- if ($[2] !== t3 || $[3] !== propA) {
47
+ if ($[2] !== propA || $[3] !== t3) {
48
t4 = { value: t3, other: propA };
49
- $[2] = t3;
50
- $[3] = propA;
49
+ $[2] = propA;
50
+ $[3] = t3;
51
$[4] = t4;
52
} else {
53
t4 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-conditional-access-noAlloc.expect.md
+3
-3
@@ -34,10 +34,10 @@ function Component(t0) {
34
35
const t2 = propB?.x.y;
36
let t3;
37
- if ($[0] !== t2 || $[1] !== propA) {
37
+ if ($[0] !== propA || $[1] !== t2) {
38
t3 = { value: t2, other: propA };
39
- $[0] = t2;
40
- $[1] = propA;
39
+ $[0] = propA;
40
+ $[1] = t2;
41
$[2] = t3;
42
} else {
43
t3 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md
+4
-4
@@ -40,7 +40,7 @@ function useFoo(minWidth, otherProp) {
40
const $ = _c(6);
41
const [width] = useState(1);
42
let t0;
43
- if ($[0] !== width || $[1] !== minWidth || $[2] !== otherProp) {
43
+ if ($[0] !== minWidth || $[1] !== otherProp || $[2] !== width) {
44
const x = [];
45
let t1;
46
@@ -58,9 +58,9 @@ function useFoo(minWidth, otherProp) {
58
59
arrayPush(x, otherProp);
60
t0 = [style, x];
61
- $[0] = width;
62
- $[1] = minWidth;
63
- $[2] = otherProp;
61
+ $[0] = minWidth;
62
+ $[1] = otherProp;
63
+ $[2] = width;
64
$[3] = t0;
65
} else {
66
t0 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md
+3
-3
@@ -44,7 +44,7 @@ function Foo(t0) {
44
const { arr1, arr2, foo } = t0;
45
let t1;
46
let val1;
47
- if ($[0] !== arr1 || $[1] !== foo || $[2] !== arr2) {
47
+ if ($[0] !== arr1 || $[1] !== arr2 || $[2] !== foo) {
48
const x = [arr1];
49
50
let y;
@@ -63,8 +63,8 @@ function Foo(t0) {
63
foo ? (y = x.concat(arr2)) : y;
64
t1 = (() => [y])();
65
$[0] = arr1;
66
- $[1] = foo;
67
- $[2] = arr2;
66
+ $[1] = arr2;
67
+ $[2] = foo;
68
$[3] = t1;
69
$[4] = val1;
70
} else {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md
+3
-3
@@ -49,7 +49,7 @@ import { identity, mutate, setProperty } from "shared-runtime";
49
function PrimitiveAsDepNested(props) {
50
const $ = _c(5);
51
let t0;
52
- if ($[0] !== props.b || $[1] !== props.a) {
52
+ if ($[0] !== props.a || $[1] !== props.b) {
53
const x = {};
54
mutate(x);
55
const t1 = props.b + 1;
@@ -64,8 +64,8 @@ function PrimitiveAsDepNested(props) {
64
const y = t2;
65
setProperty(x, props.a);
66
t0 = [x, y];
67
- $[0] = props.b;
68
- $[1] = props.a;
67
+ $[0] = props.a;
68
+ $[1] = props.b;
69
$[2] = t0;
70
} else {
71
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/primitive-reassigned-loop-force-scopes-enabled.expect.md
+4
-4
@@ -32,15 +32,15 @@ function Component(t0) {
32
const $ = _c(5);
33
const { base, start, increment, test } = t0;
34
let value;
35
- if ($[0] !== base || $[1] !== start || $[2] !== test || $[3] !== increment) {
35
+ if ($[0] !== base || $[1] !== increment || $[2] !== start || $[3] !== test) {
36
value = base;
37
for (let i = start; i < test; i = i + increment, i) {
38
value = value + i;
39
}
40
$[0] = base;
41
- $[1] = start;
42
- $[2] = test;
43
- $[3] = increment;
41
+ $[1] = increment;
42
+ $[2] = start;
43
+ $[3] = test;
44
$[4] = value;
45
} else {
46
value = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/early-return-nested-early-return-within-reactive-scope.expect.md
+4
-4
@@ -34,7 +34,7 @@ import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
34
function Component(props) {
35
const $ = _c(7);
36
let t0;
37
- if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
37
+ if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.cond) {
38
t0 = Symbol.for("react.early_return_sentinel");
39
bb0: {
40
const x = [];
@@ -69,9 +69,9 @@ function Component(props) {
69
break bb0;
70
}
71
}
72
- $[0] = props.cond;
73
- $[1] = props.a;
74
- $[2] = props.b;
72
+ $[0] = props.a;
73
+ $[1] = props.b;
74
+ $[2] = props.cond;
75
$[3] = t0;
76
} else {
77
t0 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/early-return-within-reactive-scope.expect.md
+4
-4
@@ -48,7 +48,7 @@ import { makeArray } from "shared-runtime";
48
function Component(props) {
49
const $ = _c(6);
50
let t0;
51
- if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
51
+ if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.cond) {
52
t0 = Symbol.for("react.early_return_sentinel");
53
bb0: {
54
const x = [];
@@ -69,9 +69,9 @@ function Component(props) {
69
break bb0;
70
}
71
}
72
- $[0] = props.cond;
73
- $[1] = props.a;
74
- $[2] = props.b;
72
+ $[0] = props.a;
73
+ $[1] = props.b;
74
+ $[2] = props.cond;
75
$[3] = t0;
76
} else {
77
t0 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/iife-return-modified-later-phi.expect.md
+3
-3
@@ -29,7 +29,7 @@ import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
29
function Component(props) {
30
const $ = _c(3);
31
let items;
32
- if ($[0] !== props.cond || $[1] !== props.a) {
32
+ if ($[0] !== props.a || $[1] !== props.cond) {
33
let t0;
34
if (props.cond) {
35
t0 = [];
@@ -39,8 +39,8 @@ function Component(props) {
39
items = t0;
40
41
items?.push(props.a);
42
- $[0] = props.cond;
43
- $[1] = props.a;
42
+ $[0] = props.a;
43
+ $[1] = props.cond;
44
$[2] = items;
45
} else {
46
items = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md
+3
-3
@@ -63,10 +63,10 @@ function Component(t0) {
63
t4 = $[3];
64
}
65
let t5;
66
- if ($[4] !== t4 || $[5] !== data) {
66
+ if ($[4] !== data || $[5] !== t4) {
67
t5 = <ValidateMemoization inputs={t4} output={data} />;
68
- $[4] = t4;
69
- $[5] = data;
68
+ $[4] = data;
69
+ $[5] = t4;
70
$[6] = t5;
71
} else {
72
t5 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md
+3
-3
@@ -45,10 +45,10 @@ function Component(props) {
45
t1 = $[3];
46
}
47
let t2;
48
- if ($[4] !== t1 || $[5] !== data) {
48
+ if ($[4] !== data || $[5] !== t1) {
49
t2 = <ValidateMemoization inputs={t1} output={data} />;
50
- $[4] = t1;
51
- $[5] = data;
50
+ $[4] = data;
51
+ $[5] = t1;
52
$[6] = t2;
53
} else {
54
t2 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-single.expect.md
+3
-3
@@ -60,10 +60,10 @@ function Component(t0) {
60
t3 = $[3];
61
}
62
let t4;
63
- if ($[4] !== t3 || $[5] !== data) {
63
+ if ($[4] !== data || $[5] !== t3) {
64
t4 = <ValidateMemoization inputs={t3} output={data} />;
65
- $[4] = t3;
66
- $[5] = data;
65
+ $[4] = data;
66
+ $[5] = t3;
67
$[6] = t4;
68
} else {
69
t4 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/partial-early-return-within-reactive-scope.expect.md
+9
-9
@@ -32,9 +32,9 @@ export const FIXTURE_ENTRYPOINT = {
32
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
33
function Component(props) {
34
const $ = _c(6);
35
- let y;
35
let t0;
37
- if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
36
+ let y;
37
+ if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.cond) {
38
t0 = Symbol.for("react.early_return_sentinel");
39
bb0: {
40
const x = [];
@@ -57,14 +57,14 @@ function Component(props) {
57
}
58
}
59
}
60
- $[0] = props.cond;
61
- $[1] = props.a;
62
- $[2] = props.b;
63
- $[3] = y;
64
- $[4] = t0;
60
+ $[0] = props.a;
61
+ $[1] = props.b;
62
+ $[2] = props.cond;
63
+ $[3] = t0;
64
+ $[4] = y;
65
} else {
66
- y = $[3];
67
- t0 = $[4];
66
+ t0 = $[3];
67
+ y = $[4];
68
}
69
if (t0 !== Symbol.for("react.early_return_sentinel")) {
70
return t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-property-store.expect.md
+3
-3
@@ -42,7 +42,7 @@ function Component(props) {
42
}
43
const x = t0;
44
let t1;
45
- if ($[1] !== props.cond || $[2] !== props.a) {
45
+ if ($[1] !== props.a || $[2] !== props.cond) {
46
let y;
47
if (props.cond) {
48
y = {};
@@ -53,8 +53,8 @@ function Component(props) {
53
y.x = x;
54
55
t1 = [x, y];
56
- $[1] = props.cond;
57
- $[2] = props.a;
56
+ $[1] = props.a;
57
+ $[2] = props.cond;
58
$[3] = t1;
59
} else {
60
t1 = $[3];
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
+3
-3
@@ -58,7 +58,7 @@ function useFoo(t0) {
58
local = $[1];
59
}
60
let t1;
61
- if ($[2] !== shouldReadA || $[3] !== local) {
61
+ if ($[2] !== local || $[3] !== shouldReadA) {
62
t1 = (
63
<Stringify
64
fn={() => {
@@ -70,8 +70,8 @@ function useFoo(t0) {
70
shouldInvokeFns={true}
71
/>
72
);
73
- $[2] = shouldReadA;
74
- $[3] = local;
73
+ $[2] = local;
74
+ $[3] = shouldReadA;
75
$[4] = t1;
76
} else {
77
t1 = $[4];
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
+3
-3
@@ -41,7 +41,7 @@ function Foo(t0) {
41
const $ = _c(3);
42
const { a, shouldReadA } = t0;
43
let t1;
44
- if ($[0] !== shouldReadA || $[1] !== a) {
44
+ if ($[0] !== a || $[1] !== shouldReadA) {
45
t1 = (
46
<Stringify
47
fn={() => {
@@ -53,8 +53,8 @@ function Foo(t0) {
53
shouldInvokeFns={true}
54
/>
55
);
56
- $[0] = shouldReadA;
57
- $[1] = a;
56
+ $[0] = a;
57
+ $[1] = shouldReadA;
58
$[2] = t1;
59
} else {
60
t1 = $[2];
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
+3
-3
@@ -51,13 +51,13 @@ function Foo(t0) {
51
const fn = t1;
52
useIdentity(null);
53
let x;
54
- if ($[2] !== cond || $[3] !== a.b.c) {
54
+ if ($[2] !== a.b.c || $[3] !== cond) {
55
x = makeArray();
56
if (cond) {
57
x.push(identity(a.b.c));
58
}
59
- $[2] = cond;
60
- $[3] = a.b.c;
59
+ $[2] = a.b.c;
60
+ $[3] = cond;
61
$[4] = x;
62
} else {
63
x = $[4];
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
+6
-6
@@ -50,22 +50,22 @@ function Foo(t0) {
50
const fn = t1;
51
useIdentity(null);
52
let arr;
53
- if ($[2] !== cond || $[3] !== a.b?.c.e) {
53
+ if ($[2] !== a.b?.c.e || $[3] !== cond) {
54
arr = makeArray();
55
if (cond) {
56
arr.push(identity(a.b?.c.e));
57
}
58
- $[2] = cond;
59
- $[3] = a.b?.c.e;
58
+ $[2] = a.b?.c.e;
59
+ $[3] = cond;
60
$[4] = arr;
61
} else {
62
arr = $[4];
63
}
64
let t2;
65
- if ($[5] !== fn || $[6] !== arr) {
65
+ if ($[5] !== arr || $[6] !== fn) {
66
t2 = <Stringify fn={fn} arr={arr} shouldInvokeFns={true} />;
67
- $[5] = fn;
68
- $[6] = arr;
67
+ $[5] = arr;
68
+ $[6] = fn;
69
$[7] = t2;
70
} else {
71
t2 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-objectmethod-cond-access.expect.md
+3
-3
@@ -41,7 +41,7 @@ function Foo(t0) {
41
const $ = _c(3);
42
const { a, shouldReadA } = t0;
43
let t1;
44
- if ($[0] !== shouldReadA || $[1] !== a) {
44
+ if ($[0] !== a || $[1] !== shouldReadA) {
45
t1 = (
46
<Stringify
47
objectMethod={{
@@ -55,8 +55,8 @@ function Foo(t0) {
55
shouldInvokeFns={true}
56
/>
57
);
58
- $[0] = shouldReadA;
59
- $[1] = a;
58
+ $[0] = a;
59
+ $[1] = shouldReadA;
60
$[2] = t1;
61
} else {
62
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/memberexpr-join-optional-chain2.expect.md
+3
-3
@@ -24,7 +24,7 @@ import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
24
function Component(props) {
25
const $ = _c(5);
26
let x;
27
- if ($[0] !== props.items?.length || $[1] !== props.items?.edges) {
27
+ if ($[0] !== props.items?.edges || $[1] !== props.items?.length) {
28
x = [];
29
x.push(props.items?.length);
30
let t0;
@@ -36,8 +36,8 @@ function Component(props) {
36
t0 = $[4];
37
}
38
x.push(t0);
39
- $[0] = props.items?.length;
40
- $[1] = props.items?.edges;
39
+ $[0] = props.items?.edges;
40
+ $[1] = props.items?.length;
41
$[2] = x;
42
} else {
43
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/promote-uncond.expect.md
+4
-4
@@ -38,15 +38,15 @@ import { identity } from "shared-runtime";
38
function usePromoteUnconditionalAccessToDependency(props, other) {
39
const $ = _c(4);
40
let x;
41
- if ($[0] !== props.a.a.a || $[1] !== props.a.b || $[2] !== other) {
41
+ if ($[0] !== other || $[1] !== props.a.a.a || $[2] !== props.a.b) {
42
x = {};
43
x.a = props.a.a.a;
44
if (identity(other)) {
45
x.c = props.a.b.c;
46
}
47
- $[0] = props.a.a.a;
48
- $[1] = props.a.b;
49
- $[2] = other;
47
+ $[0] = other;
48
+ $[1] = props.a.a.a;
49
+ $[2] = props.a.b;
50
$[3] = x;
51
} else {
52
x = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-renaming-unconditional-ternary.expect.md
+4
-4
@@ -39,11 +39,11 @@ function useFoo(props) {
39
} else {
40
x = $[1];
41
}
42
- if ($[2] !== props.cond || $[3] !== props.foo || $[4] !== props.bar) {
42
+ if ($[2] !== props.bar || $[3] !== props.cond || $[4] !== props.foo) {
43
props.cond ? ((x = []), x.push(props.foo)) : ((x = []), x.push(props.bar));
44
- $[2] = props.cond;
45
- $[3] = props.foo;
46
- $[4] = props.bar;
44
+ $[2] = props.bar;
45
+ $[3] = props.cond;
46
+ $[4] = props.foo;
47
$[5] = x;
48
} else {
49
x = $[5];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch-non-final-default.expect.md
+8
-8
@@ -35,8 +35,8 @@ function Component(props) {
35
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
36
function Component(props) {
37
const $ = _c(8);
38
- let y;
38
let t0;
39
+ let y;
40
if ($[0] !== props.p0 || $[1] !== props.p2) {
41
const x = [];
42
bb0: switch (props.p0) {
@@ -65,19 +65,19 @@ function Component(props) {
65
t0 = <Component data={x} />;
66
$[0] = props.p0;
67
$[1] = props.p2;
68
- $[2] = y;
69
- $[3] = t0;
68
+ $[2] = t0;
69
+ $[3] = y;
70
} else {
71
- y = $[2];
72
- t0 = $[3];
71
+ t0 = $[2];
72
+ y = $[3];
73
}
74
const child = t0;
75
y.push(props.p4);
76
let t1;
77
- if ($[5] !== y || $[6] !== child) {
77
+ if ($[5] !== child || $[6] !== y) {
78
t1 = <Component data={y}>{child}</Component>;
79
- $[5] = y;
80
- $[6] = child;
79
+ $[5] = child;
80
+ $[6] = y;
81
$[7] = t1;
82
} else {
83
t1 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md
+8
-8
@@ -30,8 +30,8 @@ function Component(props) {
30
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
31
function Component(props) {
32
const $ = _c(8);
33
- let y;
33
let t0;
34
+ let y;
35
if ($[0] !== props.p0 || $[1] !== props.p2 || $[2] !== props.p3) {
36
const x = [];
37
switch (props.p0) {
@@ -48,19 +48,19 @@ function Component(props) {
48
$[0] = props.p0;
49
$[1] = props.p2;
50
$[2] = props.p3;
51
- $[3] = y;
52
- $[4] = t0;
51
+ $[3] = t0;
52
+ $[4] = y;
53
} else {
54
- y = $[3];
55
- t0 = $[4];
54
+ t0 = $[3];
55
+ y = $[4];
56
}
57
const child = t0;
58
y.push(props.p4);
59
let t1;
60
- if ($[5] !== y || $[6] !== child) {
60
+ if ($[5] !== child || $[6] !== y) {
61
t1 = <Component data={y}>{child}</Component>;
62
- $[5] = y;
63
- $[6] = child;
62
+ $[5] = child;
63
+ $[6] = y;
64
$[7] = t1;
65
} else {
66
t1 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch-escaping.expect.md
+3
-3
@@ -34,7 +34,7 @@ const { throwInput } = require("shared-runtime");
34
function Component(props) {
35
const $ = _c(3);
36
let x;
37
- if ($[0] !== props.y || $[1] !== props.e) {
37
+ if ($[0] !== props.e || $[1] !== props.y) {
38
try {
39
const y = [];
40
y.push(props.y);
@@ -44,8 +44,8 @@ function Component(props) {
44
e.push(props.e);
45
x = e;
46
}
47
- $[0] = props.y;
48
- $[1] = props.e;
47
+ $[0] = props.e;
48
+ $[1] = props.y;
49
$[2] = x;
50
} else {
51
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/try-catch-try-value-modified-in-catch.expect.md
+3
-3
@@ -33,7 +33,7 @@ const { throwInput } = require("shared-runtime");
33
function Component(props) {
34
const $ = _c(3);
35
let t0;
36
- if ($[0] !== props.y || $[1] !== props.e) {
36
+ if ($[0] !== props.e || $[1] !== props.y) {
37
t0 = Symbol.for("react.early_return_sentinel");
38
bb0: {
39
try {
@@ -47,8 +47,8 @@ function Component(props) {
47
break bb0;
48
}
49
}
50
- $[0] = props.y;
51
- $[1] = props.e;
50
+ $[0] = props.e;
51
+ $[1] = props.y;
52
$[2] = t0;
53
} else {
54
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/useMemo-multiple-if-else.expect.md
+8
-8
@@ -39,10 +39,10 @@ function Component(props) {
39
bb0: {
40
let y;
41
if (
42
- $[0] !== props.cond ||
43
- $[1] !== props.a ||
44
- $[2] !== props.cond2 ||
45
- $[3] !== props.b
42
+ $[0] !== props.a ||
43
+ $[1] !== props.b ||
44
+ $[2] !== props.cond ||
45
+ $[3] !== props.cond2
46
) {
47
y = [];
48
if (props.cond) {
@@ -54,10 +54,10 @@ function Component(props) {
54
}
55
56
y.push(props.b);
57
- $[0] = props.cond;
58
- $[1] = props.a;
59
- $[2] = props.cond2;
60
- $[3] = props.b;
57
+ $[0] = props.a;
58
+ $[1] = props.b;
59
+ $[2] = props.cond;
60
+ $[3] = props.cond2;
61
$[4] = y;
62
$[5] = t0;
63
} else {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md
+3
-3
@@ -54,10 +54,10 @@ function Component(props) {
54
}
55
const c = t0;
56
let t1;
57
- if ($[3] !== c || $[4] !== a) {
57
+ if ($[3] !== a || $[4] !== c) {
58
t1 = [c, a];
59
- $[3] = c;
60
- $[4] = a;
59
+ $[3] = a;
60
+ $[4] = c;
61
$[5] = t1;
62
} else {
63
t1 = $[5];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md
+6
-6
@@ -20,11 +20,11 @@ import { c as _c } from "react/compiler-runtime";
20
function Component(props) {
21
const $ = _c(8);
22
let items;
23
- if ($[0] !== props.key || $[1] !== props.a) {
23
+ if ($[0] !== props.a || $[1] !== props.key) {
24
items = bar();
25
mutate(items[props.key], props.a);
26
- $[0] = props.key;
27
- $[1] = props.a;
26
+ $[0] = props.a;
27
+ $[1] = props.key;
28
$[2] = items;
29
} else {
30
items = $[2];
@@ -41,10 +41,10 @@ function Component(props) {
41
}
42
const count = t1;
43
let t2;
44
- if ($[5] !== items || $[6] !== count) {
44
+ if ($[5] !== count || $[6] !== items) {
45
t2 = { items, count };
46
- $[5] = items;
47
- $[6] = count;
46
+ $[5] = count;
47
+ $[6] = items;
48
$[7] = t2;
49
} else {
50
t2 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md
+3
-3
@@ -40,10 +40,10 @@ function Component(props) {
40
}
41
const count = t1;
42
let t2;
43
- if ($[4] !== items || $[5] !== count) {
43
+ if ($[4] !== count || $[5] !== items) {
44
t2 = { items, count };
45
- $[4] = items;
46
- $[5] = count;
45
+ $[4] = count;
46
+ $[5] = items;
47
$[6] = t2;
48
} else {
49
t2 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md
+8
-8
@@ -42,8 +42,8 @@ export const FIXTURE_ENTRYPOINT = {
42
import { c as _c } from "react/compiler-runtime";
43
function foo(a, b, c) {
44
const $ = _c(10);
45
- let x;
45
let t0;
46
+ let x;
47
if ($[0] !== a) {
48
x = [];
49
if (a) {
@@ -52,11 +52,11 @@ function foo(a, b, c) {
52
53
t0 = <div>{x}</div>;
54
$[0] = a;
55
- $[1] = x;
56
- $[2] = t0;
55
+ $[1] = t0;
56
+ $[2] = x;
57
} else {
58
- x = $[1];
59
- t0 = $[2];
58
+ t0 = $[1];
59
+ x = $[2];
60
}
61
const y = t0;
62
bb0: switch (b) {
@@ -83,15 +83,15 @@ function foo(a, b, c) {
83
}
84
}
85
let t1;
86
- if ($[7] !== y || $[8] !== x) {
86
+ if ($[7] !== x || $[8] !== y) {
87
t1 = (
88
<div>
89
{y}
90
{x}
91
</div>
92
);
93
- $[7] = y;
94
- $[8] = x;
93
+ $[7] = x;
94
+ $[8] = y;
95
$[9] = t1;
96
} else {
97
t1 = $[9];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-break-in-scope.expect.md
+3
-3
@@ -34,7 +34,7 @@ function useFoo(t0) {
34
const $ = _c(3);
35
const { obj, objIsNull } = t0;
36
let x;
37
- if ($[0] !== objIsNull || $[1] !== obj) {
37
+ if ($[0] !== obj || $[1] !== objIsNull) {
38
x = [];
39
bb0: {
40
if (objIsNull) {
@@ -45,8 +45,8 @@ function useFoo(t0) {
45
46
x.push(obj.b);
47
}
48
- $[0] = objIsNull;
49
- $[1] = obj;
48
+ $[0] = obj;
49
+ $[1] = objIsNull;
50
$[2] = x;
51
} else {
52
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-return-in-scope.expect.md
+8
-8
@@ -31,9 +31,9 @@ import { c as _c } from "react/compiler-runtime";
31
function useFoo(t0) {
32
const $ = _c(4);
33
const { obj, objIsNull } = t0;
34
- let x;
34
let t1;
36
- if ($[0] !== objIsNull || $[1] !== obj) {
35
+ let x;
36
+ if ($[0] !== obj || $[1] !== objIsNull) {
37
t1 = Symbol.for("react.early_return_sentinel");
38
bb0: {
39
x = [];
@@ -46,13 +46,13 @@ function useFoo(t0) {
46
47
x.push(obj.b);
48
}
49
- $[0] = objIsNull;
50
- $[1] = obj;
51
- $[2] = x;
52
- $[3] = t1;
49
+ $[0] = obj;
50
+ $[1] = objIsNull;
51
+ $[2] = t1;
52
+ $[3] = x;
53
} else {
54
- x = $[2];
55
- t1 = $[3];
54
+ t1 = $[2];
55
+ x = $[3];
56
}
57
if (t1 !== Symbol.for("react.early_return_sentinel")) {
58
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/bug-infer-function-cond-access-not-hoisted.expect.md
+3
-3
@@ -38,7 +38,7 @@ function Foo(t0) {
38
const $ = _c(3);
39
const { a, shouldReadA } = t0;
40
let t1;
41
- if ($[0] !== shouldReadA || $[1] !== a.b.c) {
41
+ if ($[0] !== a.b.c || $[1] !== shouldReadA) {
42
t1 = (
43
<Stringify
44
fn={() => {
@@ -50,8 +50,8 @@ function Foo(t0) {
50
shouldInvokeFns={true}
51
/>
52
);
53
- $[0] = shouldReadA;
54
- $[1] = a.b.c;
53
+ $[0] = a.b.c;
54
+ $[1] = shouldReadA;
55
$[2] = t1;
56
} else {
57
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance.expect.md
+3
-3
@@ -80,10 +80,10 @@ function useFoo(t0) {
80
x = $[6];
81
}
82
let t1;
83
- if ($[7] !== y || $[8] !== x.a.b) {
83
+ if ($[7] !== x.a.b || $[8] !== y) {
84
t1 = [y, x.a.b];
85
- $[7] = y;
86
- $[8] = x.a.b;
85
+ $[7] = x.a.b;
86
+ $[8] = y;
87
$[9] = t1;
88
} else {
89
t1 = $[9];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/break-in-scope.expect.md
+3
-3
@@ -36,7 +36,7 @@ function useFoo(t0) {
36
const $ = _c(3);
37
const { obj, objIsNull } = t0;
38
let x;
39
- if ($[0] !== objIsNull || $[1] !== obj) {
39
+ if ($[0] !== obj || $[1] !== objIsNull) {
40
x = [];
41
bb0: {
42
if (objIsNull) {
@@ -45,8 +45,8 @@ function useFoo(t0) {
45
46
x.push(obj.a);
47
}
48
- $[0] = objIsNull;
49
- $[1] = obj;
48
+ $[0] = obj;
49
+ $[1] = objIsNull;
50
$[2] = x;
51
} else {
52
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/loop-break-in-scope.expect.md
+3
-3
@@ -36,7 +36,7 @@ function useFoo(t0) {
36
const $ = _c(3);
37
const { obj, objIsNull } = t0;
38
let x;
39
- if ($[0] !== objIsNull || $[1] !== obj) {
39
+ if ($[0] !== obj || $[1] !== objIsNull) {
40
x = [];
41
for (let i = 0; i < 5; i++) {
42
if (objIsNull) {
@@ -45,8 +45,8 @@ function useFoo(t0) {
45
46
x.push(obj.a);
47
}
48
- $[0] = objIsNull;
49
- $[1] = obj;
48
+ $[0] = obj;
49
+ $[1] = objIsNull;
50
$[2] = x;
51
} else {
52
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps.expect.md
+5
-5
@@ -42,8 +42,8 @@ import { identity } from "shared-runtime";
42
function useFoo(t0) {
43
const $ = _c(9);
44
const { input, cond, hasAB } = t0;
45
- let x;
45
let t1;
46
+ let x;
47
if ($[0] !== cond || $[1] !== hasAB || $[2] !== input) {
48
t1 = Symbol.for("react.early_return_sentinel");
49
bb0: {
@@ -77,11 +77,11 @@ function useFoo(t0) {
77
$[0] = cond;
78
$[1] = hasAB;
79
$[2] = input;
80
- $[3] = x;
81
- $[4] = t1;
80
+ $[3] = t1;
81
+ $[4] = x;
82
} else {
83
- x = $[3];
84
- t1 = $[4];
83
+ t1 = $[3];
84
+ x = $[4];
85
}
86
if (t1 !== Symbol.for("react.early_return_sentinel")) {
87
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/reduce-if-nonexhaustive-poisoned-deps1.expect.md
+5
-5
@@ -43,8 +43,8 @@ import { identity } from "shared-runtime";
43
function useFoo(t0) {
44
const $ = _c(11);
45
const { input, cond, hasAB } = t0;
46
- let x;
46
let t1;
47
+ let x;
48
if ($[0] !== cond || $[1] !== hasAB || $[2] !== input) {
49
t1 = Symbol.for("react.early_return_sentinel");
50
bb0: {
@@ -88,11 +88,11 @@ function useFoo(t0) {
88
$[0] = cond;
89
$[1] = hasAB;
90
$[2] = input;
91
- $[3] = x;
92
- $[4] = t1;
91
+ $[3] = t1;
92
+ $[4] = x;
93
} else {
94
- x = $[3];
95
- t1 = $[4];
94
+ t1 = $[3];
95
+ x = $[4];
96
}
97
if (t1 !== Symbol.for("react.early_return_sentinel")) {
98
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-in-scope.expect.md
+8
-8
@@ -33,9 +33,9 @@ import { c as _c } from "react/compiler-runtime";
33
function useFoo(t0) {
34
const $ = _c(4);
35
const { obj, objIsNull } = t0;
36
- let x;
36
let t1;
38
- if ($[0] !== objIsNull || $[1] !== obj) {
37
+ let x;
38
+ if ($[0] !== obj || $[1] !== objIsNull) {
39
t1 = Symbol.for("react.early_return_sentinel");
40
bb0: {
41
x = [];
@@ -46,13 +46,13 @@ function useFoo(t0) {
46
47
x.push(obj.b);
48
}
49
- $[0] = objIsNull;
50
- $[1] = obj;
51
- $[2] = x;
52
- $[3] = t1;
49
+ $[0] = obj;
50
+ $[1] = objIsNull;
51
+ $[2] = t1;
52
+ $[3] = x;
53
} else {
54
- x = $[2];
55
- t1 = $[3];
54
+ t1 = $[2];
55
+ x = $[3];
56
}
57
if (t1 !== Symbol.for("react.early_return_sentinel")) {
58
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-poisoned/return-poisons-outer-scope.expect.md
+5
-5
@@ -39,8 +39,8 @@ import { identity } from "shared-runtime";
39
function useFoo(t0) {
40
const $ = _c(6);
41
const { input, cond } = t0;
42
- let x;
42
let t1;
43
+ let x;
44
if ($[0] !== cond || $[1] !== input) {
45
t1 = Symbol.for("react.early_return_sentinel");
46
bb0: {
@@ -61,11 +61,11 @@ function useFoo(t0) {
61
}
62
$[0] = cond;
63
$[1] = input;
64
- $[2] = x;
65
- $[3] = t1;
64
+ $[2] = t1;
65
+ $[3] = x;
66
} else {
67
- x = $[2];
68
- t1 = $[3];
67
+ t1 = $[2];
68
+ x = $[3];
69
}
70
if (t1 !== Symbol.for("react.early_return_sentinel")) {
71
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/jump-target-within-scope-loop-break.expect.md
+3
-3
@@ -40,7 +40,7 @@ function useFoo(t0) {
40
const $ = _c(3);
41
const { input, max } = t0;
42
let x;
43
- if ($[0] !== max || $[1] !== input.a.b) {
43
+ if ($[0] !== input.a.b || $[1] !== max) {
44
x = [];
45
let i = 0;
46
while (true) {
@@ -52,8 +52,8 @@ function useFoo(t0) {
52
53
x.push(i);
54
x.push(input.a.b);
55
- $[0] = max;
56
- $[1] = input.a.b;
55
+ $[0] = input.a.b;
56
+ $[1] = max;
57
$[2] = x;
58
} else {
59
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps.expect.md
+5
-5
@@ -33,8 +33,8 @@ import { identity } from "shared-runtime";
33
function useFoo(t0) {
34
const $ = _c(9);
35
const { input, hasAB, returnNull } = t0;
36
- let x;
36
let t1;
37
+ let x;
38
if ($[0] !== hasAB || $[1] !== input.a || $[2] !== returnNull) {
39
t1 = Symbol.for("react.early_return_sentinel");
40
bb0: {
@@ -68,11 +68,11 @@ function useFoo(t0) {
68
$[0] = hasAB;
69
$[1] = input.a;
70
$[2] = returnNull;
71
- $[3] = x;
72
- $[4] = t1;
71
+ $[3] = t1;
72
+ $[4] = x;
73
} else {
74
- x = $[3];
75
- t1 = $[4];
74
+ t1 = $[3];
75
+ x = $[4];
76
}
77
if (t1 !== Symbol.for("react.early_return_sentinel")) {
78
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/jump-unpoisoned/reduce-if-exhaustive-nonpoisoned-deps1.expect.md
+5
-5
@@ -43,8 +43,8 @@ import { identity } from "shared-runtime";
43
function useFoo(t0) {
44
const $ = _c(11);
45
const { input, cond2, cond1 } = t0;
46
- let x;
46
let t1;
47
+ let x;
48
if ($[0] !== cond1 || $[1] !== cond2 || $[2] !== input.a.b) {
49
t1 = Symbol.for("react.early_return_sentinel");
50
bb0: {
@@ -88,11 +88,11 @@ function useFoo(t0) {
88
$[0] = cond1;
89
$[1] = cond2;
90
$[2] = input.a.b;
91
- $[3] = x;
92
- $[4] = t1;
91
+ $[3] = t1;
92
+ $[4] = x;
93
} else {
94
- x = $[3];
95
- t1 = $[4];
94
+ t1 = $[3];
95
+ x = $[4];
96
}
97
if (t1 !== Symbol.for("react.early_return_sentinel")) {
98
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/memberexpr-join-optional-chain2.expect.md
+3
-3
@@ -23,7 +23,7 @@ import { c as _c } from "react/compiler-runtime";
23
function Component(props) {
24
const $ = _c(5);
25
let x;
26
- if ($[0] !== props.items?.length || $[1] !== props.items?.edges) {
26
+ if ($[0] !== props.items?.edges || $[1] !== props.items?.length) {
27
x = [];
28
x.push(props.items?.length);
29
let t0;
@@ -35,8 +35,8 @@ function Component(props) {
35
t0 = $[4];
36
}
37
x.push(t0);
38
- $[0] = props.items?.length;
39
- $[1] = props.items?.edges;
38
+ $[0] = props.items?.edges;
39
+ $[1] = props.items?.length;
40
$[2] = x;
41
} else {
42
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/promote-uncond.expect.md
+3
-3
@@ -36,14 +36,14 @@ import { identity } from "shared-runtime";
36
function usePromoteUnconditionalAccessToDependency(props, other) {
37
const $ = _c(3);
38
let x;
39
- if ($[0] !== props.a || $[1] !== other) {
39
+ if ($[0] !== other || $[1] !== props.a) {
40
x = {};
41
x.a = props.a.a.a;
42
if (identity(other)) {
43
x.c = props.a.b.c;
44
}
45
- $[0] = props.a;
46
- $[1] = other;
45
+ $[0] = other;
46
+ $[1] = props.a;
47
$[2] = x;
48
} else {
49
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/reduce-if-exhaustive-poisoned-deps.expect.md
+9
-9
@@ -34,9 +34,9 @@ import { identity } from "shared-runtime";
34
function useFoo(t0) {
35
const $ = _c(11);
36
const { input, inputHasAB, inputHasABC } = t0;
37
- let x;
37
let t1;
39
- if ($[0] !== inputHasABC || $[1] !== input.a || $[2] !== inputHasAB) {
38
+ let x;
39
+ if ($[0] !== input.a || $[1] !== inputHasAB || $[2] !== inputHasABC) {
40
t1 = Symbol.for("react.early_return_sentinel");
41
bb0: {
42
x = [];
@@ -75,14 +75,14 @@ function useFoo(t0) {
75
x.push(t2);
76
}
77
}
78
- $[0] = inputHasABC;
79
- $[1] = input.a;
80
- $[2] = inputHasAB;
81
- $[3] = x;
82
- $[4] = t1;
78
+ $[0] = input.a;
79
+ $[1] = inputHasAB;
80
+ $[2] = inputHasABC;
81
+ $[3] = t1;
82
+ $[4] = x;
83
} else {
84
- x = $[3];
85
- t1 = $[4];
84
+ t1 = $[3];
85
+ x = $[4];
86
}
87
if (t1 !== Symbol.for("react.early_return_sentinel")) {
88
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/subpath-order1.expect.md
+3
-3
@@ -40,14 +40,14 @@ import { identity } from "shared-runtime";
40
function useConditionalSubpath1(props, cond) {
41
const $ = _c(3);
42
let x;
43
- if ($[0] !== props.a || $[1] !== cond) {
43
+ if ($[0] !== cond || $[1] !== props.a) {
44
x = {};
45
x.b = props.a.b;
46
if (identity(cond)) {
47
x.a = props.a;
48
}
49
- $[0] = props.a;
50
- $[1] = cond;
49
+ $[0] = cond;
50
+ $[1] = props.a;
51
$[2] = x;
52
} else {
53
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/superpath-order1.expect.md
+3
-3
@@ -48,14 +48,14 @@ function useConditionalSuperpath1(t0) {
48
const $ = _c(3);
49
const { props, cond } = t0;
50
let x;
51
- if ($[0] !== props.a || $[1] !== cond) {
51
+ if ($[0] !== cond || $[1] !== props.a) {
52
x = {};
53
x.a = props.a;
54
if (identity(cond)) {
55
x.b = props.a.b;
56
}
57
- $[0] = props.a;
58
- $[1] = cond;
57
+ $[0] = cond;
58
+ $[1] = props.a;
59
$[2] = x;
60
} else {
61
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-access-in-mutable-range.expect.md
+3
-3
@@ -49,15 +49,15 @@ function Component(t0) {
49
const $ = _c(8);
50
const { cond, other } = t0;
51
let x;
52
- if ($[0] !== other || $[1] !== cond) {
52
+ if ($[0] !== cond || $[1] !== other) {
53
x = makeObject_Primitives();
54
setProperty(x, { b: 3, other }, "a");
55
identity(x.a.b);
56
if (!cond) {
57
x.a = null;
58
}
59
- $[0] = other;
60
- $[1] = cond;
59
+ $[0] = cond;
60
+ $[1] = other;
61
$[2] = x;
62
} else {
63
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/uncond-nonoverlap-descendant.expect.md
+3
-3
@@ -27,13 +27,13 @@ import { c as _c } from "react/compiler-runtime"; // Test that we can track non-
27
function TestNonOverlappingDescendantTracked(props) {
28
const $ = _c(4);
29
let x;
30
- if ($[0] !== props.a.x.y || $[1] !== props.a.c.x.y.z || $[2] !== props.b) {
30
+ if ($[0] !== props.a.c.x.y.z || $[1] !== props.a.x.y || $[2] !== props.b) {
31
x = {};
32
x.a = props.a.x.y;
33
x.b = props.b;
34
x.c = props.a.c.x.y.z;
35
- $[0] = props.a.x.y;
36
- $[1] = props.a.c.x.y.z;
35
+ $[0] = props.a.c.x.y.z;
36
+ $[1] = props.a.x.y;
37
$[2] = props.b;
38
$[3] = x;
39
} else {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.expect.md
+3
-3
@@ -82,10 +82,10 @@ function Component(t0) {
82
}
83
const b = t3;
84
let t4;
85
- if ($[4] !== b || $[5] !== a) {
85
+ if ($[4] !== a || $[5] !== b) {
86
t4 = { b, a };
87
- $[4] = b;
88
- $[5] = a;
87
+ $[4] = a;
88
+ $[5] = b;
89
$[6] = t4;
90
} else {
91
t4 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md
+3
-3
@@ -59,7 +59,7 @@ function Component(t0) {
59
const serverTime = useServerTime();
60
let t1;
61
let timestampLabel;
62
- if ($[0] !== highlightedItem || $[1] !== serverTime || $[2] !== label) {
62
+ if ($[0] !== highlightedItem || $[1] !== label || $[2] !== serverTime) {
63
const highlight = new Highlight(highlightedItem);
64
65
const time = serverTime.get();
@@ -68,8 +68,8 @@ function Component(t0) {
68
69
t1 = highlight.render();
70
$[0] = highlightedItem;
71
- $[1] = serverTime;
72
- $[2] = label;
71
+ $[1] = label;
72
+ $[2] = serverTime;
73
$[3] = t1;
74
$[4] = timestampLabel;
75
} else {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value-via-alias.expect.md
+3
-3
@@ -66,10 +66,10 @@ function MyApp(t0) {
66
const z = makeObject_Primitives();
67
const x = useIdentity(2);
68
let t1;
69
- if ($[0] !== x || $[1] !== count) {
69
+ if ($[0] !== count || $[1] !== x) {
70
t1 = sum(x, count);
71
- $[0] = x;
72
- $[1] = count;
71
+ $[0] = count;
72
+ $[1] = x;
73
$[2] = t1;
74
} else {
75
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.expect.md
+3
-3
@@ -65,10 +65,10 @@ function MyApp(t0) {
65
const z = makeObject_Primitives();
66
const x = useIdentity(2);
67
let t1;
68
- if ($[0] !== x || $[1] !== count) {
68
+ if ($[0] !== count || $[1] !== x) {
69
t1 = sum(x, count);
70
- $[0] = x;
71
- $[1] = count;
70
+ $[0] = count;
71
+ $[1] = x;
72
$[2] = t1;
73
} else {
74
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-reactivity-value-block.expect.md
+3
-3
@@ -71,10 +71,10 @@ function Foo() {
71
const shouldCaptureObj = obj != null && CONST_TRUE;
72
const t0 = shouldCaptureObj ? identity(obj) : null;
73
let t1;
74
- if ($[0] !== t0 || $[1] !== obj) {
74
+ if ($[0] !== obj || $[1] !== t0) {
75
t1 = [t0, obj];
76
- $[0] = t0;
77
- $[1] = obj;
76
+ $[0] = obj;
77
+ $[1] = t0;
78
$[2] = t1;
79
} else {
80
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types-explicit-types.expect.md
+3
-3
@@ -77,15 +77,15 @@ function Component() {
77
const map = t3;
78
const index = filtered.findIndex(_temp3);
79
let t5;
80
- if ($[8] !== map || $[9] !== index) {
80
+ if ($[8] !== index || $[9] !== map) {
81
t5 = (
82
<div>
83
{map}
84
{index}
85
</div>
86
);
87
- $[8] = map;
88
- $[9] = index;
87
+ $[8] = index;
88
+ $[9] = map;
89
$[10] = t5;
90
} else {
91
t5 = $[10];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-memoization-lack-of-phi-types.expect.md
+3
-3
@@ -74,15 +74,15 @@ function Component() {
74
const map = t3;
75
const index = filtered.findIndex(_temp3);
76
let t5;
77
- if ($[8] !== map || $[9] !== index) {
77
+ if ($[8] !== index || $[9] !== map) {
78
t5 = (
79
<div>
80
{map}
81
{index}
82
</div>
83
);
84
- $[8] = map;
85
- $[9] = index;
84
+ $[8] = index;
85
+ $[9] = map;
86
$[10] = t5;
87
} else {
88
t5 = $[10];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary.expect.md
+3
-3
@@ -21,13 +21,13 @@ function Component(listItem, thread) {
21
let t0;
22
let t1;
23
let t2;
24
- if ($[0] !== thread.threadType || $[1] !== listItem) {
24
+ if ($[0] !== listItem || $[1] !== thread.threadType) {
25
const isFoo = isFooThread(thread.threadType);
26
t1 = useBar;
27
t2 = listItem;
28
t0 = getBadgeText(listItem, isFoo);
29
- $[0] = thread.threadType;
30
- $[1] = listItem;
29
+ $[0] = listItem;
30
+ $[1] = thread.threadType;
31
$[2] = t0;
32
$[3] = t1;
33
$[4] = t2;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-propagate-type-of-ternary-jsx.expect.md
+4
-4
@@ -28,7 +28,7 @@ function V0(t0) {
28
const { v1, v2 } = t0;
29
const v5 = v1.v6?.v7;
30
let t1;
31
- if ($[0] !== v5 || $[1] !== v1 || $[2] !== v2) {
31
+ if ($[0] !== v1 || $[1] !== v2 || $[2] !== v5) {
32
t1 = (
33
<Component8 c9={va} cb="apqjx">
34
{v5 != null ? (
@@ -40,9 +40,9 @@ function V0(t0) {
40
)}
41
</Component8>
42
);
43
- $[0] = v5;
44
- $[1] = v1;
45
- $[2] = v2;
43
+ $[0] = v1;
44
+ $[1] = v2;
45
+ $[2] = v5;
46
$[3] = t1;
47
} else {
48
t1 = $[3];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-slow-validate-preserve-memo.expect.md
+3
-3
@@ -36,7 +36,7 @@ function useTest(t0) {
36
const $ = _c(3);
37
const { isNull, data } = t0;
38
let t1;
39
- if ($[0] !== isNull || $[1] !== data) {
39
+ if ($[0] !== data || $[1] !== isNull) {
40
t1 = Builder.makeBuilder(isNull, "hello world")
41
?.push("1", 2)
42
?.push(3, { a: 4, b: 5, c: data })
@@ -47,8 +47,8 @@ function useTest(t0) {
47
)
48
?.push(7, "8")
49
?.push("8", Builder.makeBuilder(!isNull)?.push(9).vals)?.vals;
50
- $[0] = isNull;
51
- $[1] = data;
50
+ $[0] = data;
51
+ $[1] = isNull;
52
$[2] = t1;
53
} else {
54
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md
+3
-3
@@ -38,7 +38,7 @@ import { Stringify } from "shared-runtime";
38
function Component(props) {
39
const $ = _c(3);
40
let t0;
41
- if ($[0] !== props.value.length || $[1] !== props.cond) {
41
+ if ($[0] !== props.cond || $[1] !== props.value.length) {
42
const label = fbt._(
43
{ "*": "{number} bars", _1: "1 bar" },
44
[fbt._plural(props.value.length, "number")],
@@ -51,8 +51,8 @@ function Component(props) {
51
label={label.toString()}
52
/>
53
) : null;
54
- $[0] = props.value.length;
55
- $[1] = props.cond;
54
+ $[0] = props.cond;
55
+ $[1] = props.value.length;
56
$[2] = t0;
57
} else {
58
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unreachable-code-early-return-in-useMemo.expect.md
+3
-3
@@ -77,10 +77,10 @@ function Component(t0) {
77
t2 = $[3];
78
}
79
let t3;
80
- if ($[4] !== t2 || $[5] !== result) {
80
+ if ($[4] !== result || $[5] !== t2) {
81
t3 = <ValidateMemoization inputs={t2} output={result} />;
82
- $[4] = t2;
83
- $[5] = result;
82
+ $[4] = result;
83
+ $[5] = t2;
84
$[6] = t3;
85
} else {
86
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro.expect.md
+5
-5
@@ -26,8 +26,8 @@ import { c as _c } from "react/compiler-runtime";
26
function Component(props) {
27
const $ = _c(7);
28
const item = props.item;
29
- let t0;
29
let baseVideos;
30
+ let t0;
31
let thumbnails;
32
if ($[0] !== item) {
33
thumbnails = [];
@@ -40,12 +40,12 @@ function Component(props) {
40
}
41
});
42
$[0] = item;
43
- $[1] = t0;
44
- $[2] = baseVideos;
43
+ $[1] = baseVideos;
44
+ $[2] = t0;
45
$[3] = thumbnails;
46
} else {
47
- t0 = $[1];
48
- baseVideos = $[2];
47
+ baseVideos = $[1];
48
+ t0 = $[2];
49
thumbnails = $[3];
50
}
51
t0 = undefined;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-array-pattern.expect.md
+3
-3
@@ -21,10 +21,10 @@ function Component(foo, ...t0) {
21
const $ = _c(3);
22
const [bar] = t0;
23
let t1;
24
- if ($[0] !== foo || $[1] !== bar) {
24
+ if ($[0] !== bar || $[1] !== foo) {
25
t1 = [foo, bar];
26
- $[0] = foo;
27
- $[1] = bar;
26
+ $[0] = bar;
27
+ $[1] = foo;
28
$[2] = t1;
29
} else {
30
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-identifier.expect.md
+3
-3
@@ -21,10 +21,10 @@ function Component(foo, ...t0) {
21
const $ = _c(3);
22
const bar = t0;
23
let t1;
24
- if ($[0] !== foo || $[1] !== bar) {
24
+ if ($[0] !== bar || $[1] !== foo) {
25
t1 = [foo, bar];
26
- $[0] = foo;
27
- $[1] = bar;
26
+ $[0] = bar;
27
+ $[1] = foo;
28
$[2] = t1;
29
} else {
30
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rest-param-with-object-spread-pattern.expect.md
+3
-3
@@ -21,10 +21,10 @@ function Component(foo, ...t0) {
21
const $ = _c(3);
22
const { bar } = t0;
23
let t1;
24
- if ($[0] !== foo || $[1] !== bar) {
24
+ if ($[0] !== bar || $[1] !== foo) {
25
t1 = [foo, bar];
26
- $[0] = foo;
27
- $[1] = bar;
26
+ $[0] = bar;
27
+ $[1] = foo;
28
$[2] = t1;
29
} else {
30
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md
+7
-7
@@ -73,14 +73,14 @@ function foo(props) {
73
}
74
const header = t0;
75
let y;
76
- if ($[5] !== x || $[6] !== props.b || $[7] !== props.c) {
76
+ if ($[5] !== props.b || $[6] !== props.c || $[7] !== x) {
77
y = [x];
78
x = [];
79
y.push(props.b);
80
x.push(props.c);
81
- $[5] = x;
82
- $[6] = props.b;
83
- $[7] = props.c;
81
+ $[5] = props.b;
82
+ $[6] = props.c;
83
+ $[7] = x;
84
$[8] = y;
85
$[9] = x;
86
} else {
@@ -103,15 +103,15 @@ function foo(props) {
103
}
104
const content = t1;
105
let t2;
106
- if ($[13] !== header || $[14] !== content) {
106
+ if ($[13] !== content || $[14] !== header) {
107
t2 = (
108
<>
109
{header}
110
{content}
111
</>
112
);
113
- $[13] = header;
114
- $[14] = content;
113
+ $[13] = content;
114
+ $[14] = header;
115
$[15] = t2;
116
} else {
117
t2 = $[15];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md
+12
-12
@@ -53,30 +53,30 @@ import { c as _c } from "react/compiler-runtime"; // note: comments are for the
53
// emitted
54
function foo(props) {
55
const $ = _c(14);
56
- let x;
56
let t0;
57
+ let x;
58
if ($[0] !== props.a) {
59
x = [];
60
x.push(props.a);
61
62
t0 = <div>{x}</div>;
63
$[0] = props.a;
64
- $[1] = x;
65
- $[2] = t0;
64
+ $[1] = t0;
65
+ $[2] = x;
66
} else {
67
- x = $[1];
68
- t0 = $[2];
67
+ t0 = $[1];
68
+ x = $[2];
69
}
70
const header = t0;
71
let y;
72
- if ($[3] !== x || $[4] !== props.b || $[5] !== props.c) {
72
+ if ($[3] !== props.b || $[4] !== props.c || $[5] !== x) {
73
y = [x];
74
x = [];
75
y.push(props.b);
76
x.push(props.c);
77
- $[3] = x;
78
- $[4] = props.b;
79
- $[5] = props.c;
77
+ $[3] = props.b;
78
+ $[4] = props.c;
79
+ $[5] = x;
80
$[6] = y;
81
$[7] = x;
82
} else {
@@ -99,15 +99,15 @@ function foo(props) {
99
}
100
const content = t1;
101
let t2;
102
- if ($[11] !== header || $[12] !== content) {
102
+ if ($[11] !== content || $[12] !== header) {
103
t2 = (
104
<>
105
{header}
106
{content}
107
</>
108
);
109
- $[11] = header;
110
- $[12] = content;
109
+ $[11] = content;
110
+ $[12] = header;
111
$[13] = t2;
112
} else {
113
t2 = $[13];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md
+7
-7
@@ -43,9 +43,9 @@ import { identity } from "shared-runtime";
43
44
function Component(statusName) {
45
const $ = _c(12);
46
- let text;
46
let t0;
47
let t1;
48
+ let text;
49
if ($[0] !== statusName) {
50
const { status, text: t2 } = foo(statusName);
51
text = t2;
@@ -54,13 +54,13 @@ function Component(statusName) {
54
t1 = identity(bg);
55
t0 = identity(color);
56
$[0] = statusName;
57
- $[1] = text;
58
- $[2] = t0;
59
- $[3] = t1;
57
+ $[1] = t0;
58
+ $[2] = t1;
59
+ $[3] = text;
60
} else {
61
- text = $[1];
62
- t0 = $[2];
63
- t1 = $[3];
61
+ t0 = $[1];
62
+ t1 = $[2];
63
+ text = $[3];
64
}
65
let t2;
66
if ($[4] !== text) {
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md
+7
-7
@@ -46,9 +46,9 @@ import { identity } from "shared-runtime";
46
47
function Component(statusName) {
48
const $ = _c(12);
49
+ let font;
50
let t0;
51
let text;
51
- let font;
52
if ($[0] !== statusName) {
53
const { status, text: t1 } = foo(statusName);
54
text = t1;
@@ -58,13 +58,13 @@ function Component(statusName) {
58
59
t0 = identity(color);
60
$[0] = statusName;
61
- $[1] = t0;
62
- $[2] = text;
63
- $[3] = font;
61
+ $[1] = font;
62
+ $[2] = t0;
63
+ $[3] = text;
64
} else {
65
- t0 = $[1];
66
- text = $[2];
67
- font = $[3];
65
+ font = $[1];
66
+ t0 = $[2];
67
+ text = $[3];
68
}
69
const bg = t0;
70
let t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md
+8
-8
@@ -34,8 +34,8 @@ function Component(props) {
34
import { c as _c } from "react/compiler-runtime";
35
function Component(props) {
36
const $ = _c(7);
37
- let y;
37
let t0;
38
+ let y;
39
if ($[0] !== props) {
40
const x = [];
41
bb0: switch (props.p0) {
@@ -63,19 +63,19 @@ function Component(props) {
63
64
t0 = <Component data={x} />;
65
$[0] = props;
66
- $[1] = y;
67
- $[2] = t0;
66
+ $[1] = t0;
67
+ $[2] = y;
68
} else {
69
- y = $[1];
70
- t0 = $[2];
69
+ t0 = $[1];
70
+ y = $[2];
71
}
72
const child = t0;
73
y.push(props.p4);
74
let t1;
75
- if ($[4] !== y || $[5] !== child) {
75
+ if ($[4] !== child || $[5] !== y) {
76
t1 = <Component data={y}>{child}</Component>;
77
- $[4] = y;
78
- $[5] = child;
77
+ $[4] = child;
78
+ $[5] = y;
79
$[6] = t1;
80
} else {
81
t1 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md
+8
-8
@@ -29,8 +29,8 @@ function Component(props) {
29
import { c as _c } from "react/compiler-runtime";
30
function Component(props) {
31
const $ = _c(6);
32
- let y;
32
let t0;
33
+ let y;
34
if ($[0] !== props) {
35
const x = [];
36
switch (props.p0) {
@@ -45,19 +45,19 @@ function Component(props) {
45
46
t0 = <Component data={x} />;
47
$[0] = props;
48
- $[1] = y;
49
- $[2] = t0;
48
+ $[1] = t0;
49
+ $[2] = y;
50
} else {
51
- y = $[1];
52
- t0 = $[2];
51
+ t0 = $[1];
52
+ y = $[2];
53
}
54
const child = t0;
55
y.push(props.p4);
56
let t1;
57
- if ($[3] !== y || $[4] !== child) {
57
+ if ($[3] !== child || $[4] !== y) {
58
t1 = <Component data={y}>{child}</Component>;
59
- $[3] = y;
60
- $[4] = child;
59
+ $[3] = child;
60
+ $[4] = y;
61
$[5] = t1;
62
} else {
63
t1 = $[5];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-children.expect.md
+6
-6
@@ -50,7 +50,7 @@ function Component(t0) {
50
const { arr } = t0;
51
const x = useX();
52
let t1;
53
- if ($[0] !== x || $[1] !== arr) {
53
+ if ($[0] !== arr || $[1] !== x) {
54
let t2;
55
if ($[3] !== x) {
56
t2 = (i, id) => (
@@ -64,8 +64,8 @@ function Component(t0) {
64
t2 = $[4];
65
}
66
t1 = arr.map(t2);
67
- $[0] = x;
68
- $[1] = arr;
67
+ $[0] = arr;
68
+ $[1] = x;
69
$[2] = t1;
70
} else {
71
t1 = $[2];
@@ -85,15 +85,15 @@ function Bar(t0) {
85
const $ = _c(3);
86
const { x, children } = t0;
87
let t1;
88
- if ($[0] !== x || $[1] !== children) {
88
+ if ($[0] !== children || $[1] !== x) {
89
t1 = (
90
<>
91
{x}
92
{children}
93
</>
94
);
95
- $[0] = x;
96
- $[1] = children;
95
+ $[0] = children;
96
+ $[1] = x;
97
$[2] = t1;
98
} else {
99
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.jsx-outlining-duplicate-prop.expect.md
+6
-6
@@ -55,7 +55,7 @@ function Component(t0) {
55
const { arr } = t0;
56
const x = useX();
57
let t1;
58
- if ($[0] !== x || $[1] !== arr) {
58
+ if ($[0] !== arr || $[1] !== x) {
59
let t2;
60
if ($[3] !== x) {
61
t2 = (i, id) => (
@@ -70,8 +70,8 @@ function Component(t0) {
70
t2 = $[4];
71
}
72
t1 = arr.map(t2);
73
- $[0] = x;
74
- $[1] = arr;
73
+ $[0] = arr;
74
+ $[1] = x;
75
$[2] = t1;
76
} else {
77
t1 = $[2];
@@ -91,15 +91,15 @@ function Bar(t0) {
91
const $ = _c(3);
92
const { x, children } = t0;
93
let t1;
94
- if ($[0] !== x || $[1] !== children) {
94
+ if ($[0] !== children || $[1] !== x) {
95
t1 = (
96
<>
97
{x}
98
{children}
99
</>
100
);
101
- $[0] = x;
102
- $[1] = children;
101
+ $[0] = children;
102
+ $[1] = x;
103
$[2] = t1;
104
} else {
105
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-array-destructuring.expect.md
+3
-3
@@ -18,10 +18,10 @@ function App() {
18
const $ = _c(3);
19
const [foo, bar] = useContext(MyContext);
20
let t0;
21
- if ($[0] !== foo || $[1] !== bar) {
21
+ if ($[0] !== bar || $[1] !== foo) {
22
t0 = <Bar foo={foo} bar={bar} />;
23
- $[0] = foo;
24
- $[1] = bar;
23
+ $[0] = bar;
24
+ $[1] = foo;
25
$[2] = t0;
26
} else {
27
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-destructure-multiple.expect.md
+3
-3
@@ -22,10 +22,10 @@ function App() {
22
const { foo } = context;
23
const { bar } = context;
24
let t0;
25
- if ($[0] !== foo || $[1] !== bar) {
25
+ if ($[0] !== bar || $[1] !== foo) {
26
t0 = <Bar foo={foo} bar={bar} />;
27
- $[0] = foo;
28
- $[1] = bar;
27
+ $[0] = bar;
28
+ $[1] = foo;
29
$[2] = t0;
30
} else {
31
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-mixed-array-obj.expect.md
+3
-3
@@ -22,10 +22,10 @@ function App() {
22
const [foo] = context;
23
const { bar } = context;
24
let t0;
25
- if ($[0] !== foo || $[1] !== bar) {
25
+ if ($[0] !== bar || $[1] !== foo) {
26
t0 = <Bar foo={foo} bar={bar} />;
27
- $[0] = foo;
28
- $[1] = bar;
27
+ $[0] = bar;
28
+ $[1] = foo;
29
$[2] = t0;
30
} else {
31
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-nested-destructuring.expect.md
+3
-3
@@ -22,10 +22,10 @@ function App() {
22
const { joe: t0, bar } = useContext(MyContext);
23
const { foo } = t0;
24
let t1;
25
- if ($[0] !== foo || $[1] !== bar) {
25
+ if ($[0] !== bar || $[1] !== foo) {
26
t1 = <Bar foo={foo} bar={bar} />;
27
- $[0] = foo;
28
- $[1] = bar;
27
+ $[0] = bar;
28
+ $[1] = foo;
29
$[2] = t1;
30
} else {
31
t1 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.lower-context-access-property-load.expect.md
+3
-3
@@ -22,10 +22,10 @@ function App() {
22
const foo = context.foo;
23
const bar = context.bar;
24
let t0;
25
- if ($[0] !== foo || $[1] !== bar) {
25
+ if ($[0] !== bar || $[1] !== foo) {
26
t0 = <Bar foo={foo} bar={bar} />;
27
- $[0] = foo;
28
- $[1] = bar;
27
+ $[0] = bar;
28
+ $[1] = foo;
29
$[2] = t0;
30
} else {
31
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-in-nested-scope.expect.md
+8
-8
@@ -42,9 +42,9 @@ import { mutate, setProperty, throwErrorWithMessageIf } from "shared-runtime";
42
function useFoo(t0) {
43
const $ = _c(6);
44
const { value, cond } = t0;
45
- let y;
45
let t1;
47
- if ($[0] !== value || $[1] !== cond) {
46
+ let y;
47
+ if ($[0] !== cond || $[1] !== value) {
48
t1 = Symbol.for("react.early_return_sentinel");
49
bb0: {
50
y = [value];
@@ -68,13 +68,13 @@ function useFoo(t0) {
68
}
69
y.push(x);
70
}
71
- $[0] = value;
72
- $[1] = cond;
73
- $[2] = y;
74
- $[3] = t1;
71
+ $[0] = cond;
72
+ $[1] = value;
73
+ $[2] = t1;
74
+ $[3] = y;
75
} else {
76
- y = $[2];
77
- t1 = $[3];
76
+ t1 = $[2];
77
+ y = $[3];
78
}
79
if (t1 !== Symbol.for("react.early_return_sentinel")) {
80
return t1;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch-escaping.expect.md
+3
-3
@@ -33,7 +33,7 @@ const { throwInput } = require("shared-runtime");
33
function Component(props) {
34
const $ = _c(3);
35
let x;
36
- if ($[0] !== props.y || $[1] !== props.e) {
36
+ if ($[0] !== props.e || $[1] !== props.y) {
37
try {
38
const y = [];
39
y.push(props.y);
@@ -43,8 +43,8 @@ function Component(props) {
43
e.push(props.e);
44
x = e;
45
}
46
- $[0] = props.y;
47
- $[1] = props.e;
46
+ $[0] = props.e;
47
+ $[1] = props.y;
48
$[2] = x;
49
} else {
50
x = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-try-value-modified-in-catch.expect.md
+3
-3
@@ -32,7 +32,7 @@ const { throwInput } = require("shared-runtime");
32
function Component(props) {
33
const $ = _c(3);
34
let t0;
35
- if ($[0] !== props.y || $[1] !== props.e) {
35
+ if ($[0] !== props.e || $[1] !== props.y) {
36
t0 = Symbol.for("react.early_return_sentinel");
37
bb0: {
38
try {
@@ -46,8 +46,8 @@ function Component(props) {
46
break bb0;
47
}
48
}
49
- $[0] = props.y;
50
- $[1] = props.e;
49
+ $[0] = props.e;
50
+ $[1] = props.y;
51
$[2] = t0;
52
} else {
53
t0 = $[2];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-catch-param.expect.md
+5
-5
@@ -32,8 +32,8 @@ const { throwInput } = require("shared-runtime");
32
33
function Component(props) {
34
const $ = _c(2);
35
- let x;
35
let t0;
36
+ let x;
37
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
38
t0 = Symbol.for("react.early_return_sentinel");
39
bb0: {
@@ -47,11 +47,11 @@ function Component(props) {
47
break bb0;
48
}
49
}
50
- $[0] = x;
51
- $[1] = t0;
50
+ $[0] = t0;
51
+ $[1] = x;
52
} else {
53
- x = $[0];
54
- t0 = $[1];
53
+ t0 = $[0];
54
+ x = $[1];
55
}
56
if (t0 !== Symbol.for("react.early_return_sentinel")) {
57
return t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-with-return.expect.md
+5
-5
@@ -33,8 +33,8 @@ const { shallowCopy, throwInput } = require("shared-runtime");
33
34
function Component(props) {
35
const $ = _c(2);
36
- let x;
36
let t0;
37
+ let x;
38
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
39
t0 = Symbol.for("react.early_return_sentinel");
40
bb0: {
@@ -52,11 +52,11 @@ function Component(props) {
52
break bb0;
53
}
54
}
55
- $[0] = x;
56
- $[1] = t0;
55
+ $[0] = t0;
56
+ $[1] = x;
57
} else {
58
- x = $[0];
59
- t0 = $[1];
58
+ t0 = $[0];
59
+ x = $[1];
60
}
61
if (t0 !== Symbol.for("react.early_return_sentinel")) {
62
return t0;
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log-default-import.expect.md
+6
-6
@@ -78,10 +78,10 @@ export function Component(t0) {
78
t5 = $[5];
79
}
80
let t6;
81
- if ($[6] !== t5 || $[7] !== item1) {
81
+ if ($[6] !== item1 || $[7] !== t5) {
82
t6 = <ValidateMemoization inputs={t5} output={item1} />;
83
- $[6] = t5;
84
- $[7] = item1;
83
+ $[6] = item1;
84
+ $[7] = t5;
85
$[8] = t6;
86
} else {
87
t6 = $[8];
@@ -95,10 +95,10 @@ export function Component(t0) {
95
t7 = $[10];
96
}
97
let t8;
98
- if ($[11] !== t7 || $[12] !== item2) {
98
+ if ($[11] !== item2 || $[12] !== t7) {
99
t8 = <ValidateMemoization inputs={t7} output={item2} />;
100
- $[11] = t7;
101
- $[12] = item2;
100
+ $[11] = item2;
101
+ $[12] = t7;
102
$[13] = t8;
103
} else {
104
t8 = $[13];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-log.expect.md
+6
-6
@@ -76,10 +76,10 @@ export function Component(t0) {
76
t5 = $[5];
77
}
78
let t6;
79
- if ($[6] !== t5 || $[7] !== item1) {
79
+ if ($[6] !== item1 || $[7] !== t5) {
80
t6 = <ValidateMemoization inputs={t5} output={item1} />;
81
- $[6] = t5;
82
- $[7] = item1;
81
+ $[6] = item1;
82
+ $[7] = t5;
83
$[8] = t6;
84
} else {
85
t6 = $[8];
@@ -93,10 +93,10 @@ export function Component(t0) {
93
t7 = $[10];
94
}
95
let t8;
96
- if ($[11] !== t7 || $[12] !== item2) {
96
+ if ($[11] !== item2 || $[12] !== t7) {
97
t8 = <ValidateMemoization inputs={t7} output={item2} />;
98
- $[11] = t7;
99
- $[12] = item2;
98
+ $[11] = item2;
99
+ $[12] = t7;
100
$[13] = t8;
101
} else {
102
t8 = $[13];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture-namespace-import.expect.md
+10
-10
@@ -114,10 +114,10 @@ export function Component(t0) {
114
}
115
const t10 = items_0[1];
116
let t11;
117
- if ($[14] !== t9 || $[15] !== t10) {
117
+ if ($[14] !== t10 || $[15] !== t9) {
118
t11 = <SharedRuntime.ValidateMemoization inputs={t9} output={t10} />;
119
- $[14] = t9;
120
- $[15] = t10;
119
+ $[14] = t10;
120
+ $[15] = t9;
121
$[16] = t11;
122
} else {
123
t11 = $[16];
@@ -132,16 +132,16 @@ export function Component(t0) {
132
t12 = $[19];
133
}
134
let t13;
135
- if ($[20] !== t12 || $[21] !== items_0) {
135
+ if ($[20] !== items_0 || $[21] !== t12) {
136
t13 = <SharedRuntime.ValidateMemoization inputs={t12} output={items_0} />;
137
- $[20] = t12;
138
- $[21] = items_0;
137
+ $[20] = items_0;
138
+ $[21] = t12;
139
$[22] = t13;
140
} else {
141
t13 = $[22];
142
}
143
let t14;
144
- if ($[23] !== t8 || $[24] !== t11 || $[25] !== t13) {
144
+ if ($[23] !== t11 || $[24] !== t13 || $[25] !== t8) {
145
t14 = (
146
<>
147
{t8}
@@ -149,9 +149,9 @@ export function Component(t0) {
149
{t13}
150
</>
151
);
152
- $[23] = t8;
153
- $[24] = t11;
154
- $[25] = t13;
152
+ $[23] = t11;
153
+ $[24] = t13;
154
+ $[25] = t8;
155
$[26] = t14;
156
} else {
157
t14 = $[26];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-provider-store-capture.expect.md
+10
-10
@@ -114,10 +114,10 @@ export function Component(t0) {
114
}
115
const t10 = items_0[1];
116
let t11;
117
- if ($[14] !== t9 || $[15] !== t10) {
117
+ if ($[14] !== t10 || $[15] !== t9) {
118
t11 = <ValidateMemoization inputs={t9} output={t10} />;
119
- $[14] = t9;
120
- $[15] = t10;
119
+ $[14] = t10;
120
+ $[15] = t9;
121
$[16] = t11;
122
} else {
123
t11 = $[16];
@@ -132,16 +132,16 @@ export function Component(t0) {
132
t12 = $[19];
133
}
134
let t13;
135
- if ($[20] !== t12 || $[21] !== items_0) {
135
+ if ($[20] !== items_0 || $[21] !== t12) {
136
t13 = <ValidateMemoization inputs={t12} output={items_0} />;
137
- $[20] = t12;
138
- $[21] = items_0;
137
+ $[20] = items_0;
138
+ $[21] = t12;
139
$[22] = t13;
140
} else {
141
t13 = $[22];
142
}
143
let t14;
144
- if ($[23] !== t8 || $[24] !== t11 || $[25] !== t13) {
144
+ if ($[23] !== t11 || $[24] !== t13 || $[25] !== t8) {
145
t14 = (
146
<>
147
{t8}
@@ -149,9 +149,9 @@ export function Component(t0) {
149
{t13}
150
</>
151
);
152
- $[23] = t8;
153
- $[24] = t11;
154
- $[25] = t13;
152
+ $[23] = t11;
153
+ $[24] = t13;
154
+ $[25] = t8;
155
$[26] = t14;
156
} else {
157
t14 = $[26];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/unary-expr.expect.md
+12
-12
@@ -38,22 +38,22 @@ function component(a) {
38
const f = typeof t.t;
39
let t0;
40
if (
41
- $[0] !== z ||
42
- $[1] !== p ||
43
- $[2] !== q ||
41
+ $[0] !== e ||
42
+ $[1] !== f ||
43
+ $[2] !== m ||
44
$[3] !== n ||
45
- $[4] !== m ||
46
- $[5] !== e ||
47
- $[6] !== f
45
+ $[4] !== p ||
46
+ $[5] !== q ||
47
+ $[6] !== z
48
) {
49
t0 = { z, p, q, n, m, e, f };
50
- $[0] = z;
51
- $[1] = p;
52
- $[2] = q;
50
+ $[0] = e;
51
+ $[1] = f;
52
+ $[2] = m;
53
$[3] = n;
54
- $[4] = m;
55
- $[5] = e;
56
- $[6] = f;
54
+ $[4] = p;
55
+ $[5] = q;
56
+ $[6] = z;
57
$[7] = t0;
58
} else {
59
t0 = $[7];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-call-expression.expect.md
+3
-3
@@ -89,10 +89,10 @@ function Inner(props) {
89
t2 = $[3];
90
}
91
let t3;
92
- if ($[4] !== t2 || $[5] !== output) {
92
+ if ($[4] !== output || $[5] !== t2) {
93
t3 = <ValidateMemoization inputs={t2} output={output} />;
94
- $[4] = t2;
95
- $[5] = output;
94
+ $[4] = output;
95
+ $[5] = t2;
96
$[6] = t3;
97
} else {
98
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-conditional.expect.md
+3
-3
@@ -109,10 +109,10 @@ function Inner(props) {
109
t4 = $[3];
110
}
111
let t5;
112
- if ($[4] !== t4 || $[5] !== output) {
112
+ if ($[4] !== output || $[5] !== t4) {
113
t5 = <ValidateMemoization inputs={t4} output={output} />;
114
- $[4] = t4;
115
- $[5] = output;
114
+ $[4] = output;
115
+ $[5] = t4;
116
$[6] = t5;
117
} else {
118
t5 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/use-operator-method-call.expect.md
+3
-3
@@ -91,10 +91,10 @@ function Inner(props) {
91
t2 = $[3];
92
}
93
let t3;
94
- if ($[4] !== t2 || $[5] !== output) {
94
+ if ($[4] !== output || $[5] !== t2) {
95
t3 = <ValidateMemoization inputs={t2} output={output} />;
96
- $[4] = t2;
97
- $[5] = output;
96
+ $[4] = output;
97
+ $[5] = t2;
98
$[6] = t3;
99
} else {
100
t3 = $[6];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md
+3
-3
@@ -51,7 +51,7 @@ function Component(props) {
51
}
52
const exit = t0;
53
let t1;
54
- if ($[2] !== item.value || $[3] !== exit) {
54
+ if ($[2] !== exit || $[3] !== item.value) {
55
t1 = () => {
56
const cleanup = GlobalEventEmitter.addListener("onInput", () => {
57
if (item.value) {
@@ -60,8 +60,8 @@ function Component(props) {
60
});
61
return () => cleanup.remove();
62
};
63
- $[2] = item.value;
64
- $[3] = exit;
63
+ $[2] = exit;
64
+ $[3] = item.value;
65
$[4] = t1;
66
} else {
67
t1 = $[4];
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useState-unpruned-dependency.expect.md
+3
-3
@@ -62,13 +62,13 @@ function Component(props) {
62
{w}
63
</div>
64
);
65
- let condition = $[2] !== x || $[3] !== w;
65
+ let condition = $[2] !== w || $[3] !== x;
66
if (!condition) {
67
let old$t1 = $[4];
68
$structuralCheck(old$t1, t1, "t1", "Component", "cached", "(7:10)");
69
}
70
- $[2] = x;
71
- $[3] = w;
70
+ $[2] = w;
71
+ $[3] = x;
72
$[4] = t1;
73
if (condition) {
74
t1 = (