Move remaining promotion of temporaries out of codegen

I realized that codegen still had a fallback for generating identifier nodes for 
unnamed temporaries. This PR updates codegen to throw if it needs to generate an 
identifier for a temporary, and updates earlier passes to promote temporaries to 
named values in all the cases that were missed: 

* BuildHIR needs to promote temporaries for temporaries in destructuring 
bindings and catch clause bindings 

* PromoteUsedTemporaries has to promote temporaries for destructured function 
parameters or function params that are context variables.
This commit is contained in:
Joe Savona
2024-03-06 11:07:09 -08:00
parent 31e128a441
commit 99b9da4b00
76 changed files with 636 additions and 594 deletions
@@ -44,6 +44,7 @@ import {
Type,
makeInstructionId,
makeType,
promoteTemporaryToNamedIdentifier,
} from "./HIR";
import HIRBuilder, { Bindings } from "./HIRBuilder";
import { BuiltInArrayId } from "./ObjectShape";
@@ -1215,6 +1216,7 @@ function lowerStatement(
reactive: false,
loc: handlerBindingPath.node.loc ?? GeneratedSource,
};
promoteTemporaryToNamedIdentifier(place.identifier);
lowerValueToTemporary(builder, {
kind: "DeclareLocal",
lvalue: {
@@ -3420,6 +3422,7 @@ function lowerAssignment(
builder,
element.node.loc ?? GeneratedSource
);
promoteTemporaryToNamedIdentifier(temp.identifier);
items.push({
kind: "Spread",
place: { ...temp },
@@ -3447,6 +3450,7 @@ function lowerAssignment(
builder,
element.node.loc ?? GeneratedSource
);
promoteTemporaryToNamedIdentifier(temp.identifier);
items.push({ ...temp });
followups.push({ place: temp, path: element as NodePath<t.LVal> }); // TODO remove type cast
}
@@ -3517,6 +3521,7 @@ function lowerAssignment(
builder,
property.node.loc ?? GeneratedSource
);
promoteTemporaryToNamedIdentifier(temp.identifier);
properties.push({
kind: "Spread",
place: { ...temp },
@@ -3597,6 +3602,7 @@ function lowerAssignment(
builder,
element.node.loc ?? GeneratedSource
);
promoteTemporaryToNamedIdentifier(temp.identifier);
properties.push({
kind: "ObjectProperty",
type: "property",
@@ -2013,5 +2013,10 @@ function convertIdentifier(identifier: Identifier): t.Identifier {
if (identifier.name !== null) {
return t.identifier(identifier.name.value);
}
return t.identifier(`t${identifier.id}`);
CompilerError.invariant(false, {
reason: `Expected temporaries to be promoted to named identifiers in an earlier pass`,
loc: GeneratedSource,
description: `identifier ${identifier.id} is unnamed`,
suggestions: null,
});
}
@@ -11,8 +11,8 @@ import {
Identifier,
IdentifierId,
InstructionId,
Place,
ReactiveFunction,
ReactiveInstruction,
ReactiveScopeBlock,
ReactiveValue,
promoteTemporaryJsxTagToNamedIdentifier,
@@ -45,11 +45,36 @@ class Visitor extends ReactiveFunctionVisitor<VisitorState> {
}
}
}
override visitInstruction(
instruction: ReactiveInstruction,
override visitValue(
id: InstructionId,
value: ReactiveValue,
state: VisitorState
): void {
this.traverseInstruction(instruction, state);
this.traverseValue(id, value, state);
if (value.kind === "FunctionExpression" || value.kind === "ObjectMethod") {
for (const operand of value.loweredFunc.func.params) {
const place = operand.kind === "Identifier" ? operand : operand.place;
if (place.identifier.name === null) {
promoteTemporary(place.identifier, state);
}
}
}
}
override visitReactiveFunctionValue(
_id: InstructionId,
_dependencies: Place[],
fn: ReactiveFunction,
state: VisitorState
): void {
for (const operand of fn.params) {
const place = operand.kind === "Identifier" ? operand : operand.place;
if (place.identifier.name === null) {
promoteTemporary(place.identifier, state);
}
}
visitReactiveFunction(fn, this, state);
}
}
@@ -73,6 +98,12 @@ export function promoteUsedTemporaries(fn: ReactiveFunction): void {
const state: VisitorState = {
tags,
};
for (const operand of fn.params) {
const place = operand.kind === "Identifier" ? operand : operand.place;
if (place.identifier.name === null) {
promoteTemporary(place.identifier, state);
}
}
visitReactiveFunction(fn, new Visitor(), state);
}
@@ -20,37 +20,37 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function component(t16) {
function component(t0) {
const $ = useMemoCache(7);
const [a, b] = t16;
let t0;
if ($[0] !== a) {
t0 = { a };
$[0] = a;
$[1] = t0;
} else {
t0 = $[1];
}
const y = t0;
const [a, b] = t0;
let t1;
if ($[2] !== b) {
t1 = { b };
$[2] = b;
$[3] = t1;
if ($[0] !== a) {
t1 = { a };
$[0] = a;
$[1] = t1;
} else {
t1 = $[3];
t1 = $[1];
}
const z = t1;
const y = t1;
let t2;
if ($[2] !== b) {
t2 = { b };
$[2] = b;
$[3] = t2;
} else {
t2 = $[3];
}
const z = t2;
let t3;
if ($[4] !== y || $[5] !== z) {
t2 = [y, z];
t3 = [y, z];
$[4] = y;
$[5] = z;
$[6] = t2;
$[6] = t3;
} else {
t2 = $[6];
t3 = $[6];
}
return t2;
return t3;
}
export const FIXTURE_ENTRYPOINT = {
@@ -24,22 +24,22 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function App(t25) {
function App(t0) {
const $ = useMemoCache(2);
const { text, hasDeps } = t25;
const { text, hasDeps } = t0;
hasDeps ? null : [text];
let t0;
let t1;
let t2;
if ($[0] !== text) {
t1 = text.toUpperCase();
t2 = text.toUpperCase();
$[0] = text;
$[1] = t1;
$[1] = t2;
} else {
t1 = $[1];
t2 = $[1];
}
t0 = t1;
const resolvedText = t0;
t1 = t2;
const resolvedText = t1;
return resolvedText;
}
@@ -20,41 +20,41 @@ function component({ mutator }) {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function component(t26) {
function component(t0) {
const $ = useMemoCache(7);
const { mutator } = t26;
let t0;
const { mutator } = t0;
let t1;
if ($[0] !== mutator) {
t0 = () => {
t1 = () => {
mutator.poke();
};
$[0] = mutator;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
const poke = t0;
let t1;
const poke = t1;
let t2;
if ($[2] !== mutator.user) {
t1 = () => {
t2 = () => {
mutator.user.hide();
};
$[2] = mutator.user;
$[3] = t1;
$[3] = t2;
} else {
t1 = $[3];
t2 = $[3];
}
const hide = t1;
let t2;
const hide = t2;
let t3;
if ($[4] !== poke || $[5] !== hide) {
t2 = <Foo poke={poke} hide={hide} />;
t3 = <Foo poke={poke} hide={hide} />;
$[4] = poke;
$[5] = hide;
$[6] = t2;
$[6] = t3;
} else {
t2 = $[6];
t3 = $[6];
}
return t2;
return t3;
}
```
@@ -14,18 +14,18 @@ function shouldNotCompile() {}
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
export default function Foo(t7) {
export default function Foo(t0) {
const $ = useMemoCache(2);
const { bar } = t7;
let t0;
const { bar } = t0;
let t1;
if ($[0] !== bar) {
t0 = <Bar bar={bar} />;
t1 = <Bar bar={bar} />;
$[0] = bar;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
function shouldNotCompile() {}
@@ -29,9 +29,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { invoke } from "shared-runtime";
function Component(t21) {
function Component(t0) {
const $ = useMemoCache(2);
const { shouldReassign } = t21;
const { shouldReassign } = t0;
let x;
if ($[0] !== shouldReassign) {
x = null;
@@ -33,9 +33,9 @@ import { conditionalInvoke } from "shared-runtime";
// same as context-variable-reactive-explicit-control-flow.js, but make
// the control flow implicit
function Component(t20) {
function Component(t0) {
const $ = useMemoCache(2);
const { shouldReassign } = t20;
const { shouldReassign } = t0;
let x;
if ($[0] !== shouldReassign) {
x = null;
@@ -30,9 +30,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { invoke } from "shared-runtime";
function Component(t24) {
function Component(t0) {
const $ = useMemoCache(2);
const { cond } = t24;
const { cond } = t0;
let x;
if ($[0] !== cond) {
x = 2;
@@ -27,9 +27,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { invoke } from "shared-runtime";
function Component(t20) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t20;
const { value } = t0;
let x;
if ($[0] !== value) {
x = null;
@@ -35,9 +35,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { conditionalInvoke } from "shared-runtime";
function Component(t32) {
function Component(t0) {
const $ = useMemoCache(3);
const { doReassign1, doReassign2 } = t32;
const { doReassign1, doReassign2 } = t0;
let x;
if ($[0] !== doReassign1 || $[1] !== doReassign2) {
x = {};
@@ -31,8 +31,8 @@ function Component(props) {
const $ = useMemoCache(4);
let x;
if ($[0] !== props.value) {
const [t31] = props.value;
x = t31;
const [t0] = props.value;
x = t0;
const foo = () => {
x = identity(props.value[0]);
};
@@ -31,8 +31,8 @@ function Component(props) {
const $ = useMemoCache(4);
let x;
if ($[0] !== props) {
const { x: t27 } = props;
x = t27;
const { x: t0 } = props;
x = t0;
const foo = () => {
x = identity(props.x);
};
@@ -17,8 +17,8 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
function foo(t5) {
const { "data-foo-bar": dataTestID } = t5;
function foo(t0) {
const { "data-foo-bar": dataTestID } = t0;
return dataTestID;
}
@@ -17,8 +17,8 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
function foo(t5) {
const { data: dataTestID } = t5;
function foo(t0) {
const { data: dataTestID } = t0;
return dataTestID;
}
@@ -17,9 +17,9 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
function Component(t13) {
const [t14] = t13;
const a = t14 === undefined ? 2 : t14;
function Component(t0) {
const [t1] = t0;
const a = t1 === undefined ? 2 : t1;
return a;
}
@@ -39,28 +39,28 @@ function foo(a, b, c) {
let g;
let n;
let o;
const [t49, t50] = a;
d = t49;
const [t54] = t50;
const { e: t56 } = t54;
({ f: g } = t56);
const { l: t61, o: t62 } = b;
const { m: t64 } = t61;
const [t66] = t64;
[n] = t66;
o = t62;
let t0;
const [t0, t1] = a;
d = t0;
const [t2] = t1;
const { e: t3 } = t2;
({ f: g } = t3);
const { l: t4, o: t5 } = b;
const { m: t6 } = t4;
const [t7] = t6;
[n] = t7;
o = t5;
let t8;
if ($[0] !== d || $[1] !== g || $[2] !== n || $[3] !== o) {
t0 = { d, g, n, o };
t8 = { d, g, n, o };
$[0] = d;
$[1] = g;
$[2] = n;
$[3] = o;
$[4] = t0;
$[4] = t8;
} else {
t0 = $[4];
t8 = $[4];
}
return t0;
return t8;
}
export const FIXTURE_ENTRYPOINT = {
@@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
function Component(props) {
const [t18] = props.value;
const x = t18 === undefined ? 42 : t18;
const [t0] = props.value;
const x = t0 === undefined ? 42 : t0;
return x;
}
@@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
function Component(props) {
const [t18] = props.value;
const x = t18 === undefined ? 42 : t18;
const [t0] = props.value;
const x = t0 === undefined ? 42 : t0;
return x;
}
@@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
function Component(props) {
const [t18] = props.value;
const x = t18 === undefined ? 42 : t18;
const [t0] = props.value;
const x = t0 === undefined ? 42 : t0;
return x;
}
@@ -19,8 +19,8 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
function Component(props) {
const [t18] = props.value;
const x = t18 === undefined ? 42 : t18;
const [t0] = props.value;
const x = t0 === undefined ? 42 : t0;
return x;
}
@@ -17,9 +17,9 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
function Component(t13) {
const { a: t14 } = t13;
const a = t14 === undefined ? 2 : t14;
function Component(t0) {
const { a: t1 } = t0;
const a = t1 === undefined ? 2 : t1;
return a;
}
@@ -29,27 +29,27 @@ import { identity } from "shared-runtime";
function Component(props) {
const $ = useMemoCache(5);
const { x: t18, sameName: renamed } = props;
const { destructured } = t18;
let t0;
if ($[0] !== destructured) {
t0 = identity(destructured);
$[0] = destructured;
$[1] = t0;
} else {
t0 = $[1];
}
const sameName = t0;
const { x: t0, sameName: renamed } = props;
const { destructured } = t0;
let t1;
if ($[0] !== destructured) {
t1 = identity(destructured);
$[0] = destructured;
$[1] = t1;
} else {
t1 = $[1];
}
const sameName = t1;
let t2;
if ($[2] !== sameName || $[3] !== renamed) {
t1 = [sameName, renamed];
t2 = [sameName, renamed];
$[2] = sameName;
$[3] = renamed;
$[4] = t1;
$[4] = t2;
} else {
t1 = $[4];
t2 = $[4];
}
return t1;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -18,8 +18,8 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
function Component(props) {
const [t23] = props.y;
const x = t23 === undefined ? (true ? 1 : 0) : t23;
const [t0] = props.y;
const x = t0 === undefined ? (true ? 1 : 0) : t0;
return x;
}
@@ -63,21 +63,21 @@ function foo(a, b, c) {
g = $[6];
}
const { f } = t2;
const { l: t51, p } = b;
const { m: t3 } = t51;
let t4;
const { l: t3, p } = b;
const { m: t4 } = t3;
let t5;
let o;
if ($[7] !== t3) {
[t4, ...o] = t3;
$[7] = t3;
$[8] = t4;
if ($[7] !== t4) {
[t5, ...o] = t4;
$[7] = t4;
$[8] = t5;
$[9] = o;
} else {
t4 = $[8];
t5 = $[8];
o = $[9];
}
const [n] = t4;
let t5;
const [n] = t5;
let t6;
if (
$[10] !== d ||
$[11] !== f ||
@@ -87,7 +87,7 @@ function foo(a, b, c) {
$[15] !== o ||
$[16] !== p
) {
t5 = [d, f, g, h, n, o, p];
t6 = [d, f, g, h, n, o, p];
$[10] = d;
$[11] = f;
$[12] = g;
@@ -95,11 +95,11 @@ function foo(a, b, c) {
$[14] = n;
$[15] = o;
$[16] = p;
$[17] = t5;
$[17] = t6;
} else {
t5 = $[17];
t6 = $[17];
}
return t5;
return t6;
}
export const FIXTURE_ENTRYPOINT = {
@@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
const _ = fbt;
function Component(t12) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t12;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = fbt._(
t1 = fbt._(
"Before text{paramName}After text",
[fbt._param("paramName", value)],
{ hk: "aKEGX" }
);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -28,12 +28,12 @@ import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
const _ = fbt;
function Component(t12) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t12;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = fbt._(
t1 = fbt._(
"Before text {paramName}",
[
fbt._param(
@@ -45,11 +45,11 @@ function Component(t12) {
{ hk: "3z5SVE" }
);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
const _ = fbt;
function Component(t12) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t12;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = fbt._(
t1 = fbt._(
"Before text {paramName} after text",
[fbt._param("paramName", value)],
{ hk: "26pxNm" }
);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -27,22 +27,22 @@ import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
const _ = fbt;
function Component(t14) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t14;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = fbt._(
t1 = fbt._(
"Before text {paramName} after text",
[fbt._param("paramName", value)],
{ hk: "26pxNm" }
);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -29,22 +29,22 @@ import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
const _ = fbt;
function Component(t12) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t12;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = fbt._(
t1 = fbt._(
"Before text {paramName} after text more text and more and more and more and more and more and more and more and more and blah blah blah blah",
[fbt._param("paramName", value)],
{ hk: "24ZPpO" }
);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -28,12 +28,12 @@ function Component({ name, data, icon }) {
import { unstable_useMemoCache as useMemoCache } from "react";
import fbt from "fbt";
function Component(t33) {
function Component(t0) {
const $ = useMemoCache(4);
const { name, data, icon } = t33;
let t0;
const { name, data, icon } = t0;
let t1;
if ($[0] !== name || $[1] !== icon || $[2] !== data) {
t0 = (
t1 = (
<Text type="body4">
{fbt._(
"{item author}{icon}{=m2}",
@@ -64,11 +64,11 @@ function Component(t33) {
$[0] = name;
$[1] = icon;
$[2] = data;
$[3] = t0;
$[3] = t1;
} else {
t0 = $[3];
t1 = $[3];
}
return t0;
return t1;
}
```
@@ -53,49 +53,49 @@ import {
} from "shared-runtime";
const MyContext = createContext("my context value");
function Component(t47) {
function Component(t0) {
const $ = useMemoCache(4);
try {
$dispatcherGuard(0);
const { value } = t47;
const { value } = t0;
print(identity(CONST_STRING0));
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = getNumber();
$[0] = t0;
t1 = getNumber();
$[0] = t1;
} else {
t0 = $[0];
t1 = $[0];
}
const [state, setState] = (function () {
try {
$dispatcherGuard(2);
return useState(t0);
return useState(t1);
} finally {
$dispatcherGuard(3);
}
})();
print(value, state);
let t1;
let t2;
let t3;
if ($[1] !== state) {
t1 = () => {
t2 = () => {
if (state === 4) {
setState(5);
}
};
t2 = [state];
t3 = [state];
$[1] = state;
$[2] = t1;
$[3] = t2;
$[2] = t2;
$[3] = t3;
} else {
t1 = $[2];
t2 = $[3];
t2 = $[2];
t3 = $[3];
}
(function () {
try {
$dispatcherGuard(2);
return useEffect(t1, t2);
return useEffect(t2, t3);
} finally {
$dispatcherGuard(3);
}
@@ -18,28 +18,28 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t23, t0) {
function Component(t0, t1) {
const $ = useMemoCache(5);
const x = t23 === undefined ? "default" : t23;
let t1;
if ($[0] !== t0) {
t1 = t0 === undefined ? [{}] : t0;
$[0] = t0;
$[1] = t1;
} else {
t1 = $[1];
}
const y = t1;
const x = t0 === undefined ? "default" : t0;
let t2;
if ($[0] !== t1) {
t2 = t1 === undefined ? [{}] : t1;
$[0] = t1;
$[1] = t2;
} else {
t2 = $[1];
}
const y = t2;
let t3;
if ($[2] !== x || $[3] !== y) {
t2 = [x, y];
t3 = [x, y];
$[2] = x;
$[3] = y;
$[4] = t2;
$[4] = t3;
} else {
t2 = $[4];
t3 = $[4];
}
return t2;
return t3;
}
export const FIXTURE_ENTRYPOINT = {
@@ -26,11 +26,11 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Foo(t32) {
function Foo(t0) {
const $ = useMemoCache(2);
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = (val) => {
t1 = (val) => {
const fact = (x) => {
if (x <= 0) {
return 1;
@@ -39,19 +39,19 @@ function Foo(t32) {
};
return fact(val);
};
$[0] = t0;
$[0] = t1;
} else {
t0 = $[0];
t1 = $[0];
}
const outer = t0;
let t1;
const outer = t1;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = outer(3);
$[1] = t1;
t2 = outer(3);
$[1] = t2;
} else {
t1 = $[1];
t2 = $[1];
}
return t1;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -25,10 +25,10 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Foo(t25) {
function Foo(t0) {
const $ = useMemoCache(2);
const { value } = t25;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
const factorial = (x) => {
if (x <= 1) {
@@ -38,13 +38,13 @@ function Foo(t25) {
}
};
t0 = factorial(value);
t1 = factorial(value);
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -24,29 +24,29 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t22) {
function Component(t0) {
const $ = useMemoCache(2);
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
t1 = () => {
const inner = () => x;
const x = 3;
return inner();
};
$[0] = t0;
$[0] = t1;
} else {
t0 = $[0];
t1 = $[0];
}
const outer = t0;
let t1;
const outer = t1;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = <div>{outer()}</div>;
$[1] = t1;
t2 = <div>{outer()}</div>;
$[1] = t2;
} else {
t1 = $[1];
t2 = $[1];
}
return t1;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -20,17 +20,17 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @compilationMode(infer)
function Foo(t6, ref) {
function Foo(t0, ref) {
const $ = useMemoCache(2);
let t0;
let t1;
if ($[0] !== ref) {
t0 = <div ref={ref} />;
t1 = <div ref={ref} />;
$[0] = ref;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -43,12 +43,12 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t27) {
function Component(t0) {
const $ = useMemoCache(2);
const { items } = t27;
let t0;
const { items } = t0;
let t1;
if ($[0] !== items) {
t0 =
t1 =
items.length > 0 ? (
<Foo
value={
@@ -61,44 +61,44 @@ function Component(t27) {
/>
) : null;
$[0] = items;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
function Foo(t5) {
const { value } = t5;
function Foo(t0) {
const { value } = t0;
return value;
}
function Bar(t6) {
function Bar(t0) {
const $ = useMemoCache(2);
const { children } = t6;
let t0;
const { children } = t0;
let t1;
if ($[0] !== children) {
t0 = <div>{children}</div>;
t1 = <div>{children}</div>;
$[0] = children;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
function Item(t7) {
function Item(t0) {
const $ = useMemoCache(2);
const { item } = t7;
let t0;
const { item } = t0;
let t1;
if ($[0] !== item.name) {
t0 = <div>{item.name}</div>;
t1 = <div>{item.name}</div>;
$[0] = item.name;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -34,12 +34,12 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { Stringify } from "shared-runtime";
function Component(t26) {
function Component(t0) {
const $ = useMemoCache(2);
const { items } = t26;
let t0;
const { items } = t0;
let t1;
if ($[0] !== items) {
t0 =
t1 =
items.length > 0 ? (
<Foo
value={
@@ -52,25 +52,25 @@ function Component(t26) {
/>
) : null;
$[0] = items;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
function Foo(t6) {
function Foo(t0) {
const $ = useMemoCache(2);
const { value } = t6;
let t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t0 = <div>{value}</div>;
t1 = <div>{value}</div>;
$[0] = value;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -24,19 +24,19 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import * as SharedRuntime from "shared-runtime";
function useFoo(t12) {
function useFoo(t0) {
const $ = useMemoCache(1);
const { cond } = t12;
const { cond } = t0;
const MyLocal = SharedRuntime;
if (cond) {
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <MyLocal.Text value={4} />;
$[0] = t0;
t1 = <MyLocal.Text value={4} />;
$[0] = t1;
} else {
t0 = $[0];
t1 = $[0];
}
return t0;
return t1;
} else {
return null;
}
@@ -26,20 +26,20 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import * as sharedRuntime from "shared-runtime";
function Component(t13) {
function Component(t0) {
const $ = useMemoCache(2);
const { something } = t13;
const { something } = t0;
const Foo = something.StaticText1;
let t0;
let t1;
if ($[0] !== Foo) {
t0 = () => <Foo />;
t1 = () => <Foo />;
$[0] = Foo;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -62,8 +62,8 @@ function Component(props) {
return t2;
}
function Foo(t5) {
const { children } = t5;
function Foo(t0) {
const { children } = t0;
return children;
}
@@ -28,8 +28,8 @@ function Foo() {
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = function a(t28) {
const x_0 = t28 === undefined ? () => {} : t28;
t1 = function a(t0) {
const x_0 = t0 === undefined ? () => {} : t0;
return x_0;
};
$[0] = t1;
@@ -36,8 +36,8 @@ import {
CONST_STRING1,
} from "shared-runtime";
function useHook(t18) {
const { value } = t18;
function useHook(t0) {
const { value } = t0;
return {
getValue() {
return identity(value);
@@ -27,12 +27,12 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { identity, createHookWrapper } from "shared-runtime";
function useHook(t17) {
function useHook(t0) {
const $ = useMemoCache(3);
const { isCond, value } = t17;
let t0;
const { isCond, value } = t0;
let t1;
if ($[0] !== isCond || $[1] !== value) {
t0 = isCond
t1 = isCond
? identity({
getValue() {
return value;
@@ -41,11 +41,11 @@ function useHook(t17) {
: 42;
$[0] = isCond;
$[1] = value;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -27,12 +27,12 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper } from "shared-runtime";
function useHook(t15) {
function useHook(t0) {
const $ = useMemoCache(3);
const { isCond, value } = t15;
let t0;
const { isCond, value } = t0;
let t1;
if ($[0] !== isCond || $[1] !== value) {
t0 = isCond
t1 = isCond
? {
getValue() {
return value;
@@ -41,11 +41,11 @@ function useHook(t15) {
: 42;
$[0] = isCond;
$[1] = value;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -34,8 +34,8 @@ import {
CONST_STRING1,
} from "shared-runtime";
function useHook(t16) {
const { value } = t16;
function useHook(t0) {
const { value } = t0;
return {
getValue() {
return identity(value);
@@ -26,9 +26,9 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper, mutate, mutateAndReturn } from "shared-runtime";
function useHook(t21) {
function useHook(t0) {
const $ = useMemoCache(2);
const { value } = t21;
const { value } = t0;
let obj;
if ($[0] !== value) {
const x = mutateAndReturn({ value });
@@ -25,31 +25,31 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper, mutateAndReturn } from "shared-runtime";
function useHook(t18) {
function useHook(t0) {
const $ = useMemoCache(4);
const { value } = t18;
let t0;
if ($[0] !== value) {
t0 = mutateAndReturn({ value });
$[0] = value;
$[1] = t0;
} else {
t0 = $[1];
}
const x = t0;
const { value } = t0;
let t1;
if ($[0] !== value) {
t1 = mutateAndReturn({ value });
$[0] = value;
$[1] = t1;
} else {
t1 = $[1];
}
const x = t1;
let t2;
if ($[2] !== x) {
t1 = {
t2 = {
getValue() {
return x;
},
};
$[2] = x;
$[3] = t1;
$[3] = t2;
} else {
t1 = $[3];
t2 = $[3];
}
const obj = t1;
const obj = t2;
return obj;
}
@@ -26,9 +26,9 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper, mutate, mutateAndReturn } from "shared-runtime";
function useHook(t21) {
function useHook(t0) {
const $ = useMemoCache(2);
const { value } = t21;
const { value } = t0;
let obj;
if ($[0] !== value) {
const x = mutateAndReturn({ value });
@@ -20,37 +20,37 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function component(t16) {
function component(t0) {
const $ = useMemoCache(7);
const { a, b } = t16;
let t0;
if ($[0] !== a) {
t0 = { a };
$[0] = a;
$[1] = t0;
} else {
t0 = $[1];
}
const y = t0;
const { a, b } = t0;
let t1;
if ($[2] !== b) {
t1 = { b };
$[2] = b;
$[3] = t1;
if ($[0] !== a) {
t1 = { a };
$[0] = a;
$[1] = t1;
} else {
t1 = $[3];
t1 = $[1];
}
const z = t1;
const y = t1;
let t2;
if ($[2] !== b) {
t2 = { b };
$[2] = b;
$[3] = t2;
} else {
t2 = $[3];
}
const z = t2;
let t3;
if ($[4] !== y || $[5] !== z) {
t2 = { y, z };
t3 = { y, z };
$[4] = y;
$[5] = z;
$[6] = t2;
$[6] = t3;
} else {
t2 = $[6];
t3 = $[6];
}
return t2;
return t3;
}
export const FIXTURE_ENTRYPOINT = {
@@ -26,34 +26,34 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper } from "shared-runtime";
function useHook(t16) {
function useHook(t0) {
const $ = useMemoCache(5);
const { a, b } = t16;
let t0;
const { a, b } = t0;
let t1;
if ($[0] !== a) {
t0 = function () {
t1 = function () {
return [a];
};
$[0] = a;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
let t1;
if ($[2] !== b || $[3] !== t0) {
t1 = {
x: t0,
let t2;
if ($[2] !== b || $[3] !== t1) {
t2 = {
x: t1,
y() {
return [b];
},
};
$[2] = b;
$[3] = t0;
$[4] = t1;
$[3] = t1;
$[4] = t2;
} else {
t1 = $[4];
t2 = $[4];
}
return t1;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -27,42 +27,42 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper } from "shared-runtime";
function useHook(t16) {
function useHook(t0) {
const $ = useMemoCache(8);
const { a, b, c } = t16;
let t0;
if ($[0] !== a) {
t0 = [a];
$[0] = a;
$[1] = t0;
} else {
t0 = $[1];
}
const { a, b, c } = t0;
let t1;
if ($[2] !== b || $[3] !== c || $[4] !== t0) {
let t2;
if ($[0] !== a) {
t1 = [a];
$[0] = a;
$[1] = t1;
} else {
t1 = $[1];
}
let t2;
if ($[2] !== b || $[3] !== c || $[4] !== t1) {
let t3;
if ($[6] !== c) {
t2 = { c };
t3 = { c };
$[6] = c;
$[7] = t2;
$[7] = t3;
} else {
t2 = $[7];
t3 = $[7];
}
t1 = {
x: t0,
t2 = {
x: t1,
y() {
return [b];
},
z: t2,
z: t3,
};
$[2] = b;
$[3] = c;
$[4] = t0;
$[5] = t1;
$[4] = t1;
$[5] = t2;
} else {
t1 = $[5];
t2 = $[5];
}
return t1;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -34,13 +34,13 @@ export const FIXTURE_ENTRYPOINT = {
import { useState, unstable_useMemoCache as useMemoCache } from "react";
import { createHookWrapper } from "shared-runtime";
function useHook(t21) {
function useHook(t0) {
const $ = useMemoCache(3);
const { value } = t21;
const { value } = t0;
const [state] = useState(false);
let t0;
let t1;
if ($[0] !== value || $[1] !== state) {
t0 = {
t1 = {
getX() {
return {
a: [],
@@ -53,11 +53,11 @@ function useHook(t21) {
};
$[0] = value;
$[1] = state;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -98,8 +98,8 @@ function Component(props) {
return t1;
}
function Foo(t21) {
const { cond, setX, setY, setState } = t21;
function Foo(t0) {
const { cond, setX, setY, setState } = t0;
if (cond) {
invariant(setState === setX, "Expected the correct setState function");
} else {
@@ -44,9 +44,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
const GLOBAL = 42;
function Component(t14) {
function Component(t0) {
const $ = useMemoCache(2);
const { value } = t14;
const { value } = t0;
let x;
bb1: switch (GLOBAL) {
case value: {
@@ -57,15 +57,15 @@ function Component(t14) {
x = 2;
}
}
let t0;
let t1;
if ($[0] !== x) {
t0 = [x];
t1 = [x];
$[0] = x;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -37,9 +37,9 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { setProperty } from "shared-runtime";
function useFoo(t27) {
function useFoo(t0) {
const $ = useMemoCache(3);
const { o, branchCheck } = t27;
const { o, branchCheck } = t0;
let x;
if ($[0] !== branchCheck || $[1] !== o.value) {
x = {};
@@ -17,29 +17,29 @@ function Foo({ a }) {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @validateRefAccessDuringRender:false
function Foo(t20) {
function Foo(t0) {
const $ = useMemoCache(4);
const { a } = t20;
const { a } = t0;
const ref = useRef();
const val = ref.current;
let t0;
if ($[0] !== a) {
t0 = { a, val };
$[0] = a;
$[1] = t0;
} else {
t0 = $[1];
}
const x = t0;
let t1;
if ($[2] !== x) {
t1 = <VideoList videos={x} />;
$[2] = x;
$[3] = t1;
if ($[0] !== a) {
t1 = { a, val };
$[0] = a;
$[1] = t1;
} else {
t1 = $[3];
t1 = $[1];
}
return t1;
const x = t1;
let t2;
if ($[2] !== x) {
t2 = <VideoList videos={x} />;
$[2] = x;
$[3] = t2;
} else {
t2 = $[3];
}
return t2;
}
```
@@ -16,28 +16,28 @@ function Foo({ a }) {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @validateRefAccessDuringRender:false
function Foo(t17) {
function Foo(t0) {
const $ = useMemoCache(4);
const { a } = t17;
const { a } = t0;
const ref = useRef();
let t0;
if ($[0] !== a) {
t0 = { a, val: ref.current };
$[0] = a;
$[1] = t0;
} else {
t0 = $[1];
}
const x = t0;
let t1;
if ($[2] !== x) {
t1 = <VideoList videos={x} />;
$[2] = x;
$[3] = t1;
if ($[0] !== a) {
t1 = { a, val: ref.current };
$[0] = a;
$[1] = t1;
} else {
t1 = $[3];
t1 = $[1];
}
return t1;
const x = t1;
let t2;
if ($[2] !== x) {
t2 = <VideoList videos={x} />;
$[2] = x;
$[3] = t2;
} else {
t2 = $[3];
}
return t2;
}
```
@@ -34,24 +34,24 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { identity } from "shared-runtime";
function Component(t25) {
function Component(t0) {
const $ = useMemoCache(2);
const { data } = t25;
const { data } = t0;
let x = 0;
for (const item of data) {
const { current, other } = item;
x = x + current;
identity(other);
}
let t0;
let t1;
if ($[0] !== x) {
t0 = [x];
t1 = [x];
$[0] = x;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -28,31 +28,31 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { Stringify } from "shared-runtime";
function Component(t23) {
function Component(t0) {
const $ = useMemoCache(3);
const { id } = t23;
let t0;
const { id } = t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <Stringify title={undefined} />;
$[0] = t0;
t1 = <Stringify title={undefined} />;
$[0] = t1;
} else {
t0 = $[0];
t1 = $[0];
}
const t1 = id ? true : false;
let t2;
if ($[1] !== t1) {
t2 = (
const t2 = id ? true : false;
let t3;
if ($[1] !== t2) {
t3 = (
<>
{t0}
<Stringify title={t1} />
{t1}
<Stringify title={t2} />
</>
);
$[1] = t1;
$[2] = t2;
$[1] = t2;
$[2] = t3;
} else {
t2 = $[2];
t3 = $[2];
}
return t2;
return t3;
}
export const FIXTURE_ENTRYPOINT = {
@@ -39,58 +39,58 @@ export const FIXTURE_ENTRYPOINT = {
// @validatePreserveExistingMemoizationGuarantees @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions
import { useCallback, unstable_useMemoCache as useMemoCache } from "react";
function Component(t26) {
function Component(t0) {
const $ = useMemoCache(11);
const { entity, children } = t26;
let t0;
if ($[0] !== entity) {
t0 = () => entity != null;
$[0] = entity;
$[1] = t0;
} else {
t0 = $[1];
}
const showMessage = t0;
const { entity, children } = t0;
let t1;
if ($[2] !== showMessage) {
t1 = showMessage();
$[2] = showMessage;
$[3] = t1;
if ($[0] !== entity) {
t1 = () => entity != null;
$[0] = entity;
$[1] = t1;
} else {
t1 = $[3];
t1 = $[1];
}
const shouldShowMessage = t1;
const showMessage = t1;
let t2;
if ($[4] !== shouldShowMessage) {
t2 = <div>{shouldShowMessage}</div>;
$[4] = shouldShowMessage;
$[5] = t2;
if ($[2] !== showMessage) {
t2 = showMessage();
$[2] = showMessage;
$[3] = t2;
} else {
t2 = $[5];
t2 = $[3];
}
const shouldShowMessage = t2;
let t3;
if ($[6] !== children) {
t3 = <div>{children}</div>;
$[6] = children;
$[7] = t3;
if ($[4] !== shouldShowMessage) {
t3 = <div>{shouldShowMessage}</div>;
$[4] = shouldShowMessage;
$[5] = t3;
} else {
t3 = $[7];
t3 = $[5];
}
let t4;
if ($[8] !== t2 || $[9] !== t3) {
t4 = (
if ($[6] !== children) {
t4 = <div>{children}</div>;
$[6] = children;
$[7] = t4;
} else {
t4 = $[7];
}
let t5;
if ($[8] !== t3 || $[9] !== t4) {
t5 = (
<div>
{t2}
{t3}
{t4}
</div>
);
$[8] = t2;
$[9] = t3;
$[10] = t4;
$[8] = t3;
$[9] = t4;
$[10] = t5;
} else {
t4 = $[10];
t5 = $[10];
}
return t4;
return t5;
}
export const FIXTURE_ENTRYPOINT = {
@@ -36,23 +36,23 @@ export const FIXTURE_ENTRYPOINT = {
// @validatePreserveExistingMemoizationGuarantees @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions
import { useCallback, unstable_useMemoCache as useMemoCache } from "react";
function Component(t23) {
function Component(t0) {
const $ = useMemoCache(2);
const { entity, children } = t23;
const { entity, children } = t0;
const showMessage = () => entity != null;
if (!showMessage()) {
return children;
}
let t0;
let t1;
if ($[0] !== children) {
t0 = <div>{children}</div>;
t1 = <div>{children}</div>;
$[0] = children;
$[1] = t0;
$[1] = t1;
} else {
t0 = $[1];
t1 = $[1];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(foo, ...t9) {
function Component(foo, ...t0) {
const $ = useMemoCache(3);
const [bar] = t9;
let t0;
const [bar] = t0;
let t1;
if ($[0] !== foo || $[1] !== bar) {
t0 = [foo, bar];
t1 = [foo, bar];
$[0] = foo;
$[1] = bar;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(foo, ...t9) {
function Component(foo, ...t0) {
const $ = useMemoCache(3);
const bar = t9;
let t0;
const bar = t0;
let t1;
if ($[0] !== foo || $[1] !== bar) {
t0 = [foo, bar];
t1 = [foo, bar];
$[0] = foo;
$[1] = bar;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -17,19 +17,19 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(foo, ...t9) {
function Component(foo, ...t0) {
const $ = useMemoCache(3);
const { bar } = t9;
let t0;
const { bar } = t0;
let t1;
if ($[0] !== foo || $[1] !== bar) {
t0 = [foo, bar];
t1 = [foo, bar];
$[0] = foo;
$[1] = bar;
$[2] = t0;
$[2] = t1;
} else {
t0 = $[2];
t1 = $[2];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -33,29 +33,29 @@ export const FIXTURE_ENTRYPOINT = {
import { unstable_useMemoCache as useMemoCache } from "react";
import { Stringify } from "shared-runtime";
function Component(t29) {
function Component(t0) {
const $ = useMemoCache(8);
const { useFeature } = t29;
const { useFeature } = t0;
let x;
if (useFeature) {
const t0 = useFeature + useFeature;
let t1;
if ($[0] !== t0 || $[1] !== useFeature) {
t1 = [t0].push(-useFeature);
$[0] = t0;
const t1 = useFeature + useFeature;
let t2;
if ($[0] !== t1 || $[1] !== useFeature) {
t2 = [t1].push(-useFeature);
$[0] = t1;
$[1] = useFeature;
$[2] = t1;
$[2] = t2;
} else {
t1 = $[2];
t2 = $[2];
}
x = t1;
x = t2;
}
const y = useFeature;
const z = useFeature.useProperty;
let t0;
let t1;
if ($[3] !== useFeature || $[4] !== x || $[5] !== y || $[6] !== z) {
t0 = (
t1 = (
<Stringify val={useFeature}>
{x}
{y}
@@ -66,11 +66,11 @@ function Component(t29) {
$[4] = x;
$[5] = y;
$[6] = z;
$[7] = t0;
$[7] = t1;
} else {
t0 = $[7];
t1 = $[7];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -39,8 +39,8 @@ function Component(props) {
x = [];
try {
throwInput(x);
} catch (t27) {
const e = t27;
} catch (t0) {
const e = t0;
y = e;
}
@@ -38,8 +38,8 @@ function Component(props) {
const y = [];
y.push(props.y);
throwInput(y);
} catch (t30) {
const e = t30;
} catch (t0) {
const e = t0;
e.push(props.e);
x = e;
}
@@ -39,8 +39,8 @@ function Component(props) {
const y = [];
y.push(props.y);
throwInput(y);
} catch (t25) {
const e = t25;
} catch (t1) {
const e = t1;
e.push(props.e);
t0 = e;
break bb18;
@@ -39,8 +39,8 @@ function Component(props) {
const x = [];
try {
throwInput(x);
} catch (t22) {
const e = t22;
} catch (t1) {
const e = t1;
e.push(null);
t0 = e;
break bb11;
@@ -24,18 +24,18 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t38) {
function Component(t0) {
const $ = useMemoCache(10);
let { a, b: t40, c: t41 } = t38;
let [b] = t40;
let { c } = t41;
let { a, b: t1, c: t2 } = t0;
let [b] = t1;
let { c } = t2;
const d = a++;
const e = ++a;
const f = b--;
const g = --b;
const h = c++;
const i = --c;
let t0;
let t3;
if (
$[0] !== a ||
$[1] !== b ||
@@ -47,7 +47,7 @@ function Component(t38) {
$[7] !== h ||
$[8] !== i
) {
t0 = [a, b, c, d, e, f, g, h, i];
t3 = [a, b, c, d, e, f, g, h, i];
$[0] = a;
$[1] = b;
$[2] = c;
@@ -57,11 +57,11 @@ function Component(t38) {
$[6] = g;
$[7] = h;
$[8] = i;
$[9] = t0;
$[9] = t3;
} else {
t0 = $[9];
t3 = $[9];
}
return t0;
return t3;
}
export const FIXTURE_ENTRYPOINT = {
@@ -20,22 +20,22 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t14) {
function Component(t0) {
const $ = useMemoCache(4);
let { c } = t14;
let { c } = t0;
const h = c++;
const i = --c;
let t0;
let t1;
if ($[0] !== c || $[1] !== h || $[2] !== i) {
t0 = [c, h, i];
t1 = [c, h, i];
$[0] = c;
$[1] = h;
$[2] = i;
$[3] = t0;
$[3] = t1;
} else {
t0 = $[3];
t1 = $[3];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -20,22 +20,22 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(t14) {
function Component(t0) {
const $ = useMemoCache(4);
let [b] = t14;
let [b] = t0;
const f = b--;
const g = --b;
let t0;
let t1;
if ($[0] !== b || $[1] !== f || $[2] !== g) {
t0 = [b, f, g];
t1 = [b, f, g];
$[0] = b;
$[1] = f;
$[2] = g;
$[3] = t0;
$[3] = t1;
} else {
t0 = $[3];
t1 = $[3];
}
return t0;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -36,35 +36,35 @@ import {
// Identical to useCallback-set-ref-nested-property-preserve-memoization,
// but with a different set of compiler flags
function Component(t27) {
function Component(t0) {
const $ = useMemoCache(4);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = { inner: null };
$[0] = t0;
} else {
t0 = $[0];
}
const ref = useRef(t0);
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = { inner: null };
$[0] = t1;
} else {
t1 = $[0];
}
const ref = useRef(t1);
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = (event) => {
t2 = (event) => {
ref.current.inner = event.target.value;
};
$[1] = t1;
$[1] = t2;
} else {
t1 = $[1];
t2 = $[1];
}
const onChange = t1;
let t2;
const onChange = t2;
let t3;
if ($[2] !== onChange) {
t2 = <input onChange={onChange} />;
t3 = <input onChange={onChange} />;
$[2] = onChange;
$[3] = t2;
$[3] = t3;
} else {
t2 = $[3];
t3 = $[3];
}
return t2;
return t3;
}
export const FIXTURE_ENTRYPOINT = {