fix corner case in merge_vars (#5353)

fixes #5352
This commit is contained in:
Alex Lam S.L
2022-02-13 00:22:34 +00:00
committed by GitHub
parent 63b92ead4e
commit 316245ee12
2 changed files with 44 additions and 1 deletions

View File

@@ -6029,7 +6029,7 @@ Compressor.prototype.compress = function(node) {
if (node instanceof AST_Call) {
var exp = node.expression;
var tail = exp.tail_node();
if (!is_lambda(tail)) {
if (!(tail instanceof AST_LambdaExpression)) {
descend();
return mark_expression(exp);
}
@@ -6042,6 +6042,23 @@ Compressor.prototype.compress = function(node) {
tail.walk(tw);
return true;
}
if (node instanceof AST_Class) {
if (node.name) node.name.walk(tw);
if (node.extends) node.extends.walk(tw);
node.properties.filter(function(prop) {
if (prop.key instanceof AST_Node) prop.key.walk(tw);
return prop.value;
}).forEach(function(prop) {
if (prop.static) {
prop.value.walk(tw);
} else {
push(tw);
prop.value.walk(tw);
pop(tw);
}
});
return true;
}
if (node instanceof AST_Conditional) {
walk_cond(node.condition, node.consequent, node.alternative);
return true;