This commit is contained in:
Mihai Bazon
2012-09-11 18:37:08 +03:00
parent 8e82d8d94c
commit 9a629abe00
2 changed files with 22 additions and 4 deletions

View File

@@ -617,7 +617,7 @@ function Compressor(options, false_by_default) {
if (compressor.option("dead_code")) {
var a = [];
extract_declarations_from_unreachable_code(compressor, self.body, a);
return make_node(AST_BlockStatement, self, { body: a });
return make_node(AST_BlockStatement, self, { body: a }).optimize(compressor);
}
} else {
return self.body;
@@ -626,6 +626,21 @@ function Compressor(options, false_by_default) {
return self;
});
// while(cond){ ... } ==> for(;cond;){ ... }
//
// not helpful, it seems (output is a bit bigger after gzip)
//
// AST_While.DEFMETHOD("optimize", function(compressor){
// var self = AST_DWLoop.prototype.optimize.call(this, compressor);
// if (self instanceof AST_While) {
// self = make_node(AST_For, self, {
// condition: self.condition,
// body: self.body
// }).optimize(compressor);
// }
// return self;
// });
SQUEEZE(AST_For, function(self, compressor){
self = self.clone();
if (self.init) self.init = self.init.squeeze(compressor);