convert while into for
This commit is contained in:
@@ -1118,6 +1118,15 @@ merge(Compressor.prototype, {
|
|||||||
return self;
|
return self;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
OPT(AST_While, function(self, compressor) {
|
||||||
|
if (!compressor.option("loops")) return self;
|
||||||
|
self = AST_DWLoop.prototype.optimize.call(self, compressor);
|
||||||
|
if (self instanceof AST_While) {
|
||||||
|
self = make_node(AST_For, self, self);
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
});
|
||||||
|
|
||||||
OPT(AST_For, function(self, compressor){
|
OPT(AST_For, function(self, compressor){
|
||||||
var cond = self.condition;
|
var cond = self.condition;
|
||||||
if (cond) {
|
if (cond) {
|
||||||
|
|||||||
Reference in New Issue
Block a user