minor
This commit is contained in:
@@ -105,9 +105,9 @@ if (ARGS.stats) {
|
|||||||
/* -----[ functions ]----- */
|
/* -----[ functions ]----- */
|
||||||
|
|
||||||
function do_file_1(file) {
|
function do_file_1(file) {
|
||||||
if (ARGS.v) {
|
// if (ARGS.v) {
|
||||||
sys.error("Compressing " + file);
|
// sys.error("Compressing " + file);
|
||||||
}
|
// }
|
||||||
var code = read_whole_file(file);
|
var code = read_whole_file(file);
|
||||||
var ast;
|
var ast;
|
||||||
time_it("parse", function(){
|
time_it("parse", function(){
|
||||||
@@ -134,6 +134,9 @@ function do_file_2(ast) {
|
|||||||
|
|
||||||
function do_file_3(ast) {
|
function do_file_3(ast) {
|
||||||
var file = ast.filename;
|
var file = ast.filename;
|
||||||
|
// if (ARGS.v) {
|
||||||
|
// sys.error("Mangling/generating " + file);
|
||||||
|
// }
|
||||||
time_it("mangle", function(){
|
time_it("mangle", function(){
|
||||||
ast.mangle_names();
|
ast.mangle_names();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ function Compressor(options, false_by_default) {
|
|||||||
if (compressor.option("dead_code")) {
|
if (compressor.option("dead_code")) {
|
||||||
var a = [];
|
var a = [];
|
||||||
extract_declarations_from_unreachable_code(compressor, self.body, 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 {
|
} else {
|
||||||
return self.body;
|
return self.body;
|
||||||
@@ -626,6 +626,21 @@ function Compressor(options, false_by_default) {
|
|||||||
return self;
|
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){
|
SQUEEZE(AST_For, function(self, compressor){
|
||||||
self = self.clone();
|
self = self.clone();
|
||||||
if (self.init) self.init = self.init.squeeze(compressor);
|
if (self.init) self.init = self.init.squeeze(compressor);
|
||||||
|
|||||||
Reference in New Issue
Block a user