fix corner case in comparisons (#5486)

fixes #5485
This commit is contained in:
Alex Lam S.L
2022-06-04 17:47:38 +01:00
committed by GitHub
parent ad5f5ef2a3
commit a025392a30
4 changed files with 52 additions and 1 deletions

View File

@@ -1559,7 +1559,10 @@ Compressor.prototype.compress = function(node) {
AST_SymbolRef.DEFMETHOD("is_immutable", function() {
var def = this.redef || this.definition();
return (this.in_arg || def.orig.length == 1) && def.orig[0] instanceof AST_SymbolLambda;
if (!(def.orig[0] instanceof AST_SymbolLambda)) return false;
if (def.orig.length == 1) return true;
if (!this.in_arg) return false;
return !(def.orig[1] instanceof AST_SymbolFunarg);
});
AST_Node.DEFMETHOD("convert_symbol", noop);