File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -7251,16 +7251,19 @@ Compressor.prototype.compress = function(node) {
7251
7251
node.name = null;
7252
7252
}
7253
7253
if (node instanceof AST_Lambda) {
7254
- descend_scope();
7255
7254
if (drop_funcs && node !== self && node instanceof AST_LambdaDefinition) {
7256
7255
var def = node.name.definition();
7257
7256
if (!(def.id in in_use_ids)) {
7258
7257
log(node.name, "Dropping unused function {name}");
7259
7258
def.eliminated++;
7260
- if (parent instanceof AST_ExportDefault) return to_func_expr(node, true);
7259
+ if (parent instanceof AST_ExportDefault) {
7260
+ descend_scope();
7261
+ return to_func_expr(node, true);
7262
+ }
7261
7263
return in_list ? List.skip : make_node(AST_EmptyStatement, node);
7262
7264
}
7263
7265
}
7266
+ descend_scope();
7264
7267
if (node instanceof AST_LambdaExpression && node.name && drop_fn_name(node.name.definition())) {
7265
7268
node.name = null;
7266
7269
}
Original file line number Diff line number Diff line change @@ -584,7 +584,9 @@ issue_4668: {
584
584
}
585
585
expect: {
586
586
console . log ( function f ( ) {
587
- ( function g ( ) { } ) ( ) ;
587
+ ( function g ( ) {
588
+ 0 ;
589
+ } ) ( ) ;
588
590
} ( ) ) ;
589
591
}
590
592
expect_stdout: "undefined"
Original file line number Diff line number Diff line change @@ -2018,3 +2018,24 @@ issue_5684: {
2018
2018
expect_stdout: "PASS"
2019
2019
node_version: ">=10"
2020
2020
}
2021
+
2022
+ issue_5707: {
2023
+ options = {
2024
+ hoist_props : true ,
2025
+ reduce_vars : true ,
2026
+ side_effects : true ,
2027
+ toplevel : true ,
2028
+ unused : true ,
2029
+ yields : true ,
2030
+ }
2031
+ input: {
2032
+ var a , b ;
2033
+ function * f ( c = ( b = 42 , console . log ( "PASS" ) ) ) { }
2034
+ b = f ( ) ;
2035
+ }
2036
+ expect: {
2037
+ console . log ( "PASS" ) ;
2038
+ }
2039
+ expect_stdout: "PASS"
2040
+ node_version: ">=6"
2041
+ }
You can’t perform that action at this time.
0 commit comments