File tree Expand file tree Collapse file tree 2 files changed +116
-1
lines changed
Expand file tree Collapse file tree 2 files changed +116
-1
lines changed Original file line number Diff line number Diff line change @@ -14372,7 +14372,13 @@ Compressor.prototype.compress = function(node) {
1437214372 if (!all(def.orig, function(sym) {
1437314373 if (sym instanceof AST_SymbolConst) return false;
1437414374 if (sym instanceof AST_SymbolFunarg) return !sym.unused && def.scope.resolve() !== fn;
14375- if (sym instanceof AST_SymbolLambda) return !compressor.option("ie") || sym.scope === def.scope;
14375+ if (sym instanceof AST_SymbolLambda) {
14376+ if (!compressor.option("ie")) return true;
14377+ if (sym.scope === def.scope) return true;
14378+ return !all(def.orig, function(decl) {
14379+ return !(decl instanceof AST_SymbolVar);
14380+ });
14381+ }
1437614382 if (sym instanceof AST_SymbolLet) return false;
1437714383 return true;
1437814384 })) return;
Original file line number Diff line number Diff line change @@ -3476,6 +3476,43 @@ issue_5350_ie: {
34763476}
34773477
34783478issue_5958: {
3479+ options = {
3480+ dead_code : true ,
3481+ evaluate : true ,
3482+ ie : false ,
3483+ inline : true ,
3484+ loops : true ,
3485+ sequences : true ,
3486+ toplevel : true ,
3487+ }
3488+ input: {
3489+ "use strict" ;
3490+ while ( function ( ) {
3491+ if ( a === console . log ( "PASS" ) ) {
3492+ var a = function b ( ) { } ;
3493+ try {
3494+ a ++ ;
3495+ } catch ( b ) {
3496+ b [ a ] ;
3497+ }
3498+ }
3499+ } ( ) ) ;
3500+ }
3501+ expect: {
3502+ "use strict" ;
3503+ if ( a = void 0 , a === console . log ( "PASS" ) ) {
3504+ var a = function b ( ) { } ;
3505+ try {
3506+ a ++ ;
3507+ } catch ( b ) {
3508+ b [ a ] ;
3509+ }
3510+ }
3511+ }
3512+ expect_stdout: "PASS"
3513+ }
3514+
3515+ issue_5958_ie: {
34793516 options = {
34803517 dead_code : true ,
34813518 evaluate : true ,
@@ -3511,3 +3548,75 @@ issue_5958: {
35113548 }
35123549 expect_stdout: "PASS"
35133550}
3551+
3552+ issue_5961: {
3553+ options = {
3554+ ie : false ,
3555+ inline : true ,
3556+ toplevel : true ,
3557+ }
3558+ input: {
3559+ for ( var a in [ 1 , 2 ] ) {
3560+ ( function ( ) {
3561+ try {
3562+ ( function f ( ) { } ) ;
3563+ } finally {
3564+ var b = f , f = "FAIL" ;
3565+ console . log ( b || "PASS" ) ;
3566+ }
3567+ } ) ( ) ;
3568+ }
3569+ }
3570+ expect: {
3571+ for ( var a in [ 1 , 2 ] ) {
3572+ b = void 0 ;
3573+ f = void 0 ;
3574+ try {
3575+ ( function f ( ) { } ) ;
3576+ } finally {
3577+ var b = f , f = "FAIL" ;
3578+ console . log ( b || "PASS" ) ;
3579+ }
3580+ }
3581+ }
3582+ expect_stdout: [
3583+ "PASS" ,
3584+ "PASS" ,
3585+ ]
3586+ }
3587+
3588+ issue_5961_ie: {
3589+ options = {
3590+ ie : true ,
3591+ inline : true ,
3592+ toplevel : true ,
3593+ }
3594+ input: {
3595+ for ( var a in [ 1 , 2 ] ) {
3596+ ( function ( ) {
3597+ try {
3598+ ( function f ( ) { } ) ;
3599+ } finally {
3600+ var b = f , f = "FAIL" ;
3601+ console . log ( b || "PASS" ) ;
3602+ }
3603+ } ) ( ) ;
3604+ }
3605+ }
3606+ expect: {
3607+ for ( var a in [ 1 , 2 ] ) {
3608+ b = void 0 ;
3609+ f = void 0 ;
3610+ try {
3611+ ( function f ( ) { } ) ;
3612+ } finally {
3613+ var b = f , f = "FAIL" ;
3614+ console . log ( b || "PASS" ) ;
3615+ }
3616+ }
3617+ }
3618+ expect_stdout: [
3619+ "PASS" ,
3620+ "PASS" ,
3621+ ]
3622+ }
You can’t perform that action at this time.
0 commit comments