Skip to content

Commit 489fee5

Browse files
committed
[compiler][be] repro edge cases for noEmit and module opt-outs
see test fixtures
1 parent c129c24 commit 489fee5

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
## Input
3+
4+
```javascript
5+
// @panicThreshold(none)
6+
'use no memo';
7+
8+
function Foo() {
9+
return <button onClick={() => alert('hello!')}>Click me!</button>;
10+
}
11+
12+
```
13+
14+
## Code
15+
16+
```javascript
17+
// @panicThreshold(none)
18+
"use no memo";
19+
20+
function Foo() {
21+
return <button onClick={() => alert("hello!")}>Click me!</button>;
22+
}
23+
function _temp() {
24+
return alert("hello!");
25+
}
26+
27+
```
28+
29+
### Eval output
30+
(kind: exception) Fixture not implemented
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @panicThreshold(none)
2+
'use no memo';
3+
4+
function Foo() {
5+
return <button onClick={() => alert('hello!')}>Click me!</button>;
6+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
## Input
3+
4+
```javascript
5+
// @noEmit
6+
7+
function Foo() {
8+
'use memo';
9+
return <button onClick={() => alert('hello!')}>Click me!</button>;
10+
}
11+
12+
export const FIXTURE_ENTRYPOINT = {
13+
fn: Foo,
14+
params: [],
15+
};
16+
17+
```
18+
19+
## Code
20+
21+
```javascript
22+
import { c as _c } from "react/compiler-runtime"; // @noEmit
23+
24+
function Foo() {
25+
"use memo";
26+
const $ = _c(1);
27+
let t0;
28+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
29+
t0 = <button onClick={_temp}>Click me!</button>;
30+
$[0] = t0;
31+
} else {
32+
t0 = $[0];
33+
}
34+
return t0;
35+
}
36+
function _temp() {
37+
return alert("hello!");
38+
}
39+
40+
export const FIXTURE_ENTRYPOINT = {
41+
fn: Foo,
42+
params: [],
43+
};
44+
45+
```
46+
47+
### Eval output
48+
(kind: ok) <button>Click me!</button>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @noEmit
2+
3+
function Foo() {
4+
'use memo';
5+
return <button onClick={() => alert('hello!')}>Click me!</button>;
6+
}
7+
8+
export const FIXTURE_ENTRYPOINT = {
9+
fn: Foo,
10+
params: [],
11+
};

0 commit comments

Comments
 (0)