fix corner case in reduce_vars (#5731)

fixes #5730
This commit is contained in:
Alex Lam S.L
2022-11-03 05:05:07 +00:00
committed by GitHub
parent 2b1c321ac8
commit e37a1489d4
2 changed files with 92 additions and 4 deletions

View File

@@ -1441,11 +1441,13 @@ Compressor.prototype.compress = function(node) {
break;
}
if (!ref.fixed) ref.fixed = d.fixed === 0 ? fixed : d.fixed;
var parent;
if (value instanceof AST_Lambda
&& !((parent = tw.parent()) instanceof AST_Call && parent.expression === ref)) {
mark_fn_def(tw, d, value);
if (!value && fixed) value = fixed instanceof AST_Node ? fixed : fixed();
if (!(value instanceof AST_Lambda)) return;
if (d.fixed) {
var parent = tw.parent();
if (parent instanceof AST_Call && parent.expression === ref) return;
}
mark_fn_def(tw, d, value);
});
def(AST_Template, function(tw, descend) {
var node = this;