File tree 2 files changed +23
-4
lines changed
2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -2760,10 +2760,12 @@ merge(Compressor.prototype, {
2760
2760
}
2761
2761
}
2762
2762
if ( exp instanceof AST_Function ) {
2763
- if ( exp . body [ 0 ] instanceof AST_Return
2764
- && exp . body [ 0 ] . value . is_constant ( ) ) {
2765
- var args = self . args . concat ( exp . body [ 0 ] . value ) ;
2766
- return AST_Seq . from_array ( args ) . transform ( compressor ) ;
2763
+ if ( exp . body [ 0 ] instanceof AST_Return ) {
2764
+ var value = exp . body [ 0 ] . value ;
2765
+ if ( ! value || value . is_constant ( ) ) {
2766
+ var args = self . args . concat ( value || make_node ( AST_Undefined , self ) ) ;
2767
+ return AST_Seq . from_array ( args ) . transform ( compressor ) ;
2768
+ }
2767
2769
}
2768
2770
if ( compressor . option ( "side_effects" ) ) {
2769
2771
if ( ! AST_Block . prototype . has_side_effects . call ( exp , compressor ) ) {
Original file line number Diff line number Diff line change @@ -74,3 +74,20 @@ iifes_returning_constants_keep_fargs_false: {
74
74
console . log ( ( a ( ) , b ( ) , 6 ) ) ;
75
75
}
76
76
}
77
+
78
+ issue_485_crashing_1530: {
79
+ options = {
80
+ conditionals : true ,
81
+ dead_code : true ,
82
+ evaluate : true ,
83
+ }
84
+ input: {
85
+ ( function ( a ) {
86
+ if ( true ) return ;
87
+ var b = 42 ;
88
+ } ) ( this ) ;
89
+ }
90
+ expect: {
91
+ this , void 0 ;
92
+ }
93
+ }
You can’t perform that action at this time.
0 commit comments