mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
[compiler] Add repro for IIFE in ternary causing a bailout (#33546)
--- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33546). * #33548 * __->__ #33546
This commit is contained in:
parent
5d24c64cc9
commit
75e78d243f
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const x = props.foo
|
||||
? 1
|
||||
: (() => {
|
||||
throw new Error('Did not receive 1');
|
||||
})();
|
||||
return items;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
2 | const x = props.foo
|
||||
3 | ? 1
|
||||
> 4 | : (() => {
|
||||
| ^^^^^^^^
|
||||
> 5 | throw new Error('Did not receive 1');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 6 | })();
|
||||
| ^^^^^^^^^^^ Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (4:6)
|
||||
7 | return items;
|
||||
8 | }
|
||||
9 |
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
function Component(props) {
|
||||
const x = props.foo
|
||||
? 1
|
||||
: (() => {
|
||||
throw new Error('Did not receive 1');
|
||||
})();
|
||||
return items;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user