return !compressor.option("pure_getters")
|| this._dot_throw(compressor);
});
-
function is_strict(compressor) {
return /strict/.test(compressor.option("pure_getters"));
}
-
def(AST_Node, is_strict);
- def(AST_Null, return_true);
- def(AST_Undefined, return_true);
- def(AST_Constant, return_false);
def(AST_Array, return_false);
- def(AST_Object, function(compressor) {
- if (!is_strict(compressor)) return false;
- for (var i = this.properties.length; --i >=0;)
- if (this.properties[i].value instanceof AST_Accessor) return true;
- return false;
- });
- def(AST_Lambda, return_false);
- def(AST_UnaryPostfix, return_false);
- def(AST_UnaryPrefix, function() {
- return this.operator == "void";
- });
- def(AST_Binary, function(compressor) {
- return (this.operator == "&&" || this.operator == "||")
- && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor));
- })
def(AST_Assign, function(compressor) {
return this.operator == "="
&& this.right._dot_throw(compressor);
})
+ def(AST_Binary, function(compressor) {
+ return (this.operator == "&&" || this.operator == "||")
+ && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor));
+ })
def(AST_Conditional, function(compressor) {
return this.consequent._dot_throw(compressor)
|| this.alternative._dot_throw(compressor);
})
+ def(AST_Constant, return_false);
def(AST_Dot, function(compressor) {
if (!is_strict(compressor)) return false;
var exp = this.expression;
if (exp instanceof AST_SymbolRef) exp = exp.fixed_value();
return !(exp instanceof AST_Lambda && this.property == "prototype");
});
+ def(AST_Lambda, return_false);
+ def(AST_Null, return_true);
+ def(AST_Object, function(compressor) {
+ if (!is_strict(compressor)) return false;
+ for (var i = this.properties.length; --i >=0;)
+ if (this.properties[i].value instanceof AST_Accessor) return true;
+ return false;
+ });
def(AST_Sequence, function(compressor) {
return this.tail_node()._dot_throw(compressor);
});
var fixed = this.fixed_value();
return !fixed || fixed._dot_throw(compressor);
});
+ def(AST_UnaryPrefix, function() {
+ return this.operator == "void";
+ });
+ def(AST_UnaryPostfix, return_false);
+ def(AST_Undefined, return_true);
})(function(node, func) {
node.DEFMETHOD("_dot_throw", func);
});
def(AST_Sequence, function(compressor) {
return this.tail_node().is_boolean(compressor);
});
+ def(AST_SymbolRef, function(compressor) {
+ var fixed = this.fixed_value();
+ return fixed && fixed.is_boolean(compressor);
+ });
var unary = makePredicate("! delete");
def(AST_UnaryPrefix, function() {
return unary[this.operator];
return true;
}
def(AST_Node, return_false);
+ def(AST_Array, function() {
+ return all(this.elements);
+ });
+ def(AST_Binary, function() {
+ return this.left.is_constant_expression() && this.right.is_constant_expression();
+ });
def(AST_Constant, return_true);
def(AST_Lambda, function(scope) {
var self = this;
}));
return result;
});
- def(AST_Unary, function() {
- return this.expression.is_constant_expression();
- });
- def(AST_Binary, function() {
- return this.left.is_constant_expression() && this.right.is_constant_expression();
- });
- def(AST_Array, function() {
- return all(this.elements);
- });
def(AST_Object, function() {
return all(this.properties);
});
def(AST_ObjectProperty, function() {
return this.value.is_constant_expression();
});
+ def(AST_Unary, function() {
+ return this.expression.is_constant_expression();
+ });
})(function(node, func) {
node.DEFMETHOD("is_constant_expression", func);
});