minor AST cleanup (AST_BlockStatement may inherit from AST_Block)
This commit is contained in:
@@ -682,15 +682,13 @@ merge(Compressor.prototype, {
|
||||
def(AST_Constant, function(){ return false });
|
||||
def(AST_This, function(){ return false });
|
||||
|
||||
function block(){
|
||||
def(AST_Block, function(){
|
||||
for (var i = this.body.length; --i >= 0;) {
|
||||
if (this.body[i].has_side_effects())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
def(AST_Block, block);
|
||||
def(AST_BlockStatement, block);
|
||||
});
|
||||
|
||||
def(AST_SimpleStatement, function(){
|
||||
if (this.body instanceof AST_Function) return false;
|
||||
@@ -780,6 +778,11 @@ merge(Compressor.prototype, {
|
||||
return self.label.references.length == 0 ? self.body : self;
|
||||
});
|
||||
|
||||
OPT(AST_Block, function(self, compressor){
|
||||
self.body = tighten_body(self.body, compressor);
|
||||
return self;
|
||||
});
|
||||
|
||||
OPT(AST_BlockStatement, function(self, compressor){
|
||||
self.body = tighten_body(self.body, compressor);
|
||||
switch (self.body.length) {
|
||||
@@ -789,11 +792,6 @@ merge(Compressor.prototype, {
|
||||
return self;
|
||||
});
|
||||
|
||||
OPT(AST_Block, function(self, compressor){
|
||||
self.body = tighten_body(self.body, compressor);
|
||||
return self;
|
||||
});
|
||||
|
||||
AST_Scope.DEFMETHOD("drop_unused", function(compressor){
|
||||
var self = this;
|
||||
if (compressor.option("unused")
|
||||
|
||||
Reference in New Issue
Block a user