Compare commits

...

1 Commits

Author SHA1 Message Date
Mofei Zhang
489fee593d [compiler][be] repro edge cases for noEmit and module opt-outs
see test fixtures
2025-05-07 17:09:04 -04:00
4 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
## Input
```javascript
// @panicThreshold(none)
'use no memo';
function Foo() {
return <button onClick={() => alert('hello!')}>Click me!</button>;
}
```
## Code
```javascript
// @panicThreshold(none)
"use no memo";
function Foo() {
return <button onClick={() => alert("hello!")}>Click me!</button>;
}
function _temp() {
return alert("hello!");
}
```
### Eval output
(kind: exception) Fixture not implemented

View File

@@ -0,0 +1,6 @@
// @panicThreshold(none)
'use no memo';
function Foo() {
return <button onClick={() => alert('hello!')}>Click me!</button>;
}

View File

@@ -0,0 +1,48 @@
## Input
```javascript
// @noEmit
function Foo() {
'use memo';
return <button onClick={() => alert('hello!')}>Click me!</button>;
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [],
};
```
## Code
```javascript
import { c as _c } from "react/compiler-runtime"; // @noEmit
function Foo() {
"use memo";
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <button onClick={_temp}>Click me!</button>;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
function _temp() {
return alert("hello!");
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [],
};
```
### Eval output
(kind: ok) <button>Click me!</button>

View File

@@ -0,0 +1,11 @@
// @noEmit
function Foo() {
'use memo';
return <button onClick={() => alert('hello!')}>Click me!</button>;
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [],
};