populate may_eq_null()
This commit is contained in:
parent
874beea90a
commit
218547048b
|
|
@ -1167,12 +1167,36 @@ merge(Compressor.prototype, {
|
||||||
}
|
}
|
||||||
|
|
||||||
(function(def) {
|
(function(def) {
|
||||||
def(AST_Node, return_false);
|
def(AST_Node, return_true);
|
||||||
def(AST_Null, return_true);
|
def(AST_Null, return_true);
|
||||||
def(AST_Undefined, 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() {
|
def(AST_UnaryPrefix, function() {
|
||||||
return this.operator == "void";
|
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) {
|
def(AST_Seq, function(compressor) {
|
||||||
return this.cdr.may_eq_null(compressor);
|
return this.cdr.may_eq_null(compressor);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user