File tree 2 files changed +76
-8
lines changed
2 files changed +76
-8
lines changed Original file line number Diff line number Diff line change @@ -624,15 +624,9 @@ Compressor.prototype.compress = function(node) {
624
624
}
625
625
626
626
function pop_scope(tw, scope) {
627
- var fn_defs = scope.fn_defs;
628
- var tangled = scope.may_call_this === return_true ? fn_defs : fn_defs.filter(function(fn) {
629
- if (fn.safe_ids === false) return true;
630
- fn.safe_ids = tw.safe_ids;
631
- walk_fn_def(tw, fn);
632
- return false;
633
- });
634
627
pop(tw);
635
- tangled.forEach(function(fn) {
628
+ var fn_defs = scope.fn_defs;
629
+ fn_defs.forEach(function(fn) {
636
630
fn.safe_ids = tw.safe_ids;
637
631
walk_fn_def(tw, fn);
638
632
});
Original file line number Diff line number Diff line change @@ -8148,3 +8148,77 @@ issue_5730_3: {
8148
8148
}
8149
8149
expect_stdout: "PASS"
8150
8150
}
8151
+
8152
+ issue_5777_1: {
8153
+ options = {
8154
+ reduce_vars : true ,
8155
+ unused : true ,
8156
+ }
8157
+ input: {
8158
+ function f ( ) {
8159
+ ( function ( a ) {
8160
+ function g ( ) {
8161
+ h ( ) ;
8162
+ }
8163
+ g ( ) ;
8164
+ a = function ( ) { } ;
8165
+ function h ( ) {
8166
+ console . log ( a ) ;
8167
+ }
8168
+ } ) ( "PASS" ) ;
8169
+ }
8170
+ f ( ) ;
8171
+ }
8172
+ expect: {
8173
+ function f ( ) {
8174
+ ( function ( a ) {
8175
+ ( function ( ) {
8176
+ h ( ) ;
8177
+ } ) ( ) ;
8178
+ a = function ( ) { } ;
8179
+ function h ( ) {
8180
+ console . log ( a ) ;
8181
+ }
8182
+ } ) ( "PASS" ) ;
8183
+ }
8184
+ f ( ) ;
8185
+ }
8186
+ expect_stdout: "PASS"
8187
+ }
8188
+
8189
+ issue_5777_2: {
8190
+ options = {
8191
+ reduce_vars : true ,
8192
+ toplevel : true ,
8193
+ unused : true ,
8194
+ }
8195
+ input: {
8196
+ function f ( a ) {
8197
+ ( function ( ) {
8198
+ function g ( ) {
8199
+ h ( ) ;
8200
+ }
8201
+ g ( ) ;
8202
+ a = function ( ) { } ;
8203
+ function h ( ) {
8204
+ console . log ( a ) ;
8205
+ }
8206
+ } ) ( ) ;
8207
+ }
8208
+ f ( "PASS" ) ;
8209
+ }
8210
+ expect: {
8211
+ ( function ( a ) {
8212
+ ( function ( ) {
8213
+ ( function ( ) {
8214
+ h ( ) ;
8215
+ } ) ( ) ;
8216
+ a = function ( ) { } ;
8217
+ function h ( ) {
8218
+ console . log ( a ) ;
8219
+ }
8220
+ } ) ( ) ;
8221
+ } ) ( "PASS" ) ;
8222
+ }
8223
+ expect_stdout: "PASS"
8224
+ }
You can’t perform that action at this time.
0 commit comments