Skip to content

Commit be4a51b

Browse files
committed
[compiler] Add repro for IIFE in ternary causing a bailout
1 parent 56408a5 commit be4a51b

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
## Input
3+
4+
```javascript
5+
function Component(props) {
6+
const x = props.foo
7+
? 1
8+
: (() => {
9+
throw new Error('Did not receive 1');
10+
})();
11+
return items;
12+
}
13+
14+
```
15+
16+
17+
## Error
18+
19+
```
20+
2 | const x = props.foo
21+
3 | ? 1
22+
> 4 | : (() => {
23+
| ^^^^^^^^
24+
> 5 | throw new Error('Did not receive 1');
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
> 6 | })();
27+
| ^^^^^^^^^^^ Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (4:6)
28+
7 | return items;
29+
8 | }
30+
9 |
31+
```
32+
33+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function Component(props) {
2+
const x = props.foo
3+
? 1
4+
: (() => {
5+
throw new Error('Did not receive 1');
6+
})();
7+
return items;
8+
}

compiler/yarn.lock

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,6 @@
542542
resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz"
543543
integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==
544544

545-
"@babel/helper-string-parser@^7.27.1":
546-
version "7.27.1"
547-
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687"
548-
integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==
549-
550545
"@babel/helper-validator-identifier@^7.19.1", "@babel/helper-validator-identifier@^7.25.9":
551546
version "7.25.9"
552547
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz"
@@ -1605,22 +1600,14 @@
16051600
debug "^4.3.1"
16061601
globals "^11.1.0"
16071602

1608-
"@babel/types@^7.0.0", "@babel/types@^7.19.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.2", "@babel/types@^7.24.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.4":
1603+
"@babel/types@7.26.3", "@babel/types@^7.0.0", "@babel/types@^7.19.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.2", "@babel/types@^7.24.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.10", "@babel/types@^7.26.3", "@babel/types@^7.27.0", "@babel/types@^7.27.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.4":
16091604
version "7.26.3"
16101605
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0"
16111606
integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==
16121607
dependencies:
16131608
"@babel/helper-string-parser" "^7.25.9"
16141609
"@babel/helper-validator-identifier" "^7.25.9"
16151610

1616-
"@babel/types@^7.26.10", "@babel/types@^7.27.0", "@babel/types@^7.27.1":
1617-
version "7.27.1"
1618-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.1.tgz#9defc53c16fc899e46941fc6901a9eea1c9d8560"
1619-
integrity sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==
1620-
dependencies:
1621-
"@babel/helper-string-parser" "^7.27.1"
1622-
"@babel/helper-validator-identifier" "^7.27.1"
1623-
16241611
"@bcoe/v8-coverage@^0.2.3":
16251612
version "0.2.3"
16261613
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"

0 commit comments

Comments
 (0)