File tree Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -3595,8 +3595,8 @@ Compressor.prototype.compress = function(node) {
3595
3595
stat = stat.clone();
3596
3596
exprs.push(stat.condition);
3597
3597
stat.condition = make_sequence(stat, exprs);
3598
- stat.alternative = make_node(AST_BlockStatement, next , {
3599
- body: extract_functions().concat(make_node(AST_Return, next , { value: null })),
3598
+ stat.alternative = make_node(AST_BlockStatement, self , {
3599
+ body: extract_functions().concat(make_node(AST_Return, self , { value: null })),
3600
3600
});
3601
3601
statements[i] = stat.transform(compressor);
3602
3602
i = prev + 1;
Original file line number Diff line number Diff line change @@ -1203,3 +1203,53 @@ issue_5382: {
1203
1203
expect_stdout: "PASS"
1204
1204
node_version: ">=8.3.0"
1205
1205
}
1206
+
1207
+ issue_5602: {
1208
+ options = {
1209
+ collapse_vars : true ,
1210
+ conditionals : true ,
1211
+ evaluate : true ,
1212
+ if_return : true ,
1213
+ inline : true ,
1214
+ passes : 2 ,
1215
+ sequences : true ,
1216
+ spreads : true ,
1217
+ unused : true ,
1218
+ }
1219
+ input: {
1220
+ ( function ( ) {
1221
+ try {
1222
+ var b = function ( c ) {
1223
+ if ( c )
1224
+ return FAIL ;
1225
+ var d = 42 ;
1226
+ } ( ...[ null , A = 0 ] ) ;
1227
+ } catch ( e ) {
1228
+ b ( ) ;
1229
+ }
1230
+ } ) ( ) ;
1231
+ console . log ( A ) ;
1232
+ }
1233
+ expect: {
1234
+ ( function ( ) {
1235
+ try {
1236
+ var b = void ( A = 0 ) ;
1237
+ } catch ( e ) {
1238
+ b ( ) ;
1239
+ }
1240
+ } ) ( ) ,
1241
+ console . log ( A ) ;
1242
+ }
1243
+ expect_stdout: "0"
1244
+ expect_warnings: [
1245
+ "INFO: Dropping unused variable d [test/compress/spreads.js:6,24]" ,
1246
+ "INFO: Collapsing c [test/compress/spreads.js:4,24]" ,
1247
+ "INFO: Dropping unused variable c [test/compress/spreads.js:3,33]" ,
1248
+ "INFO: pass 0: last_count: Infinity, count: 27" ,
1249
+ "WARN: Condition always false [test/compress/spreads.js:4,20]" ,
1250
+ "INFO: Collapsing null [test/compress/spreads.js:7,23]" ,
1251
+ "INFO: Collapsing 0 [test/compress/spreads.js:3,24]" ,
1252
+ "INFO: pass 1: last_count: 27, count: 22" ,
1253
+ ]
1254
+ node_version: ">=6"
1255
+ }
You can’t perform that action at this time.
0 commit comments