def(AST_ObjectProperty, function(compressor){
return this.value.may_throw(compressor);
});
+ def(AST_Return, function(compressor){
+ return this.value.may_throw(compressor);
+ });
def(AST_Sequence, function(compressor){
return any(this.expressions, compressor);
});
return !this.is_declared(compressor);
});
def(AST_Try, function(compressor){
- return any(this.body, compressor)
- || this.bcatch && this.bcatch.may_throw(compressor)
+ return this.bcatch ? this.bcatch.may_throw(compressor) : any(this.body, compressor)
|| this.bfinally && this.bfinally.may_throw(compressor);
});
def(AST_Unary, function(compressor){
node = parent;
parent = compressor.parent(level++);
if (parent instanceof AST_Exit) {
- if (in_try(level, parent instanceof AST_Throw)) break;
+ if (in_try(level, parent)) break;
if (is_reachable(def.scope, [ def ])) break;
if (self.operator == "=") return self.right;
def.fixed = false;
}
return self;
- function in_try(level, no_catch) {
+ function in_try(level, node) {
+ var right = self.right;
+ self.right = make_node(AST_Null, right);
+ var may_throw = node.may_throw(compressor);
+ self.right = right;
var scope = self.left.definition().scope;
var parent;
while ((parent = compressor.parent(level++)) !== scope) {
if (parent instanceof AST_Try) {
if (parent.bfinally) return true;
- if (no_catch && parent.bcatch) return true;
+ if (may_throw && parent.bcatch) return true;
}
}
}