fix corner case in reduce_vars (#5778)

fixes #5777
This commit is contained in:
Alex Lam S.L
2023-01-16 15:30:45 +02:00
committed by GitHub
parent 57dd3f6a2c
commit a437a61518
2 changed files with 76 additions and 8 deletions

View File

@@ -624,15 +624,9 @@ Compressor.prototype.compress = function(node) {
}
function pop_scope(tw, scope) {
var fn_defs = scope.fn_defs;
var tangled = scope.may_call_this === return_true ? fn_defs : fn_defs.filter(function(fn) {
if (fn.safe_ids === false) return true;
fn.safe_ids = tw.safe_ids;
walk_fn_def(tw, fn);
return false;
});
pop(tw);
tangled.forEach(function(fn) {
var fn_defs = scope.fn_defs;
fn_defs.forEach(function(fn) {
fn.safe_ids = tw.safe_ids;
walk_fn_def(tw, fn);
});