mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
[compiler][be] Patch test fixtures for evaluator (#31203)
Add more `FIXTURE_ENTRYPOINT`s ' --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31203). * #31202 * __->__ #31203 * #31201 * #31200 * #31521
This commit is contained in:
parent
858633f900
commit
0f3c62b466
|
|
@ -2,39 +2,55 @@
|
|||
## Input
|
||||
|
||||
```javascript
|
||||
function component(foo, bar) {
|
||||
import {mutate} from 'shared-runtime';
|
||||
|
||||
function Component({foo, bar}) {
|
||||
let x = {foo};
|
||||
let y = {bar};
|
||||
const f0 = function () {
|
||||
let a = {y};
|
||||
let a = [y];
|
||||
let b = x;
|
||||
a.x = b;
|
||||
// this writes y.x = x
|
||||
a[0].x = b;
|
||||
};
|
||||
f0();
|
||||
mutate(y);
|
||||
mutate(y.x);
|
||||
return y;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{foo: 3, bar: 4}],
|
||||
sequentialRenders: [
|
||||
{foo: 3, bar: 4},
|
||||
{foo: 3, bar: 5},
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
function component(foo, bar) {
|
||||
import { mutate } from "shared-runtime";
|
||||
|
||||
function Component(t0) {
|
||||
const $ = _c(3);
|
||||
const { foo, bar } = t0;
|
||||
let y;
|
||||
if ($[0] !== bar || $[1] !== foo) {
|
||||
const x = { foo };
|
||||
y = { bar };
|
||||
const f0 = function () {
|
||||
const a = { y };
|
||||
const a = [y];
|
||||
const b = x;
|
||||
a.x = b;
|
||||
|
||||
a[0].x = b;
|
||||
};
|
||||
|
||||
f0();
|
||||
mutate(y);
|
||||
mutate(y.x);
|
||||
$[0] = bar;
|
||||
$[1] = foo;
|
||||
$[2] = y;
|
||||
|
|
@ -44,5 +60,17 @@ function component(foo, bar) {
|
|||
return y;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{ foo: 3, bar: 4 }],
|
||||
sequentialRenders: [
|
||||
{ foo: 3, bar: 4 },
|
||||
{ foo: 3, bar: 5 },
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Eval output
|
||||
(kind: ok) {"bar":4,"x":{"foo":3,"wat0":"joe"}}
|
||||
{"bar":5,"x":{"foo":3,"wat0":"joe"}}
|
||||
|
|
@ -1,12 +1,24 @@
|
|||
function component(foo, bar) {
|
||||
import {mutate} from 'shared-runtime';
|
||||
|
||||
function Component({foo, bar}) {
|
||||
let x = {foo};
|
||||
let y = {bar};
|
||||
const f0 = function () {
|
||||
let a = {y};
|
||||
let a = [y];
|
||||
let b = x;
|
||||
a.x = b;
|
||||
// this writes y.x = x
|
||||
a[0].x = b;
|
||||
};
|
||||
f0();
|
||||
mutate(y);
|
||||
mutate(y.x);
|
||||
return y;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{foo: 3, bar: 4}],
|
||||
sequentialRenders: [
|
||||
{foo: 3, bar: 4},
|
||||
{foo: 3, bar: 5},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,21 +2,28 @@
|
|||
## Input
|
||||
|
||||
```javascript
|
||||
function component(a, b) {
|
||||
import {mutate} from 'shared-runtime';
|
||||
|
||||
function Component({a, b}) {
|
||||
let z = {a};
|
||||
let y = {b};
|
||||
let y = {b: {b}};
|
||||
let x = function () {
|
||||
z.a = 2;
|
||||
console.log(y.b);
|
||||
mutate(y.b);
|
||||
};
|
||||
x();
|
||||
return z;
|
||||
return [y, z];
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: component,
|
||||
params: ['TodoAdd'],
|
||||
isComponent: 'TodoAdd',
|
||||
fn: Component,
|
||||
params: [{a: 2, b: 3}],
|
||||
sequentialRenders: [
|
||||
{a: 2, b: 3},
|
||||
{a: 2, b: 3},
|
||||
{a: 4, b: 3},
|
||||
{a: 4, b: 5},
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
|
@ -25,32 +32,46 @@ export const FIXTURE_ENTRYPOINT = {
|
|||
|
||||
```javascript
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
function component(a, b) {
|
||||
import { mutate } from "shared-runtime";
|
||||
|
||||
function Component(t0) {
|
||||
const $ = _c(3);
|
||||
let z;
|
||||
const { a, b } = t0;
|
||||
let t1;
|
||||
if ($[0] !== a || $[1] !== b) {
|
||||
z = { a };
|
||||
const y = { b };
|
||||
const z = { a };
|
||||
const y = { b: { b } };
|
||||
const x = function () {
|
||||
z.a = 2;
|
||||
console.log(y.b);
|
||||
mutate(y.b);
|
||||
};
|
||||
|
||||
x();
|
||||
t1 = [y, z];
|
||||
$[0] = a;
|
||||
$[1] = b;
|
||||
$[2] = z;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
z = $[2];
|
||||
t1 = $[2];
|
||||
}
|
||||
return z;
|
||||
return t1;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: component,
|
||||
params: ["TodoAdd"],
|
||||
isComponent: "TodoAdd",
|
||||
fn: Component,
|
||||
params: [{ a: 2, b: 3 }],
|
||||
sequentialRenders: [
|
||||
{ a: 2, b: 3 },
|
||||
{ a: 2, b: 3 },
|
||||
{ a: 4, b: 3 },
|
||||
{ a: 4, b: 5 },
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Eval output
|
||||
(kind: ok) [{"b":{"b":3,"wat0":"joe"}},{"a":2}]
|
||||
[{"b":{"b":3,"wat0":"joe"}},{"a":2}]
|
||||
[{"b":{"b":3,"wat0":"joe"}},{"a":2}]
|
||||
[{"b":{"b":5,"wat0":"joe"}},{"a":2}]
|
||||
|
|
@ -1,16 +1,23 @@
|
|||
function component(a, b) {
|
||||
import {mutate} from 'shared-runtime';
|
||||
|
||||
function Component({a, b}) {
|
||||
let z = {a};
|
||||
let y = {b};
|
||||
let y = {b: {b}};
|
||||
let x = function () {
|
||||
z.a = 2;
|
||||
console.log(y.b);
|
||||
mutate(y.b);
|
||||
};
|
||||
x();
|
||||
return z;
|
||||
return [y, z];
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: component,
|
||||
params: ['TodoAdd'],
|
||||
isComponent: 'TodoAdd',
|
||||
fn: Component,
|
||||
params: [{a: 2, b: 3}],
|
||||
sequentialRenders: [
|
||||
{a: 2, b: 3},
|
||||
{a: 2, b: 3},
|
||||
{a: 4, b: 3},
|
||||
{a: 4, b: 5},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component({a, b}) {
|
||||
let z = {a};
|
||||
let y = {b};
|
||||
let x = function () {
|
||||
z.a = 2;
|
||||
return Math.max(y.b, 0);
|
||||
};
|
||||
x();
|
||||
return z;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{a: 2, b: 3}],
|
||||
sequentialRenders: [
|
||||
{a: 2, b: 3},
|
||||
{a: 2, b: 3},
|
||||
{a: 4, b: 3},
|
||||
{a: 4, b: 5},
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
function Component(t0) {
|
||||
const $ = _c(3);
|
||||
const { a, b } = t0;
|
||||
let z;
|
||||
if ($[0] !== a || $[1] !== b) {
|
||||
z = { a };
|
||||
const y = { b };
|
||||
const x = function () {
|
||||
z.a = 2;
|
||||
return Math.max(y.b, 0);
|
||||
};
|
||||
|
||||
x();
|
||||
$[0] = a;
|
||||
$[1] = b;
|
||||
$[2] = z;
|
||||
} else {
|
||||
z = $[2];
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{ a: 2, b: 3 }],
|
||||
sequentialRenders: [
|
||||
{ a: 2, b: 3 },
|
||||
{ a: 2, b: 3 },
|
||||
{ a: 4, b: 3 },
|
||||
{ a: 4, b: 5 },
|
||||
],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Eval output
|
||||
(kind: ok) {"a":2}
|
||||
{"a":2}
|
||||
{"a":2}
|
||||
{"a":2}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
function Component({a, b}) {
|
||||
let z = {a};
|
||||
let y = {b};
|
||||
let x = function () {
|
||||
z.a = 2;
|
||||
return Math.max(y.b, 0);
|
||||
};
|
||||
x();
|
||||
return z;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Component,
|
||||
params: [{a: 2, b: 3}],
|
||||
sequentialRenders: [
|
||||
{a: 2, b: 3},
|
||||
{a: 2, b: 3},
|
||||
{a: 4, b: 3},
|
||||
{a: 4, b: 5},
|
||||
],
|
||||
};
|
||||
|
|
@ -34,7 +34,6 @@ const skipFilter = new Set([
|
|||
'capturing-arrow-function-1',
|
||||
'capturing-func-mutate-3',
|
||||
'capturing-func-mutate-nested',
|
||||
'capturing-func-mutate',
|
||||
'capturing-function-1',
|
||||
'capturing-function-alias-computed-load',
|
||||
'capturing-function-decl',
|
||||
|
|
@ -236,7 +235,6 @@ const skipFilter = new Set([
|
|||
'capturing-fun-alias-captured-mutate-2',
|
||||
'capturing-fun-alias-captured-mutate-arr-2',
|
||||
'capturing-func-alias-captured-mutate-arr',
|
||||
'capturing-func-alias-captured-mutate',
|
||||
'capturing-func-alias-computed-mutate',
|
||||
'capturing-func-alias-mutate',
|
||||
'capturing-func-alias-receiver-computed-mutate',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user