File tree 3 files changed +83
-1
lines changed
3 files changed +83
-1
lines changed Original file line number Diff line number Diff line change @@ -13888,7 +13888,10 @@ Compressor.prototype.compress = function(node) {
13888
13888
var abort = false;
13889
13889
stat.walk(new TreeWalker(function(node) {
13890
13890
if (abort) return true;
13891
- if (async && node instanceof AST_Await || node instanceof AST_Return) return abort = true;
13891
+ if (async && (node instanceof AST_Await || node instanceof AST_ForAwaitOf)
13892
+ || node instanceof AST_Return) {
13893
+ return abort = true;
13894
+ }
13892
13895
if (node instanceof AST_Scope) return true;
13893
13896
}));
13894
13897
return !abort;
Original file line number Diff line number Diff line change @@ -3540,3 +3540,61 @@ issue_5634_3_side_effects: {
3540
3540
]
3541
3541
node_version: ">=8"
3542
3542
}
3543
+
3544
+ issue_5692_1: {
3545
+ options = {
3546
+ awaits : true ,
3547
+ inline : true ,
3548
+ }
3549
+ input: {
3550
+ ( async function ( ) {
3551
+ ( async function ( ) {
3552
+ for await ( var k of [ ] ) ;
3553
+ } ) ( ) ;
3554
+ console . log ( "foo" ) ;
3555
+ } ) ( ) ;
3556
+ console . log ( "bar" ) ;
3557
+ }
3558
+ expect: {
3559
+ ( async function ( ) {
3560
+ ( async function ( ) {
3561
+ for await ( var k of [ ] ) ;
3562
+ } ) ( ) ;
3563
+ console . log ( "foo" ) ;
3564
+ } ) ( ) ;
3565
+ console . log ( "bar" ) ;
3566
+ }
3567
+ expect_stdout: [
3568
+ "foo" ,
3569
+ "bar" ,
3570
+ ]
3571
+ node_version: ">=10"
3572
+ }
3573
+
3574
+ issue_5692_2: {
3575
+ options = {
3576
+ awaits : true ,
3577
+ inline : true ,
3578
+ }
3579
+ input: {
3580
+ ( async function ( ) {
3581
+ ( async function ( ) {
3582
+ for ( var k of [ ] ) ;
3583
+ } ) ( ) ;
3584
+ console . log ( "foo" ) ;
3585
+ } ) ( ) ;
3586
+ console . log ( "bar" ) ;
3587
+ }
3588
+ expect: {
3589
+ ( async function ( ) {
3590
+ for ( var k of [ ] ) ;
3591
+ console . log ( "foo" ) ;
3592
+ } ) ( ) ;
3593
+ console . log ( "bar" ) ;
3594
+ }
3595
+ expect_stdout: [
3596
+ "foo" ,
3597
+ "bar" ,
3598
+ ]
3599
+ node_version: ">=8"
3600
+ }
Original file line number Diff line number Diff line change @@ -8719,3 +8719,24 @@ single_use_inline_collision: {
8719
8719
}
8720
8720
expect_stdout: "PASS"
8721
8721
}
8722
+
8723
+ issue_5692: {
8724
+ options = {
8725
+ inline : true ,
8726
+ }
8727
+ input: {
8728
+ ( function ( ) {
8729
+ while ( console . log ( "PASS" ) )
8730
+ if ( console )
8731
+ return ;
8732
+ } ) ( ) ;
8733
+ }
8734
+ expect: {
8735
+ ( function ( ) {
8736
+ while ( console . log ( "PASS" ) )
8737
+ if ( console )
8738
+ return ;
8739
+ } ) ( ) ;
8740
+ }
8741
+ expect_stdout: "PASS"
8742
+ }
You can’t perform that action at this time.
0 commit comments