Add missing return statements to fixtures

This commit is contained in:
Joe Savona
2023-02-06 14:09:15 -08:00
parent 500cfddc3a
commit 382226ab31
38 changed files with 318 additions and 79 deletions
@@ -1,21 +0,0 @@
## Input
```javascript
function g(a) {
a.b.c = a.b.c + 1;
a.b.c *= 2;
}
```
## Code
```javascript
function g(a) {
a.b.c = a.b.c + 1;
a.b.c = a.b.c * 2;
}
```
@@ -1,4 +0,0 @@
function g(a) {
a.b.c = a.b.c + 1;
a.b.c *= 2;
}
@@ -9,6 +9,7 @@ function component() {
let x = {};
x.y = y;
mutate(x.y.z);
return x;
}
```
@@ -17,14 +18,22 @@ function component() {
```javascript
function component() {
const z = [];
const y = {};
y.z = z;
const $ = React.useMemoCache();
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
const z = [];
const y = {};
y.z = z;
const x = {};
x.y = y;
x = {};
x.y = y;
mutate(x.y.z);
mutate(x.y.z);
$[0] = x;
} else {
x = $[0];
}
return x;
}
```
@@ -5,4 +5,5 @@ function component() {
let x = {};
x.y = y;
mutate(x.y.z);
return x;
}
@@ -3,8 +3,12 @@
```javascript
function foo(a, b, c) {
a[0] = b[1];
c[0][0] = a[0];
const x = [a];
const y = [null, b];
const z = [[], [], [c]];
x[0] = y[1];
z[0][0] = x[0];
return [x, z];
}
```
@@ -13,8 +17,47 @@ function foo(a, b, c) {
```javascript
function foo(a, b, c) {
a[0] = b[1];
c[0][0] = a[0];
const $ = React.useMemoCache();
const c_0 = $[0] !== a;
const c_1 = $[1] !== b;
const c_2 = $[2] !== c;
let x;
let z;
if (c_0 || c_1 || c_2) {
x = [a];
const c_5 = $[5] !== b;
let y;
if (c_5) {
y = [null, b];
$[5] = b;
$[6] = y;
} else {
y = $[6];
}
z = [[], [], [c]];
x[0] = y[1];
z[0][0] = x[0];
$[0] = a;
$[1] = b;
$[2] = c;
$[3] = x;
$[4] = z;
} else {
x = $[3];
z = $[4];
}
const c_7 = $[7] !== x;
const c_8 = $[8] !== z;
let t0;
if (c_7 || c_8) {
t0 = [x, z];
$[7] = x;
$[8] = z;
$[9] = t0;
} else {
t0 = $[9];
}
return t0;
}
```
@@ -1,4 +1,8 @@
function foo(a, b, c) {
a[0] = b[1];
c[0][0] = a[0];
const x = [a];
const y = [null, b];
const z = [[], [], [c]];
x[0] = y[1];
z[0][0] = x[0];
return [x, z];
}
@@ -0,0 +1,34 @@
## Input
```javascript
function g(props) {
const a = { b: { c: props.c } };
a.b.c = a.b.c + 1;
a.b.c *= 2;
return a;
}
```
## Code
```javascript
function g(props) {
const $ = React.useMemoCache();
const c_0 = $[0] !== props.c;
let a;
if (c_0) {
a = { b: { c: props.c } };
a.b.c = a.b.c + 1;
a.b.c = a.b.c * 2;
$[0] = props.c;
$[1] = a;
} else {
a = $[1];
}
return a;
}
```
@@ -0,0 +1,6 @@
function g(props) {
const a = { b: { c: props.c } };
a.b.c = a.b.c + 1;
a.b.c *= 2;
return a;
}
@@ -7,6 +7,7 @@ function f() {
x = x + 1;
x += 1;
x >>>= 1;
return x;
}
```
@@ -14,7 +15,11 @@ function f() {
## Code
```javascript
function f() {}
function f() {
const x = 3;
const x$0 = x >>> 1;
return x$0;
}
```
@@ -3,4 +3,5 @@ function f() {
x = x + 1;
x += 1;
x >>>= 1;
return x;
}
@@ -6,10 +6,11 @@ function foo(a, b, c) {
label: if (a) {
while (b) {
if (c) {
break;
break label;
}
}
}
return c;
}
```
@@ -25,6 +26,7 @@ function foo(a, b, c) {
}
}
}
return c;
}
```
@@ -2,8 +2,9 @@ function foo(a, b, c) {
label: if (a) {
while (b) {
if (c) {
break;
break label;
}
}
}
return c;
}
@@ -9,6 +9,7 @@ function foo(props) {
x++;
y++;
}
return y;
}
```
@@ -17,10 +18,20 @@ function foo(props) {
```javascript
function foo(props) {
let y = 0;
while (y < props.max) {
y = y + 1;
const $ = React.useMemoCache();
const c_0 = $[0] !== props.max;
let y;
if (c_0) {
y = 0;
while (y < props.max) {
y = y + 1;
}
$[0] = props.max;
$[1] = y;
} else {
y = $[1];
}
return y;
}
```
@@ -5,4 +5,5 @@ function foo(props) {
x++;
y++;
}
return y;
}
@@ -14,6 +14,7 @@ function foo(a, b) {
if (b) {
y.push(b);
}
return y;
}
```
@@ -33,14 +34,24 @@ function foo(a, b) {
} else {
x = $[1];
}
const y = [];
if (x.length) {
y.push(x);
}
if (b) {
y.push(b);
const c_2 = $[2] !== x;
const c_3 = $[3] !== b;
let y;
if (c_2 || c_3) {
y = [];
if (x.length) {
y.push(x);
}
if (b) {
y.push(b);
}
$[2] = x;
$[3] = b;
$[4] = y;
} else {
y = $[4];
}
return y;
}
```
@@ -10,4 +10,5 @@ function foo(a, b) {
if (b) {
y.push(b);
}
return y;
}
@@ -18,6 +18,7 @@ function foo(a, b, c) {
},
o,
} = b);
return { e, g, n, o };
}
```
@@ -25,7 +26,28 @@ function foo(a, b, c) {
## Code
```javascript
function foo(a, b, c) {}
function foo(a, b, c) {
const $ = React.useMemoCache();
const g = a[1][0].e.f;
const n = b.l.m[0][0];
const o = b.o;
const c_0 = $[0] !== g;
const c_1 = $[1] !== n;
const c_2 = $[2] !== o;
let t0;
if (c_0 || c_1 || c_2) {
t0 = { e: e, g: g, n: n, o: o };
$[0] = g;
$[1] = n;
$[2] = o;
$[3] = t0;
} else {
t0 = $[3];
}
return t0;
}
```
@@ -14,4 +14,5 @@ function foo(a, b, c) {
},
o,
} = b);
return { e, g, n, o };
}
@@ -17,6 +17,7 @@ function foo(a, b, c) {
},
o,
} = b;
return [d, f, n, o];
}
```
@@ -24,7 +25,30 @@ function foo(a, b, c) {
## Code
```javascript
function foo(a, b, c) {}
function foo(a, b, c) {
const $ = React.useMemoCache();
const d = a[0];
const f = a[1][0].e.f;
const n = b.l.m[0][0];
const o = b.o;
const c_0 = $[0] !== d;
const c_1 = $[1] !== f;
const c_2 = $[2] !== n;
const c_3 = $[3] !== o;
let t0;
if (c_0 || c_1 || c_2 || c_3) {
t0 = [d, f, n, o];
$[0] = d;
$[1] = f;
$[2] = n;
$[3] = o;
$[4] = t0;
} else {
t0 = $[4];
}
return t0;
}
```
@@ -13,4 +13,5 @@ function foo(a, b, c) {
},
o,
} = b;
return [d, f, n, o];
}
@@ -11,8 +11,8 @@ function foo(a, b, c) {
}
}
}
if (a.length) {
return a;
if (x.length) {
return x;
}
return null;
}
@@ -23,16 +23,29 @@ function foo(a, b, c) {
```javascript
function foo(a, b, c) {
const x = [];
if (a) {
if (b) {
if (c) {
x.push(0);
const $ = React.useMemoCache();
const c_0 = $[0] !== a;
const c_1 = $[1] !== b;
const c_2 = $[2] !== c;
let x;
if (c_0 || c_1 || c_2) {
x = [];
if (a) {
if (b) {
if (c) {
x.push(0);
}
}
}
$[0] = a;
$[1] = b;
$[2] = c;
$[3] = x;
} else {
x = $[3];
}
if (a.length) {
return a;
if (x.length) {
return x;
}
return null;
}
@@ -7,8 +7,8 @@ function foo(a, b, c) {
}
}
}
if (a.length) {
return a;
if (x.length) {
return x;
}
return null;
}
@@ -7,6 +7,7 @@ function Component() {
const b = a;
useFreeze(a);
foo(b); // should be readonly, value is guaranteed frozen via alias
return b;
}
function useFreeze() {}
@@ -29,6 +30,7 @@ function Component() {
const b = a;
useFreeze(a);
foo(b);
return b;
}
function useFreeze() {}
@@ -3,6 +3,7 @@ function Component() {
const b = a;
useFreeze(a);
foo(b); // should be readonly, value is guaranteed frozen via alias
return b;
}
function useFreeze() {}
@@ -8,7 +8,8 @@ function foo(a, b, c) {
if (c) {
x = c;
}
x;
// TODO: move the return to the end of the function
return x;
}
}
@@ -18,9 +19,23 @@ function foo(a, b, c) {
```javascript
function foo(a, b, c) {
const $ = React.useMemoCache();
const x = a;
if (b) {
if (c) {
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];
}
return x$0;
}
}
@@ -4,6 +4,7 @@ function foo(a, b, c) {
if (c) {
x = c;
}
x;
// TODO: move the return to the end of the function
return x;
}
}
@@ -5,6 +5,7 @@
function component() {
let x = { t: 1 };
let p = x.t;
return p;
}
```
@@ -12,7 +13,18 @@ function component() {
## Code
```javascript
function component() {}
function component() {
const $ = React.useMemoCache();
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = { t: 1 };
$[0] = x;
} else {
x = $[0];
}
const p = x.t;
return p;
}
```
@@ -1,4 +1,5 @@
function component() {
let x = { t: 1 };
let p = x.t;
return p;
}
@@ -11,6 +11,7 @@ function component() {
let y = x.u;
let z = x.v;
return z;
}
```
@@ -45,6 +46,9 @@ function component() {
const v = x.v;
if (u > v) {
}
const z = x.v;
return z;
}
```
@@ -7,4 +7,5 @@ function component() {
let y = x.u;
let z = x.v;
return z;
}
@@ -7,6 +7,7 @@ function component() {
let q = {};
x.t = q;
let z = x.t;
return z;
}
```
@@ -16,15 +17,24 @@ function component() {
```javascript
function component() {
const $ = React.useMemoCache();
const x = {};
let q;
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
q = {};
$[0] = q;
x = {};
let q;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
q = {};
$[1] = q;
} else {
q = $[1];
}
x.t = q;
$[0] = x;
} else {
q = $[0];
x = $[0];
}
x.t = q;
const z = x.t;
return z;
}
```
@@ -3,4 +3,5 @@ function component() {
let q = {};
x.t = q;
let z = x.t;
return z;
}
@@ -14,6 +14,7 @@ function component() {
x.t = o; // generalize x.t
let y = x.t;
return y;
}
```
@@ -37,10 +38,18 @@ function component() {
} else {
o = $[1];
}
let x;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
x = {};
x.t = p;
x.t = o;
$[2] = x;
} else {
x = $[2];
}
const x = {};
x.t = p;
x.t = o;
const y = x.t;
return y;
}
```
@@ -10,4 +10,5 @@ function component() {
x.t = o; // generalize x.t
let y = x.t;
return y;
}
@@ -5,6 +5,8 @@
function component() {
let x = 1;
let y = 2;
return y;
}
```
@@ -12,7 +14,10 @@ function component() {
## Code
```javascript
function component() {}
function component() {
const y = 2;
return y;
}
```
@@ -1,4 +1,6 @@
function component() {
let x = 1;
let y = 2;
return y;
}
@@ -10,6 +10,7 @@ function component() {
}
let z = foo();
return z;
}
```
@@ -35,8 +36,14 @@ function component() {
}
if (x > y) {
}
const z_0 = foo();
let z_0;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
z_0 = foo();
$[2] = z_0;
} else {
z_0 = $[2];
}
return z_0;
}
```
@@ -6,4 +6,5 @@ function component() {
}
let z = foo();
return z;
}