aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6709d8e6..abb00c29 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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")