mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
[compiler][be] repro edge cases for noEmit and module opt-outs (#33144)
see test fixtures --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33144). * #33146 * #33145 * __->__ #33144
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
// @panicThreshold(none)
|
||||
'use no memo';
|
||||
|
||||
function Foo() {
|
||||
return <button onClick={() => alert('hello!')}>Click me!</button>;
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,11 @@
|
||||
// @noEmit
|
||||
|
||||
function Foo() {
|
||||
'use memo';
|
||||
return <button onClick={() => alert('hello!')}>Click me!</button>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [],
|
||||
};
|
||||
Reference in New Issue
Block a user