File tree 3 files changed +22
-9
lines changed
tests/pass-1/issue-6405/1
3 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -269,15 +269,7 @@ impl Pure<'_> {
269
269
) ;
270
270
}
271
271
272
- match stmts[ idx] . as_stmt ( ) {
273
- Some ( Stmt :: Return ( ReturnStmt { arg : None , .. } ) ) => {
274
- // Exclude return
275
- new_stmts. extend ( stmts. drain ( ..idx) ) ;
276
- }
277
- _ => {
278
- new_stmts. extend ( stmts. drain ( ..=idx) ) ;
279
- }
280
- }
272
+ new_stmts. extend ( stmts. drain ( ..=idx) ) ;
281
273
282
274
new_stmts. extend ( hoisted_fns) ;
283
275
Original file line number Diff line number Diff line change
1
+ export const fn = ( ) => {
2
+ let val ;
3
+
4
+ if ( ! val ) {
5
+ return undefined ;
6
+ // works as expected if comment out below line
7
+ throw new Error ( 'first' ) ;
8
+ }
9
+
10
+ if ( val . a ?. b !== true ) { // Uncaught TypeError: Cannot read properties of undefined (reading 'a')
11
+ throw new Error ( 'second' ) ;
12
+ }
13
+ return val ;
14
+ }
Original file line number Diff line number Diff line change
1
+ export const fn = ( ) => {
2
+ let val ;
3
+ if ( ! ! val ) {
4
+ if ( val . a ?. b !== ! 0 ) throw Error ( 'second' ) ;
5
+ return val ;
6
+ }
7
+ } ;
You can’t perform that action at this time.
0 commit comments