Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

## Input

```javascript
import {useRef} from 'react';

function C(x) {
function g(x) {
return 2;
}
g();
function f() {
return x.x;
}
function h(x) {
return 2;
}
return <>{h(f)}</>;
}

export const FIXTURE_ENTRYPOINT = {
fn: C,
params: [{x: 1}],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { useRef } from "react";

function C(x) {
const $ = _c(5);
const g = function g(x_0) {
return 2;
};

g();
let t0;
if ($[0] !== x.x) {
t0 = function f() {
return x.x;
};
$[0] = x.x;
$[1] = t0;
} else {
t0 = $[1];
}
const f = t0;
let t1;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t1 = function h(x_1) {
return 2;
};
$[2] = t1;
} else {
t1 = $[2];
}
const h = t1;

const t2 = h(f);
let t3;
if ($[3] !== t2) {
t3 = <>{t2}</>;
$[3] = t2;
$[4] = t3;
} else {
t3 = $[4];
}
return t3;
}

export const FIXTURE_ENTRYPOINT = {
fn: C,
params: [{ x: 1 }],
};

```

### Eval output
(kind: ok) 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {useRef} from 'react';

function C(x) {
function g(x) {
return 2;
}
g();
function f() {
return x.x;
}
function h(x) {
return 2;
}
Comment on lines +11 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we intentionally not using x? maybe add a comment with why not

return <>{h(f)}</>;
}

export const FIXTURE_ENTRYPOINT = {
fn: C,
params: [{x: 1}],
};