diff --git a/lib/compress.js b/lib/compress.js index 81d84906..656ef757 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1167,12 +1167,36 @@ merge(Compressor.prototype, { } (function(def) { - def(AST_Node, return_false); + def(AST_Node, return_true); def(AST_Null, return_true); def(AST_Undefined, return_true); + def(AST_Constant, return_false); + def(AST_Array, return_false); + def(AST_Object, return_false); + def(AST_Function, return_false); + def(AST_UnaryPostfix, return_false); def(AST_UnaryPrefix, function() { return this.operator == "void"; }); + def(AST_Binary, function(compressor) { + switch (this.operator) { + case "&&": + return this.left.may_eq_null(compressor); + case "||": + return this.left.may_eq_null(compressor) + && this.right.may_eq_null(compressor); + default: + return false; + } + }) + def(AST_Assign, function(compressor) { + return this.operator == "=" + && this.right.may_eq_null(compressor); + }) + def(AST_Conditional, function(compressor) { + return this.consequent.may_eq_null(compressor) + || this.alternative.may_eq_null(compressor); + }) def(AST_Seq, function(compressor) { return this.cdr.may_eq_null(compressor); });