File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2481,6 +2481,20 @@ merge(Compressor.prototype, {
2481
2481
} ) ;
2482
2482
2483
2483
OPT ( AST_Call , function ( self , compressor ) {
2484
+ if ( compressor . option ( "unused" )
2485
+ && self . expression instanceof AST_Function
2486
+ && ! self . expression . uses_arguments
2487
+ && ! self . expression . uses_eval
2488
+ && self . args . length > self . expression . argnames . length ) {
2489
+ var end = self . expression . argnames . length ;
2490
+ for ( var i = end , len = self . args . length ; i < len ; i ++ ) {
2491
+ var node = self . args [ i ] . drop_side_effect_free ( compressor ) ;
2492
+ if ( node ) {
2493
+ self . args [ end ++ ] = node ;
2494
+ }
2495
+ }
2496
+ self . args . length = end ;
2497
+ }
2484
2498
if ( compressor . option ( "unsafe" ) ) {
2485
2499
var exp = self . expression ;
2486
2500
if ( exp instanceof AST_SymbolRef && exp . undeclared ( ) ) {
Original file line number Diff line number Diff line change @@ -646,6 +646,29 @@ call_args: {
646
646
}
647
647
}
648
648
649
+ call_args_drop_param: {
650
+ options = {
651
+ evaluate : true ,
652
+ keep_fargs : false ,
653
+ reduce_vars : true ,
654
+ unused : true ,
655
+ }
656
+ input: {
657
+ const a = 1 ;
658
+ console . log ( a ) ;
659
+ + function ( a ) {
660
+ return a ;
661
+ } ( a , b ) ;
662
+ }
663
+ expect: {
664
+ const a = 1 ;
665
+ console . log ( 1 ) ;
666
+ + function ( ) {
667
+ return 1 ;
668
+ } ( b ) ;
669
+ }
670
+ }
671
+
649
672
in_boolean_context: {
650
673
options = {
651
674
booleans : true ,
You can’t perform that action at this time.
0 commit comments