Use BabelPlugin in hir-test

This commit is contained in:
Lauren Tan
2023-01-19 11:37:48 -05:00
parent 717719b8ea
commit b98e87aa63
124 changed files with 188 additions and 742 deletions
+5 -4
View File
@@ -8,22 +8,23 @@
/// <reference path="./plugin-syntax-jsx.d.ts" />
import type * as BabelCore from "@babel/core";
import type { PluginObj } from "@babel/core";
import jsx from "@babel/plugin-syntax-jsx";
import { compile } from "../CompilerPipeline";
/**
* The React Forget Babel Plugin
* @param {*} babel
* @param {*} _babel
* @returns
*/
export default function (babel: typeof BabelCore): PluginObj {
export default function ReactForgetBabelPlugin(
_babel: typeof BabelCore
): BabelCore.PluginObj {
return {
name: "react-forget",
inherits: jsx,
visitor: {
FunctionDeclaration: {
enter(fn, pass) {
enter(fn, _pass) {
if (fn.scope.getProgramParent() !== fn.scope.parent) {
return;
}
@@ -0,0 +1,40 @@
import type * as BabelCore from "@babel/core";
import { transformFromAstSync } from "@babel/core";
import * as parser from "@babel/parser";
import invariant from "invariant";
import prettier from "prettier";
import ReactForgetBabelPlugin from "./BabelPlugin";
type ReactForgetBabelPluginResult = {
ast: BabelCore.BabelFileResult["ast"];
code: string;
map: BabelCore.BabelFileResult["map"];
};
export default function runReactForgetBabelPlugin(
text: string,
file: string
): ReactForgetBabelPluginResult {
const ast = parser.parse(text, {
sourceFilename: file,
plugins: ["typescript", "jsx"],
});
const result = transformFromAstSync(ast, text, {
filename: file,
highlightCode: false,
retainLines: true,
plugins: [ReactForgetBabelPlugin],
});
invariant(
result?.code != null,
`Expected BabelPluginReactForget to codegen successfully, got: ${result}`
);
return {
ast: result.ast,
code: prettier.format(result.code, {
semi: true,
parser: "babel-ts",
}),
map: result.map,
};
}
@@ -16,6 +16,7 @@ function f() {
```javascript
function f() {
const x = 1;
const x$0 = 2;
4;
return 6;
@@ -20,8 +20,10 @@ function component() {
const z = [];
const y = {};
y.z = z;
const x = {};
x.y = y;
mutate(x.y.z);
}
@@ -25,10 +25,8 @@ function component() {
} else {
z = $[0];
}
const c_1 = $[1] !== z;
let y;
if (c_1) {
y = {};
y.z = z;
@@ -37,10 +35,8 @@ function component() {
} else {
y = $[2];
}
const c_3 = $[3] !== y;
let x;
if (c_3) {
x = {};
x.y = y;
@@ -49,7 +45,6 @@ function component() {
} else {
x = $[4];
}
return x;
}
@@ -36,7 +36,6 @@ function foo(cond) {
a = {};
b = {};
c = {};
while (cond) {
const z = a;
a = b;
@@ -44,7 +43,6 @@ function foo(cond) {
c = z;
mutate(a, b);
}
$[0] = cond;
$[1] = a;
$[2] = b;
@@ -54,17 +52,12 @@ function foo(cond) {
b = $[2];
c = $[3];
}
a;
b;
c;
return a;
}
```
## Code
```javascript
function mutate(x, y) {}
```
@@ -25,7 +25,6 @@ function foo() {
} else {
a = $[0];
}
return a;
}
@@ -18,18 +18,13 @@ function g() {
const $ = React.useMemoCache();
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = {
y: {
z: 1,
},
};
x = { y: { z: 1 } };
x.y.z = x.y.z + 1;
x.y.z = x.y.z * 2;
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -20,10 +20,6 @@ function Component(props) {
```javascript
function foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let a;
@@ -32,9 +28,7 @@ function Component(props) {
a = [];
b = {};
foo(a, b);
const _ = <div a={a}></div>;
foo(b);
$[0] = a;
$[1] = b;
@@ -42,11 +36,9 @@ function Component(props) {
a = $[0];
b = $[1];
}
const c_2 = $[2] !== a;
const c_3 = $[3] !== b;
let t4;
if (c_2 || c_3) {
t4 = <div a={a} b={b}></div>;
$[2] = a;
@@ -55,7 +47,6 @@ function Component(props) {
} else {
t4 = $[4];
}
return t4;
}
@@ -20,29 +20,23 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const c_2 = $[2] !== z;
let x;
if (c_2) {
x = function () {
z;
};
$[2] = z;
$[3] = x;
} else {
x = $[3];
}
return x;
}
@@ -23,30 +23,24 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const x = undefined;
const c_2 = $[2] !== z;
let x$0;
if (c_2) {
x$0 = function () {
z;
};
$[2] = z;
$[3] = x$0;
} else {
x$0 = $[3];
}
return x$0;
}
@@ -20,29 +20,23 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const c_2 = $[2] !== z.a;
let x;
if (c_2) {
x = function () {
z.a;
};
$[2] = z.a;
$[3] = x;
} else {
x = $[3];
}
return x;
}
@@ -20,42 +20,32 @@ function component(a) {
const c_0 = $[0] !== a;
let t1;
if (c_0) {
t1 = {
a: a,
};
t1 = { a: a };
$[0] = a;
$[1] = t1;
} else {
t1 = $[1];
}
const c_2 = $[2] !== t1;
let z;
if (c_2) {
z = {
a: t1,
};
z = { a: t1 };
$[2] = t1;
$[3] = z;
} else {
z = $[3];
}
const c_4 = $[4] !== z.a.a;
let x;
if (c_4) {
x = function () {
z.a.a();
};
$[4] = z.a.a;
$[5] = x;
} else {
x = $[5];
}
return x;
}
@@ -22,44 +22,34 @@ function component(a) {
const c_0 = $[0] !== a;
let t1;
if (c_0) {
t1 = {
a: a,
};
t1 = { a: a };
$[0] = a;
$[1] = t1;
} else {
t1 = $[1];
}
const c_2 = $[2] !== t1;
let z;
if (c_2) {
z = {
a: t1,
};
z = { a: t1 };
$[2] = t1;
$[3] = z;
} else {
z = $[3];
}
const c_4 = $[4] !== z.a.a;
let x;
if (c_4) {
x = function () {
(function () {
z.a.a;
})();
};
$[4] = z.a.a;
$[5] = x;
} else {
x = $[5];
}
return x;
}
@@ -20,42 +20,32 @@ function component(a) {
const c_0 = $[0] !== a;
let t1;
if (c_0) {
t1 = {
a: a,
};
t1 = { a: a };
$[0] = a;
$[1] = t1;
} else {
t1 = $[1];
}
const c_2 = $[2] !== t1;
let z;
if (c_2) {
z = {
a: t1,
};
z = { a: t1 };
$[2] = t1;
$[3] = z;
} else {
z = $[3];
}
const c_4 = $[4] !== z.a.a;
let x;
if (c_4) {
x = function () {
z.a.a;
};
$[4] = z.a.a;
$[5] = x;
} else {
x = $[5];
}
return x;
}
@@ -23,33 +23,26 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const c_2 = $[2] !== z;
let x;
if (c_2) {
x = function () {
function t() {
z;
}
t();
};
$[2] = z;
$[3] = x;
} else {
x = $[3];
}
return x;
}
@@ -22,31 +22,25 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const c_2 = $[2] !== z;
let x;
if (c_2) {
x = function () {
{
z;
}
};
$[2] = z;
$[3] = x;
} else {
x = $[3];
}
return x;
}
@@ -22,31 +22,25 @@ function component(a) {
const c_0 = $[0] !== a;
let z;
if (c_0) {
z = {
a: a,
};
z = { a: a };
$[0] = a;
$[1] = z;
} else {
z = $[1];
}
const c_2 = $[2] !== z;
let x;
if (c_2) {
x = function () {
(function () {
z;
})();
};
$[2] = z;
$[3] = x;
} else {
x = $[3];
}
return x;
}
@@ -17,15 +17,9 @@ function foo() {
```javascript
function foo() {
const x = {
x: 0,
};
const y = {
z: 0,
};
const z = {
z: 0,
};
const x = { x: 0 };
const y = { z: 0 };
const z = { z: 0 };
x.x = x.x + (y.y = y.y * 1);
z.z = z.z + (y.y = y.y * (x.x = x.x & 3));
return z;
@@ -46,7 +46,6 @@ function Component(props) {
const seen = new Set();
const c_3 = $[3] !== maxItems;
let max;
if (c_3) {
max = Math.max(0, maxItems);
$[3] = maxItems;
@@ -54,26 +53,21 @@ function Component(props) {
} else {
max = $[4];
}
for (let i = 0; i < items.length; i = i + 1, i) {
const item = items.at(i);
if (item == null) {
} else {
}
if (seen.has(item)) {
continue;
}
seen.add(item);
renderedItems.push(<div>{item}</div>);
if (renderedItems.length >= max) {
break;
}
}
$[0] = maxItems;
$[1] = items;
$[2] = renderedItems;
@@ -84,7 +78,6 @@ function Component(props) {
const count = renderedItems.length;
const c_5 = $[5] !== count;
let t6;
if (c_5) {
t6 = <h1>{count} Items</h1>;
$[5] = count;
@@ -92,11 +85,9 @@ function Component(props) {
} else {
t6 = $[6];
}
const c_7 = $[7] !== t6;
const c_8 = $[8] !== renderedItems;
let t9;
if (c_7 || c_8) {
t9 = (
<div>
@@ -110,7 +101,6 @@ function Component(props) {
} else {
t9 = $[9];
}
return t9;
}
@@ -61,6 +61,9 @@ function Component(props) {
## Code
```javascript
/**
* props.b does *not* influence `a`
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -70,7 +73,6 @@ function Component(props) {
if (c_0 || c_1 || c_2) {
a_DEBUG = [];
a_DEBUG.push(props.a);
if (props.b) {
return null;
}
@@ -83,14 +85,12 @@ function Component(props) {
} else {
a_DEBUG = $[3];
}
return a_DEBUG;
}
```
## Code
```javascript
/**
* props.b *does* influence `a`
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -101,7 +101,6 @@ function Component(props) {
if (c_0 || c_1 || c_2 || c_3) {
a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
}
@@ -115,14 +114,12 @@ function Component(props) {
} else {
a = $[4];
}
return a;
}
```
## Code
```javascript
/**
* props.b *does* influence `a`, but only in a way that is never observable
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -133,7 +130,6 @@ function Component(props) {
if (c_0 || c_1 || c_2 || c_3) {
a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
return null;
@@ -148,14 +144,12 @@ function Component(props) {
} else {
a = $[4];
}
return a;
}
```
## Code
```javascript
/**
* props.b *does* influence `a`
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -166,7 +160,6 @@ function Component(props) {
if (c_0 || c_1 || c_2 || c_3) {
a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
return a;
@@ -181,7 +174,6 @@ function Component(props) {
} else {
a = $[4];
}
return a;
}
@@ -43,15 +43,12 @@ function Component(props) {
if (c_0 || c_1 || c_2) {
a = [];
const b = [];
if (b) {
a.push(props.p0);
}
if (props.p1) {
b.push(props.p2);
}
$[0] = props.p0;
$[1] = props.p1;
$[2] = props.p2;
@@ -59,11 +56,9 @@ function Component(props) {
} else {
a = $[3];
}
const c_4 = $[4] !== a;
const c_5 = $[5] !== b;
let t6;
if (c_4 || c_5) {
t6 = <Foo a={a} b={b}></Foo>;
$[4] = a;
@@ -72,14 +67,9 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.p0;
@@ -89,15 +79,12 @@ function Component(props) {
if (c_0 || c_1 || c_2) {
a = [];
const b = [];
if (mayMutate(b)) {
a.push(props.p0);
}
if (props.p1) {
b.push(props.p2);
}
$[0] = props.p0;
$[1] = props.p1;
$[2] = props.p2;
@@ -105,11 +92,9 @@ function Component(props) {
} else {
a = $[3];
}
const c_4 = $[4] !== a;
const c_5 = $[5] !== b;
let t6;
if (c_4 || c_5) {
t6 = <Foo a={a} b={b}></Foo>;
$[4] = a;
@@ -118,20 +103,10 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
```
## Code
```javascript
function Foo() {}
```
## Code
```javascript
function mayMutate() {}
```
@@ -20,16 +20,13 @@ function foo() {
let y;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
y = 0;
for (const x = 100; 10, false; 100) {
y = y + 1;
}
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -27,15 +27,16 @@ function foo(a, b, c) {
if (a) {
2;
1;
const x$1 = 1;
x$0 = x$1;
} else {
0;
1;
const x$2 = 1;
x$0 = x$2;
}
1;
true;
return b;
@@ -22,16 +22,13 @@ function foo() {
let y;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
y = 0;
while ((10, false)) {
y = y + 1;
}
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -34,7 +34,9 @@ function foo() {
const e = 9;
const f = 3;
const g = -6;
console.log("foo");
const h = -6;
const i = -6;
const j = -6;
@@ -20,10 +20,6 @@ function Component(props) {
```javascript
function Foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let a;
@@ -34,7 +30,6 @@ function Component(props) {
new Foo(a, b);
const _ = <div a={a}></div>;
new Foo(b);
$[0] = a;
$[1] = b;
@@ -42,11 +37,9 @@ function Component(props) {
a = $[0];
b = $[1];
}
const c_2 = $[2] !== a;
const c_3 = $[3] !== b;
let t4;
if (c_2 || c_3) {
t4 = <div a={a} b={b}></div>;
$[2] = a;
@@ -55,7 +48,6 @@ function Component(props) {
} else {
t4 = $[4];
}
return t4;
}
@@ -33,14 +33,12 @@ function foo(a, b) {
} else {
x = $[1];
}
<div>{x}</div>;
const y = [];
const y = [];
if (x.length) {
y.push(x);
}
if (b) {
y.push(b);
}
@@ -32,22 +32,18 @@ function foo(x, y, z) {
let items2;
if (c_0 || c_1) {
items2 = [];
if (x) {
items2.push(y);
}
$[0] = x;
$[1] = y;
$[2] = items2;
} else {
items2 = $[2];
}
if (y) {
items.push(x);
}
return items2;
}
@@ -32,6 +32,7 @@ function foo(a, b, c) {
const o = undefined;
const d$0 = a[0];
const g$1 = a[1][0].e.f;
const n$2 = b.l.m[0][0];
const o$3 = b.o;
}
@@ -27,6 +27,7 @@ function foo(a, b, c) {
function foo(a, b, c) {
const d = a[0];
const f = a[1][0].e.f;
const n = b.l.m[0][0];
const o = b.o;
}
@@ -31,11 +31,9 @@ function foo(a, b, c) {
}
}
}
if (a.length) {
return a;
}
return null;
}
@@ -26,22 +26,12 @@ function Component() {
} else {
a = $[0];
}
const b = a;
useFreeze(a);
foo(b);
}
```
## Code
```javascript
function useFreeze() {}
```
## Code
```javascript
function foo(x) {}
```
@@ -23,17 +23,8 @@ function Component(props) {
```javascript
function useFreeze() {}
```
## Code
```javascript
function foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let x;
@@ -43,10 +34,8 @@ function Component(props) {
} else {
x = $[0];
}
const c_1 = $[1] !== x;
let y;
if (c_1) {
y = useFreeze(x);
$[1] = x;
@@ -54,12 +43,10 @@ function Component(props) {
} else {
y = $[2];
}
foo(y, x);
const c_3 = $[3] !== x;
const c_4 = $[4] !== y;
let t5;
if (c_3 || c_4) {
t5 = (
<Component>
@@ -73,7 +60,6 @@ function Component(props) {
} else {
t5 = $[5];
}
return t5;
}
@@ -27,23 +27,13 @@ function Component() {
} else {
a = $[0];
}
useFreeze(a);
useFreeze(a);
call(a);
return a;
}
```
## Code
```javascript
function useFreeze(x) {}
```
## Code
```javascript
function call(x) {}
```
@@ -35,23 +35,19 @@ function Component(props) {
let a$0;
if (c_0 || c_1) {
a$0 = undefined;
if (cond) {
const a$1 = x;
a$0 = a$1;
} else {
let a$2;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
a$2 = [];
$[3] = a$2;
} else {
a$2 = $[3];
}
a$0 = a$2;
}
$[0] = cond;
$[1] = x;
$[2] = a$0;
@@ -65,16 +61,7 @@ function Component(props) {
return a$0;
}
```
## Code
```javascript
function useFreeze(x) {}
```
## Code
```javascript
function call(x) {}
```
@@ -37,29 +37,24 @@ function Component(props) {
```javascript
function compute() {}
```
## Code
```javascript
function mutate() {}
```
## Code
```javascript
function foo() {}
```
## Code
```javascript
function Foo() {}
```
## Code
```javascript
/**
* Should produce 3 scopes:
*
* a: inputs=props.a & props.c; outputs=a
* a = compute(props.a);
* if (props.c)
* mutate(a)
* b: inputs=props.b & props.c; outputs=b
* b = compute(props.b);
* if (props.c)
* mutate(b)
* return: inputs=a, b outputs=return
* return = <Foo a={a} b={b} />
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -69,12 +64,10 @@ function Component(props) {
if (c_0 || c_1 || c_2) {
a = compute(props.a);
const b = compute(props.b);
if (props.c) {
mutate(a);
mutate(b);
}
$[0] = props.a;
$[1] = props.b;
$[2] = props.c;
@@ -82,11 +75,9 @@ function Component(props) {
} else {
a = $[3];
}
const c_4 = $[4] !== a;
const c_5 = $[5] !== b;
let t6;
if (c_4 || c_5) {
t6 = <Foo a={a} b={b}></Foo>;
$[4] = a;
@@ -95,7 +86,6 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
@@ -27,6 +27,16 @@ function Foo() {}
## Code
```javascript
/**
* Should produce 3 scopes:
*
* a: inputs=props.a, outputs=a
* a = compute(props.a);
* b: inputs=props.b, outputs=b
* b = compute(props.b);
* return: inputs=a, b outputs=return
* return = <Foo a={a} b={b} />
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -38,10 +48,8 @@ function Component(props) {
} else {
a = $[1];
}
const c_2 = $[2] !== props.b;
let b;
if (c_2) {
b = compute(props.b);
$[2] = props.b;
@@ -49,11 +57,9 @@ function Component(props) {
} else {
b = $[3];
}
const c_4 = $[4] !== a;
const c_5 = $[5] !== b;
let t6;
if (c_4 || c_5) {
t6 = <Foo a={a} b={b}></Foo>;
$[4] = a;
@@ -62,26 +68,11 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
```
## Code
```javascript
function compute() {}
```
## Code
```javascript
function foo() {}
```
## Code
```javascript
function Foo() {}
```
@@ -22,13 +22,10 @@ function foo(a, b, c) {
const c_2 = $[2] !== c;
let x;
if (c_0 || c_1 || c_2) {
x = {
a: a,
};
x = { a: a };
const c_4 = $[4] !== b;
const c_5 = $[5] !== c;
let t6;
if (c_4 || c_5) {
t6 = [b, c];
$[4] = b;
@@ -37,7 +34,6 @@ function foo(a, b, c) {
} else {
t6 = $[6];
}
x.y = t6;
$[0] = a;
$[1] = b;
@@ -46,7 +42,6 @@ function foo(a, b, c) {
} else {
x = $[3];
}
return x;
}
@@ -26,7 +26,6 @@ function foo(a, b) {
let x$0;
if (c_0) {
x$0 = undefined;
if (a) {
const x$1 = 1;
x$0 = x$1;
@@ -34,7 +33,6 @@ function foo(a, b) {
const x$2 = 2;
x$0 = x$2;
}
$[0] = a;
$[1] = x$0;
} else {
@@ -31,23 +31,19 @@ function Component(props) {
```javascript
function compute() {}
```
## Code
```javascript
function foo() {}
```
## Code
```javascript
function Foo() {}
```
## Code
```javascript
/**
* Should produce 1 scope:
*
* return: inputs=props.a & props.b & props.c; outputs=return
* const a = compute(props.a);
* const b = compute(props.b);
* if (props.c)
* foo(a, b);
* return = <Foo a={a} b={b} />
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -58,11 +54,9 @@ function Component(props) {
if (c_0 || c_1 || c_2) {
a = compute(props.a);
b = compute(props.b);
if (props.c) {
foo(a, b);
}
$[0] = props.a;
$[1] = props.b;
$[2] = props.c;
@@ -72,11 +66,9 @@ function Component(props) {
a = $[3];
b = $[4];
}
const c_5 = $[5] !== a;
const c_6 = $[6] !== b;
let t7;
if (c_5 || c_6) {
t7 = <Foo a={a} b={b}></Foo>;
$[5] = a;
@@ -85,7 +77,6 @@ function Component(props) {
} else {
t7 = $[7];
}
return t7;
}
@@ -27,6 +27,15 @@ function Foo() {}
## Code
```javascript
/**
* Should produce 1 scope:
*
* return: inputs=props.a & props.b; outputs=return
* const a = compute(props.a);
* const b = compute(props.b);
* foo(a, b);
* return = <Foo a={a} b={b} />
*/
function Component(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.a;
@@ -45,11 +54,9 @@ function Component(props) {
a = $[2];
b = $[3];
}
const c_4 = $[4] !== a;
const c_5 = $[5] !== b;
let t6;
if (c_4 || c_5) {
t6 = <Foo a={a} b={b}></Foo>;
$[4] = a;
@@ -58,26 +65,11 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
```
## Code
```javascript
function compute() {}
```
## Code
```javascript
function foo() {}
```
## Code
```javascript
function Foo() {}
```
@@ -28,7 +28,6 @@ function foo(a, b, c, d) {
let y;
if (c_0 || c_1 || c_2 || c_3) {
y = [];
bb1: if (a) {
if (b) {
y.push(c);
@@ -37,7 +36,6 @@ function foo(a, b, c, d) {
y.push(d);
}
$[0] = a;
$[1] = b;
$[2] = c;
@@ -46,7 +44,6 @@ function foo(a, b, c, d) {
} else {
y = $[4];
}
return y;
}
@@ -19,16 +19,13 @@ function Component(c) {
const c_0 = $[0] !== c;
let x;
if (c_0) {
x = {
c: c,
};
x = { c: c };
mutate(x);
$[0] = c;
$[1] = x;
} else {
x = $[1];
}
const a = x;
const b = a;
}
@@ -16,6 +16,7 @@ function MyApp(props) {
## Code
```javascript
// This caused an infinite loop in the compiler
function MyApp(props) {
const $ = React.useMemoCache();
let y;
@@ -28,7 +29,6 @@ function MyApp(props) {
} else {
y = $[0];
}
return y;
}
@@ -27,10 +27,8 @@ function Foo(props) {
} else {
t0 = $[0];
}
const c_1 = $[1] !== t0;
let t2;
if (c_1) {
t2 = <div>{t0}</div>;
$[1] = t0;
@@ -38,11 +36,9 @@ function Foo(props) {
} else {
t2 = $[2];
}
const c_3 = $[3] !== props.greeting;
const c_4 = $[4] !== t2;
let t5;
if (c_3 || c_4) {
t5 = (
<>
@@ -56,7 +52,6 @@ function Foo(props) {
} else {
t5 = $[5];
}
return t5;
}
@@ -31,41 +31,30 @@ function And() {
} else {
t0 = $[0];
}
const c_1 = $[1] !== t0;
let t2;
if (c_1) {
t2 = undefined;
if (t0) {
let t3;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t3 = g();
$[3] = t3;
} else {
t3 = $[3];
}
t2 = t3;
} else {
t2 = t0;
}
$[1] = t0;
$[2] = t2;
} else {
t2 = $[2];
}
return t2;
}
```
## Code
```javascript
function Or() {
const $ = React.useMemoCache();
let t0;
@@ -75,41 +64,30 @@ function Or() {
} else {
t0 = $[0];
}
const c_1 = $[1] !== t0;
let t2;
if (c_1) {
t2 = undefined;
if (t0) {
t2 = t0;
} else {
let t3;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t3 = g();
$[3] = t3;
} else {
t3 = $[3];
}
t2 = t3;
}
$[1] = t0;
$[2] = t2;
} else {
t2 = $[2];
}
return t2;
}
```
## Code
```javascript
function QuestionQuestion(props) {
const $ = React.useMemoCache();
let t0;
@@ -119,47 +97,31 @@ function QuestionQuestion(props) {
} else {
t0 = $[0];
}
const c_1 = $[1] !== t0;
let t2;
if (c_1) {
t2 = undefined;
if (t0 != null) {
t2 = t0;
} else {
let t3;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t3 = g();
$[3] = t3;
} else {
t3 = $[3];
}
t2 = t3;
}
$[1] = t0;
$[2] = t2;
} else {
t2 = $[2];
}
return t2;
}
```
## Code
```javascript
function f() {}
```
## Code
```javascript
function g() {}
```
@@ -32,10 +32,8 @@ function foo(a, b, c) {
} else {
x = $[1];
}
const c_2 = $[2] !== a;
let y;
if (c_2) {
y = makeObject(a);
$[2] = a;
@@ -43,7 +41,6 @@ function foo(a, b, c) {
} else {
y = $[3];
}
<div>
{x}
{y}
@@ -52,7 +49,6 @@ function foo(a, b, c) {
const c_5 = $[5] !== y.method;
const c_6 = $[6] !== b;
let z;
if (c_4 || c_5 || c_6) {
z = x[y.method](b);
$[4] = x;
@@ -62,7 +58,6 @@ function foo(a, b, c) {
} else {
z = $[7];
}
return z;
}
@@ -29,14 +29,13 @@ function foo(a, b, c) {
} else {
x = $[1];
}
<div>{x}</div>;
const method = x.method;
const c_2 = $[2] !== method;
const c_3 = $[3] !== x;
const c_4 = $[4] !== b;
let y;
if (c_2 || c_3 || c_4) {
y = method.call(x, b);
$[2] = method;
@@ -46,7 +45,6 @@ function foo(a, b, c) {
} else {
y = $[5];
}
return y;
}
@@ -28,12 +28,10 @@ function foo(a, b, c) {
} else {
x = $[1];
}
<div>{x}</div>;
const c_2 = $[2] !== x;
const c_3 = $[3] !== b;
let y;
if (c_2 || c_3) {
y = x.foo(b);
$[2] = x;
@@ -42,7 +40,6 @@ function foo(a, b, c) {
} else {
y = $[4];
}
return y;
}
@@ -43,17 +43,8 @@ function Component(props) {
```javascript
function mutate(x, y) {}
```
## Code
```javascript
function cond(x) {}
```
## Code
```javascript
function Component(props) {
let a = {};
let b = {};
@@ -74,21 +65,16 @@ function Component(props) {
b$1 = b;
c$2 = c;
d$3 = d;
if (cond(a)) {
break;
}
}
if (a$0) {
}
if (b$1) {
}
if (c$2) {
}
if (d$3) {
}
@@ -40,32 +40,24 @@ function Component(props) {
```javascript
function mutate(x, y) {}
```
## Code
```javascript
function Component(props) {
const a = {};
const b = [a];
const c = {};
const d = {
c: c,
};
const d = { c: c };
const x = {};
x.b = b;
const y = mutate(x, d);
if (a) {
}
if (b) {
}
if (c) {
}
if (d) {
}
if (y) {
}
@@ -38,17 +38,8 @@ function Component(props) {
```javascript
function mutate() {}
```
## Code
```javascript
function cond() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
const a = {};
@@ -60,26 +51,19 @@ function Component(props) {
} else {
c = $[0];
}
const d = {};
while (true) {
mutate(a, b);
if (cond(a)) {
break;
}
}
if (a) {
}
if (b) {
}
if (c) {
}
if (d) {
}
@@ -26,46 +26,35 @@ function foo(a, b, c, d) {
let x$0;
if (c_0 || c_1) {
x$0 = undefined;
if (someVal) {
const c_3 = $[3] !== b;
let x$1;
if (c_3) {
x$1 = {
b: b,
};
x$1 = { b: b };
$[3] = b;
$[4] = x$1;
} else {
x$1 = $[4];
}
x$0 = x$1;
} else {
const c_5 = $[5] !== c;
let x$2;
if (c_5) {
x$2 = {
c: c,
};
x$2 = { c: c };
$[5] = c;
$[6] = x$2;
} else {
x$2 = $[6];
}
x$0 = x$2;
}
$[0] = b;
$[1] = c;
$[2] = x$0;
} else {
x$0 = $[2];
}
return x$0;
}
@@ -27,19 +27,13 @@ function foo(a, b, c, d) {
let x$0;
if (c_0 || c_1) {
x$0 = undefined;
if (someVal) {
const x$1 = {
b: b,
};
const x$1 = { b: b };
x$0 = x$1;
} else {
const x$2 = {
c: c,
};
const x$2 = { c: c };
x$0 = x$2;
}
x$0.f = 1;
$[0] = b;
$[1] = c;
@@ -47,7 +41,6 @@ function foo(a, b, c, d) {
} else {
x$0 = $[2];
}
return x$0;
}
@@ -26,7 +26,6 @@ function foo(a, b, c, d) {
let x$0;
if (c_0) {
x$0 = undefined;
if (a) {
const x$1 = someObj();
x$0 = x$1;
@@ -34,14 +33,12 @@ function foo(a, b, c, d) {
const x$2 = someObj();
x$0 = x$2;
}
x$0.f = 1;
$[0] = a;
$[1] = x$0;
} else {
x$0 = $[1];
}
return x$0;
}
@@ -19,6 +19,7 @@ function foo(a, b, c) {
const x = a.x;
const y = b.c.d;
y.z = c.d.e;
foo(a.b.c);
[a.b.c];
}
@@ -28,29 +28,23 @@ function foo(a, b, c) {
let x;
if (c_0 || c_1 || c_2) {
x = [];
if (a) {
const c_4 = $[4] !== b;
const c_5 = $[5] !== c;
let y;
if (c_4 || c_5) {
y = [];
if (b) {
y.push(c);
}
$[4] = b;
$[5] = c;
$[6] = y;
} else {
y = $[6];
}
const c_7 = $[7] !== y;
let t8;
if (c_7) {
t8 = <div>{y}</div>;
$[7] = y;
@@ -58,10 +52,8 @@ function foo(a, b, c) {
} else {
t8 = $[8];
}
x.push(t8);
}
$[0] = a;
$[1] = b;
$[2] = c;
@@ -69,7 +61,6 @@ function foo(a, b, c) {
} else {
x = $[3];
}
return x;
}
@@ -28,17 +28,14 @@ function foo(a, b, c) {
let x;
if (c_0 || c_1 || c_2) {
x = [];
if (a) {
const y = [];
if (b) {
y.push(c);
}
x.push(y);
}
$[0] = a;
$[1] = b;
$[2] = c;
@@ -46,7 +43,6 @@ function foo(a, b, c) {
} else {
x = $[3];
}
return x;
}
@@ -26,7 +26,6 @@ function component(a) {
let x$0;
if (c_0) {
x$0 = undefined;
if (a) {
const x$1 = "bar";
x$0 = x$1;
@@ -34,7 +33,6 @@ function component(a) {
const x$2 = "baz";
x$0 = x$2;
}
$[0] = a;
$[1] = x$0;
} else {
@@ -21,31 +21,24 @@ function component(a, b) {
const c_1 = $[1] !== b;
let z;
if (c_0 || c_1) {
z = {
a: a,
b: b,
};
z = { a: a, b: b };
$[0] = a;
$[1] = b;
$[2] = z;
} else {
z = $[2];
}
const c_3 = $[3] !== z;
let x;
if (c_3) {
x = function () {
z;
};
$[3] = z;
$[4] = x;
} else {
x = $[4];
}
return x;
}
@@ -25,6 +25,7 @@ function Component(props) {
x = {};
const y = [];
x.y = y;
child = <Component data={y}></Component>;
x.y.push(props.p0);
$[0] = props.p0;
@@ -34,11 +35,9 @@ function Component(props) {
x = $[1];
child = $[2];
}
const c_3 = $[3] !== x;
const c_4 = $[4] !== child;
let t5;
if (c_3 || c_4) {
t5 = <Component data={x}>{child}</Component>;
$[3] = x;
@@ -47,7 +46,6 @@ function Component(props) {
} else {
t5 = $[5];
}
return t5;
}
@@ -23,7 +23,6 @@ function foo() {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = {};
let y;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
y = [];
const z = {};
@@ -32,13 +31,11 @@ function foo() {
} else {
y = $[1];
}
x.y = y;
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -27,11 +27,9 @@ function foo(a, b, c) {
let x;
if (c_0 || c_1 || c_2) {
x = [];
if (a) {
const c_4 = $[4] !== b;
let y;
if (c_4) {
y = [];
y.push(b);
@@ -40,10 +38,8 @@ function foo(a, b, c) {
} else {
y = $[5];
}
const c_6 = $[6] !== y;
let t7;
if (c_6) {
t7 = <div>{y}</div>;
$[6] = y;
@@ -51,12 +47,10 @@ function foo(a, b, c) {
} else {
t7 = $[7];
}
x.push(t7);
} else {
x.push(c);
}
$[0] = a;
$[1] = b;
$[2] = c;
@@ -64,7 +58,6 @@ function foo(a, b, c) {
} else {
x = $[3];
}
return x;
}
@@ -25,23 +25,19 @@ function f(a, b) {
let x;
if (c_0 || c_1) {
x = [];
if (a.length === 1) {
if (b) {
x.push(b);
}
}
$[0] = a.length;
$[1] = b;
$[2] = x;
} else {
x = $[2];
}
const c_3 = $[3] !== x;
let t4;
if (c_3) {
t4 = <div>{x}</div>;
$[3] = x;
@@ -49,7 +45,6 @@ function f(a, b) {
} else {
t4 = $[4];
}
return t4;
}
@@ -34,27 +34,21 @@ function Component(props) {
} else {
x = $[1];
}
const y = x;
const c_2 = $[2] !== props.p1;
let x$0;
if (c_2) {
x$0 = x;
if (props.p1) {
let x$1;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
x$1 = [];
$[4] = x$1;
} else {
x$1 = $[4];
}
x$0 = x$1;
}
$[2] = props.p1;
$[3] = x$0;
} else {
@@ -62,12 +56,10 @@ function Component(props) {
}
const _ = <Component x={x$0}></Component>;
y.push(props.p2);
const c_5 = $[5] !== x$0;
const c_6 = $[6] !== y;
let t7;
if (c_5 || c_6) {
t7 = <Component x={x$0} y={y}></Component>;
$[5] = x$0;
@@ -76,7 +68,6 @@ function Component(props) {
} else {
t7 = $[7];
}
return t7;
}
@@ -39,20 +39,16 @@ function foo(a, b, c) {
let x;
if (c_0) {
x = [];
if (a) {
x.push(a);
}
$[0] = a;
$[1] = x;
} else {
x = $[1];
}
const c_2 = $[2] !== x;
let y;
if (c_2) {
y = <div>{x}</div>;
$[2] = x;
@@ -60,19 +56,15 @@ function foo(a, b, c) {
} else {
y = $[3];
}
const c_4 = $[4] !== b;
const c_5 = $[5] !== c;
let x$0;
if (c_4 || c_5) {
x$0 = undefined;
bb3: switch (b) {
case 0: {
const c_7 = $[7] !== b;
let x$1;
if (c_7) {
x$1 = [];
x$1.push(b);
@@ -81,15 +73,12 @@ function foo(a, b, c) {
} else {
x$1 = $[8];
}
x$0 = x$1;
break bb3;
}
default: {
const c_9 = $[9] !== c;
let x$2;
if (c_9) {
x$2 = [];
x$2.push(c);
@@ -98,22 +87,18 @@ function foo(a, b, c) {
} else {
x$2 = $[10];
}
x$0 = x$2;
}
}
$[4] = b;
$[5] = c;
$[6] = x$0;
} else {
x$0 = $[6];
}
const c_11 = $[11] !== y;
const c_12 = $[12] !== x$0;
let t13;
if (c_11 || c_12) {
t13 = (
<div>
@@ -127,7 +112,6 @@ function foo(a, b, c) {
} else {
t13 = $[13];
}
return t13;
}
@@ -30,14 +30,12 @@ function Component(props) {
x.push(props.p0);
y = x;
let x$0;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
x$0 = [];
$[3] = x$0;
} else {
x$0 = $[3];
}
const _ = <Component x={x$0}></Component>;
y.push(props.p1);
@@ -47,11 +45,9 @@ function Component(props) {
} else {
y = $[2];
}
const c_4 = $[4] !== x$0;
const c_5 = $[5] !== y;
let t6;
if (c_4 || c_5) {
t6 = <Component x={x$0} y={y}></Component>;
$[4] = x$0;
@@ -60,7 +56,6 @@ function Component(props) {
} else {
t6 = $[6];
}
return t6;
}
@@ -49,7 +49,6 @@ function Component(props) {
let x$0;
if (c_0 || c_1 || c_2 || c_3 || c_4 || c_5 || c_6 || c_7) {
x$0 = undefined;
bb1: if (props.cond) {
switch (props.test) {
case 0: {
@@ -57,16 +56,13 @@ function Component(props) {
x$0 = x$1;
break bb1;
}
case 1: {
const x$2 = props.v1;
x$0 = x$2;
break bb1;
}
case 2: {
}
default: {
const x$3 = props.v2;
x$0 = x$3;
@@ -81,7 +77,6 @@ function Component(props) {
x$0 = x$5;
}
}
$[0] = props.cond;
$[1] = props.test;
$[2] = props.v0;
@@ -94,7 +89,6 @@ function Component(props) {
} else {
x$0 = $[8];
}
x$0;
}
@@ -20,11 +20,6 @@ function foo() {
```javascript
function mutate() {}
```
## Code
```javascript
function foo() {
const $ = React.useMemoCache();
const a = {};
@@ -40,7 +35,6 @@ function foo() {
} else {
c$2 = $[0];
}
return c$2;
}
@@ -21,12 +21,10 @@ function component() {
x = function (a) {
a.foo();
};
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -23,7 +23,6 @@ function foo(a) {
} else {
x = $[1];
}
return x;
}
@@ -19,7 +19,6 @@ function foo(x, y) {
if (x) {
const c_0 = $[0] !== y;
let t1;
if (c_0) {
t1 = foo(false, y);
$[0] = y;
@@ -27,19 +26,15 @@ function foo(x, y) {
} else {
t1 = $[1];
}
return t1;
}
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = [y * 10];
$[2] = t2;
} else {
t2 = $[2];
}
return t2;
}
@@ -25,7 +25,6 @@ function Component(props) {
} else {
x = $[0];
}
return x;
}
@@ -21,12 +21,9 @@ function Component(props) {
## Code
```javascript
// @Pass runMutableRangeAnalysis
function foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let a;
@@ -36,14 +33,12 @@ function Component(props) {
b = {};
foo(a, b);
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = foo();
$[2] = t2;
} else {
t2 = $[2];
}
if (t2) {
const _ = <div a={a}></div>;
}
@@ -55,11 +50,9 @@ function Component(props) {
a = $[0];
b = $[1];
}
const c_3 = $[3] !== a;
const c_4 = $[4] !== b;
let t5;
if (c_3 || c_4) {
t5 = <div a={a} b={b}></div>;
$[3] = a;
@@ -68,7 +61,6 @@ function Component(props) {
} else {
t5 = $[5];
}
return t5;
}
@@ -20,10 +20,6 @@ function Component(props) {
```javascript
function foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let a;
@@ -32,9 +28,7 @@ function Component(props) {
a = [];
b = {};
foo(a, b);
const _ = <div a={a}></div>;
foo(a, b);
$[0] = a;
$[1] = b;
@@ -42,11 +36,9 @@ function Component(props) {
a = $[0];
b = $[1];
}
const c_2 = $[2] !== a;
const c_3 = $[3] !== b;
let t4;
if (c_2 || c_3) {
t4 = <div a={a} b={b}></div>;
$[2] = a;
@@ -55,7 +47,6 @@ function Component(props) {
} else {
t4 = $[4];
}
return t4;
}
@@ -25,9 +25,11 @@ function foo() {
const y = 2;
2;
true;
const x$0 = 3;
3;
false;
const y$1 = x$0;
}
@@ -22,7 +22,9 @@ function foo() {
const y = 2;
2;
true;
const x$0 = 3;
const y$1 = x$0;
}
@@ -20,16 +20,13 @@ function foo() {
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = 1;
for (const i = 0; 10, true; 0) {
x = x + 1;
}
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -20,16 +20,13 @@ function foo() {
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = 1;
for (let i = 0; i < 10; i = i + 1, i) {
x = x + 1;
}
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -21,6 +21,7 @@ function foo() {
function foo() {
const x = 1;
const y = 2;
const z = 3;
}
@@ -31,6 +31,7 @@ function foo(a, b, c, d) {
const x = 0;
true;
true;
const x$0 = a;
x$0;
return x$0;
@@ -20,6 +20,7 @@ function foo(a, b, c) {
## Code
```javascript
// @xonly
function foo(a, b, c) {
const x = 0;
while (a) {
@@ -30,7 +31,6 @@ function foo(a, b, c) {
}
}
}
return x;
}
@@ -23,21 +23,17 @@ function foo(a, b, c) {
if (b) {
const c_0 = $[0] !== c;
let x$0;
if (c_0) {
x$0 = x;
if (c) {
const x$1 = c;
x$0 = x$1;
}
$[0] = c;
$[1] = x$0;
} else {
x$0 = $[1];
}
x$0;
}
}
@@ -29,7 +29,6 @@ function foo(a, b, c, d, e) {
let x$0;
if (c_0 || c_1 || c_2 || c_3) {
x$0 = x;
if (a) {
const x$1 = b;
x$0 = x$1;
@@ -39,7 +38,6 @@ function foo(a, b, c, d, e) {
x$0 = x$2;
}
}
$[0] = a;
$[1] = b;
$[2] = c;
@@ -48,7 +46,6 @@ function foo(a, b, c, d, e) {
} else {
x$0 = $[4];
}
return x$0;
}
@@ -18,10 +18,6 @@ function Component(props) {
```javascript
function Foo() {}
```
## Code
```javascript
function Component(props) {
const $ = React.useMemoCache();
let c;
@@ -33,7 +29,6 @@ function Component(props) {
} else {
c = $[0];
}
return c;
}
@@ -27,18 +27,15 @@ function foo() {
const y = 2;
1;
false;
const y$0 = 3;
let t;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t = {
x: x,
y: y$0,
};
t = { x: x, y: y$0 };
$[0] = t;
} else {
t = $[0];
}
return t;
}
@@ -20,15 +20,11 @@ function Component(props) {
const b = 2;
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = {
a: a,
b: b,
};
x = { a: a, b: b };
$[0] = x;
} else {
x = $[0];
}
return x;
}
@@ -28,7 +28,6 @@ function foo(a) {
if (c_0) {
const b = {};
x = b;
if (a) {
const y = {};
x.y = y;
@@ -43,7 +42,6 @@ function foo(a) {
} else {
x = $[1];
}
return x;
}
@@ -25,37 +25,30 @@ function foo(a) {
let x;
if (c_0) {
x = {};
if (a) {
let y;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
y = {};
$[2] = y;
} else {
y = $[2];
}
x.y = y;
} else {
let z;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
z = {};
$[3] = z;
} else {
z = $[3];
}
x.z = z;
}
$[0] = a;
$[1] = x;
} else {
x = $[1];
}
return x;
}
@@ -26,7 +26,6 @@ function foo(a) {
let x;
if (c_0) {
x = {};
if (a) {
const y = {};
x.y = y;
@@ -41,7 +40,6 @@ function foo(a) {
} else {
x = $[1];
}
return x;
}
@@ -26,30 +26,26 @@ function foo(a) {
let x;
if (c_0) {
x = {};
if (a) {
const y = {};
x.y = y;
mutate(y);
} else {
let z;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
z = {};
$[2] = z;
} else {
z = $[2];
}
x.z = z;
}
$[0] = a;
$[1] = x;
} else {
x = $[1];
}
return x;
}
@@ -24,14 +24,15 @@ function foo() {
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const a = {};
const x = a;
y = {};
y.x = x;
mutate(a);
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -19,15 +19,12 @@ function foo() {
let y;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const x = [];
y = {
x: x,
};
y = { x: x };
y.x.push([]);
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -22,12 +22,12 @@ function foo() {
const x = [];
y = {};
y.x = x;
mutate(x);
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -26,12 +26,12 @@ function foo() {
y = a;
const x = [];
y.x = x;
mutate(a);
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -22,12 +22,12 @@ function foo() {
const x = [];
y = {};
y.x = x;
mutate(y);
$[0] = y;
} else {
y = $[0];
}
return y;
}
@@ -23,10 +23,8 @@ function foo() {
} else {
x = $[0];
}
const c_1 = $[1] !== x;
let y;
if (c_1) {
y = {};
y.x = x;
@@ -35,7 +33,6 @@ function foo() {
} else {
y = $[2];
}
return y;
}
@@ -20,6 +20,7 @@ function foo() {
const x = 1;
1;
true;
const x$0 = 2;
return x$0;
}
@@ -22,10 +22,6 @@ function Foo(cond) {
```javascript
function log() {}
```
## Code
```javascript
function Foo(cond) {
const $ = React.useMemoCache();
const str = "";
@@ -33,7 +29,6 @@ function Foo(cond) {
let str$0;
if (c_0) {
str$0 = str;
if (cond) {
const str_0 = "other test";
log(str_0);
@@ -41,7 +36,6 @@ function Foo(cond) {
const str$1 = "fallthrough test";
str$0 = str$1;
}
$[0] = cond;
$[1] = str$0;
} else {

Some files were not shown because too many files have changed in this diff Show More