fix corner case in reduce_vars (#5047)

fixes #5046
This commit is contained in:
Alex Lam S.L
2021-07-04 06:45:09 +01:00
committed by GitHub
parent 972b9f0bef
commit f4ae267920
2 changed files with 32 additions and 7 deletions

View File

@@ -1000,11 +1000,7 @@ merge(Compressor.prototype, {
arg.walk(tw);
if (arg instanceof AST_Spread) iife = false;
});
if (iife) {
exp.reduce_vars = reduce_iife;
} else {
exp.safe_ids = tw.safe_ids;
}
if (iife) exp.reduce_vars = reduce_iife;
exp.walk(tw);
if (iife) delete exp.reduce_vars;
return true;
@@ -1299,9 +1295,7 @@ merge(Compressor.prototype, {
node.expressions.forEach(function(exp) {
exp.walk(tw);
});
tag.safe_ids = tw.safe_ids;
tag.walk(tw);
delete tag.reduce_vars;
return true;
}
tag.walk(tw);