diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.expect.md
index 7a3ddf443f43f..2d7bc3f046e45 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.expect.md
@@ -2,22 +2,31 @@
## Input
```javascript
+import {makeArray} from 'shared-runtime';
+
function Component(props) {
- const x = foo(...props.a, null, ...props.b);
+ const x = makeArray(...props.a, null, ...props.b);
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: [1, 2], b: [2, 3, 4]}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
+import { makeArray } from "shared-runtime";
+
function Component(props) {
const $ = _c(3);
let t0;
if ($[0] !== props.a || $[1] !== props.b) {
- t0 = foo(...props.a, null, ...props.b);
+ t0 = makeArray(...props.a, null, ...props.b);
$[0] = props.a;
$[1] = props.b;
$[2] = t0;
@@ -28,5 +37,12 @@ function Component(props) {
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: [1, 2], b: [2, 3, 4] }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) [1,2,null,2,3,4]
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.js
index 5e73773bd1d24..8b7767c3bf890 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call-spread.js
@@ -1,4 +1,11 @@
+import {makeArray} from 'shared-runtime';
+
function Component(props) {
- const x = foo(...props.a, null, ...props.b);
+ const x = makeArray(...props.a, null, ...props.b);
return x;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: [1, 2], b: [2, 3, 4]}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md
index f9ce3f2e98cf5..061e64222eef0 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -15,14 +17,28 @@ function component(foo, bar) {
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
+
```
## 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 x;
if ($[0] !== bar || $[1] !== foo) {
x = { foo };
@@ -44,5 +60,21 @@ function component(foo, bar) {
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ foo: 2, bar: 3 }],
+ sequentialRenders: [
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 4 },
+ { foo: 3, bar: 4 },
+ ],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"foo":2}
+{"foo":2}
+{"foo":2}
+{"foo":3}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.js
index a83acfcdb0e46..8579e8c4943f6 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.js
@@ -1,4 +1,6 @@
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -10,3 +12,14 @@ function component(foo, bar) {
mutate(y);
return x;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md
index 38590d1559bb5..fb44f2c7b8f24 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -15,14 +17,28 @@ function component(foo, bar) {
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
+
```
## 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 x;
if ($[0] !== bar || $[1] !== foo) {
x = { foo };
@@ -44,5 +60,21 @@ function component(foo, bar) {
return x;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ foo: 2, bar: 3 }],
+ sequentialRenders: [
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 4 },
+ { foo: 3, bar: 4 },
+ ],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"foo":2}
+{"foo":2}
+{"foo":2}
+{"foo":3}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.js
index 2a30bfbce197d..24dddd4910e08 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.js
@@ -1,4 +1,6 @@
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -10,3 +12,14 @@ function component(foo, bar) {
mutate(y);
return x;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md
index 7c94c33e495a8..e9cb3c4fd145b 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md
@@ -2,7 +2,8 @@
## Input
```javascript
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -15,14 +16,27 @@ function component(foo, bar) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
+
```
## 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 };
@@ -44,5 +58,21 @@ function component(foo, bar) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ foo: 2, bar: 3 }],
+ sequentialRenders: [
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 3 },
+ { foo: 2, bar: 4 },
+ { foo: 3, bar: 4 },
+ ],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"bar":3,"wat0":"joe"}
+{"bar":3,"wat0":"joe"}
+{"bar":4,"wat0":"joe"}
+{"bar":4,"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.js
index 5b7665498dfd6..f757078e73266 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.js
@@ -1,4 +1,5 @@
-function component(foo, bar) {
+import {mutate} from 'shared-runtime';
+function Component({foo, bar}) {
let x = {foo};
let y = {bar};
const f0 = function () {
@@ -10,3 +11,14 @@ function component(foo, bar) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{foo: 2, bar: 3}],
+ sequentialRenders: [
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 3},
+ {foo: 2, bar: 4},
+ {foo: 3, bar: 4},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md
index 1a561453a915e..513718ba8606b 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md
@@ -2,7 +2,8 @@
## Input
```javascript
-function component(a) {
+import {mutate} from 'shared-runtime';
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -13,14 +14,22 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a) {
+import { mutate } from "shared-runtime";
+function Component(t0) {
const $ = _c(2);
+ const { a } = t0;
let y;
if ($[0] !== a) {
const x = { a };
@@ -39,5 +48,15 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2 }],
+ sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"x":{"a":2},"wat0":"joe"}
+{"x":{"a":2},"wat0":"joe"}
+{"x":{"a":3},"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.js
index a66039c9ad283..daa4fffb28df8 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.js
@@ -1,4 +1,5 @@
-function component(a) {
+import {mutate} from 'shared-runtime';
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -8,3 +9,9 @@ function component(a) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md
index 386cbec42db64..ae145f4d9e2eb 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md
@@ -2,7 +2,8 @@
## Input
```javascript
-function component(a) {
+import {mutate} from 'shared-runtime';
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -13,14 +14,22 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a) {
+import { mutate } from "shared-runtime";
+function Component(t0) {
const $ = _c(2);
+ const { a } = t0;
let y;
if ($[0] !== a) {
const x = { a };
@@ -39,5 +48,15 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2 }],
+ sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"x":{"a":2},"wat0":"joe"}
+{"x":{"a":2},"wat0":"joe"}
+{"x":{"a":3},"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.js
index f528a8c02bc9a..524dc8af35601 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.js
@@ -1,4 +1,5 @@
-function component(a) {
+import {mutate} from 'shared-runtime';
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -8,3 +9,9 @@ function component(a) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md
index 90df65c6ae425..d65e9cca92740 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -14,14 +16,23 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a) {
+import { mutate } from "shared-runtime";
+
+function Component(t0) {
const $ = _c(2);
+ const { a } = t0;
let y;
if ($[0] !== a) {
const x = { a };
@@ -41,5 +52,15 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2 }],
+ sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"x":{"a":2},"wat0":"joe"}
+{"x":{"a":2},"wat0":"joe"}
+{"x":{"a":3},"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.js
index d0a1f62320605..b4f645846c5be 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.js
@@ -1,4 +1,6 @@
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -9,3 +11,9 @@ function component(a) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md
index e26f048efba9a..deb78c79e08ed 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -14,14 +16,23 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a) {
+import { mutate } from "shared-runtime";
+
+function Component(t0) {
const $ = _c(2);
+ const { a } = t0;
let y;
if ($[0] !== a) {
const x = { a };
@@ -41,5 +52,15 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2 }],
+ sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"x":{"a":2},"wat0":"joe"}
+{"x":{"a":2},"wat0":"joe"}
+{"x":{"a":3},"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.js
index e34a03ec87742..a82df6b27fff8 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.js
@@ -1,4 +1,6 @@
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -9,3 +11,9 @@ function component(a) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md
index bdee721b5820e..0e2d77023996a 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -13,14 +15,23 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a) {
+import { mutate } from "shared-runtime";
+
+function Component(t0) {
const $ = _c(2);
+ const { a } = t0;
let y;
if ($[0] !== a) {
const x = { a };
@@ -39,5 +50,15 @@ function component(a) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2 }],
+ sequentialRenders: [{ a: 2 }, { a: 2 }, { a: 3 }],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"a":2,"wat0":"joe"}
+{"a":2,"wat0":"joe"}
+{"a":3,"wat0":"joe"}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.js
index 39e87de8c089d..22764fec72e6e 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-simple-alias.js
@@ -1,4 +1,6 @@
-function component(a) {
+import {mutate} from 'shared-runtime';
+
+function Component({a}) {
let x = {a};
let y = {};
const f0 = function () {
@@ -8,3 +10,9 @@ function component(a) {
mutate(y);
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2}],
+ sequentialRenders: [{a: 2}, {a: 2}, {a: 3}],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md
index 4087dc53c98f2..6364e83deb9a2 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(a, b) {
+import {mutate} from 'shared-runtime';
+
+function Component({a, b}) {
let z = {a};
(function () {
mutate(z);
@@ -17,14 +19,28 @@ function component(a, b) {
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2, b: 3}],
+ sequentialRenders: [
+ {a: 2, b: 3},
+ {a: 2, b: 3},
+ {a: 2, b: 4},
+ {a: 3, b: 4},
+ ],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a, b) {
+import { mutate } from "shared-runtime";
+
+function Component(t0) {
const $ = _c(7);
+ const { a, b } = t0;
let z;
if ($[0] !== a) {
z = { a };
@@ -37,27 +53,43 @@ function component(a, b) {
}
let y = z;
- let t0;
+ let t1;
if ($[2] !== b) {
- t0 = { b };
+ t1 = { b };
$[2] = b;
- $[3] = t0;
+ $[3] = t1;
} else {
- t0 = $[3];
+ t1 = $[3];
}
- const z_0 = t0;
- let t1;
+ const z_0 = t1;
+ let t2;
if ($[4] !== y || $[5] !== z_0) {
- t1 = { y, z: z_0 };
+ t2 = { y, z: z_0 };
$[4] = y;
$[5] = z_0;
- $[6] = t1;
+ $[6] = t2;
} else {
- t1 = $[6];
+ t2 = $[6];
}
- y = t1;
+ y = t2;
return y;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{ a: 2, b: 3 }],
+ sequentialRenders: [
+ { a: 2, b: 3 },
+ { a: 2, b: 3 },
+ { a: 2, b: 4 },
+ { a: 3, b: 4 },
+ ],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"y":{"a":2,"wat0":"joe"},"z":{"b":3}}
+{"y":{"a":2,"wat0":"joe"},"z":{"b":3}}
+{"y":{"a":2,"wat0":"joe"},"z":{"b":4}}
+{"y":{"a":3,"wat0":"joe"},"z":{"b":4}}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.js
index ad1a1f03c105c..b13e563ea820f 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.js
@@ -1,4 +1,6 @@
-function component(a, b) {
+import {mutate} from 'shared-runtime';
+
+function Component({a, b}) {
let z = {a};
(function () {
mutate(z);
@@ -12,3 +14,14 @@ function component(a, b) {
}
return y;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: Component,
+ params: [{a: 2, b: 3}],
+ sequentialRenders: [
+ {a: 2, b: 3},
+ {a: 2, b: 3},
+ {a: 2, b: 4},
+ {a: 3, b: 4},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md
index 2f827d699a90c..c42aa4c48c5fd 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md
@@ -2,8 +2,7 @@
## Input
```javascript
-// @debug
-function component(a, b) {
+function useHook(a, b) {
let z = {a};
let y = b;
let x = function () {
@@ -22,8 +21,8 @@ function component(a, b) {
## Code
```javascript
-import { c as _c } from "react/compiler-runtime"; // @debug
-function component(a, b) {
+import { c as _c } from "react/compiler-runtime";
+function useHook(a, b) {
const $ = _c(5);
let t0;
if ($[0] !== a) {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.js
index 3a1a7d0d297a8..04d6ca29e1fea 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.js
@@ -1,5 +1,4 @@
-// @debug
-function component(a, b) {
+function useHook(a, b) {
let z = {a};
let y = b;
let x = function () {
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md
index edc6fb6d6cba4..034e9781b2356 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md
@@ -2,7 +2,9 @@
## Input
```javascript
-function component(a, b) {
+import {mutate} from 'shared-runtime';
+
+function useHook({a, b}) {
let z = {a};
{
let z = {b};
@@ -13,23 +15,37 @@ function component(a, b) {
return z;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: useHook,
+ params: [{a: 2, b: 3}],
+ sequentialRenders: [
+ {a: 2, b: 3},
+ {a: 2, b: 3},
+ {a: 2, b: 4},
+ {a: 3, b: 4},
+ ],
+};
+
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
-function component(a, b) {
+import { mutate } from "shared-runtime";
+
+function useHook(t0) {
const $ = _c(2);
- let t0;
+ const { a, b } = t0;
+ let t1;
if ($[0] !== a) {
- t0 = { a };
+ t1 = { a };
$[0] = a;
- $[1] = t0;
+ $[1] = t1;
} else {
- t0 = $[1];
+ t1 = $[1];
}
- const z = t0;
+ const z = t1;
const z_0 = { b };
@@ -37,5 +53,21 @@ function component(a, b) {
return z;
}
+export const FIXTURE_ENTRYPOINT = {
+ fn: useHook,
+ params: [{ a: 2, b: 3 }],
+ sequentialRenders: [
+ { a: 2, b: 3 },
+ { a: 2, b: 3 },
+ { a: 2, b: 4 },
+ { a: 3, b: 4 },
+ ],
+};
+
```
-
\ No newline at end of file
+
+### Eval output
+(kind: ok) {"a":2}
+{"a":2}
+{"a":2}
+{"a":3}
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.js
index 1022a8604ab9c..49595f19d7e6f 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.js
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.js
@@ -1,4 +1,6 @@
-function component(a, b) {
+import {mutate} from 'shared-runtime';
+
+function useHook({a, b}) {
let z = {a};
{
let z = {b};
@@ -8,3 +10,14 @@ function component(a, b) {
}
return z;
}
+
+export const FIXTURE_ENTRYPOINT = {
+ fn: useHook,
+ params: [{a: 2, b: 3}],
+ sequentialRenders: [
+ {a: 2, b: 3},
+ {a: 2, b: 3},
+ {a: 2, b: 4},
+ {a: 3, b: 4},
+ ],
+};
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md
index 344b9439078ca..dc0961c61264c 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md
@@ -2,11 +2,17 @@
## Input
```javascript
-function component(a, b) {
+import {Stringify} from 'shared-runtime';
+function Component({a, b}) {
let z = {a};
- let p = () =>