public
/
UglifyJS.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fba0c1a
)
convert `while` into `for`
author
Mihai Bazon
<mihai@bazon.net>
Mon, 5 Nov 2012 14:01:20 +0000
(16:01 +0200)
committer
Mihai Bazon
<mihai@bazon.net>
Mon, 5 Nov 2012 14:01:20 +0000
(16:01 +0200)
lib/compress.js
patch
|
blob
|
history
diff --git
a/lib/compress.js
b/lib/compress.js
index
a7a6172
..
59c9128
100644
(file)
--- a/
lib/compress.js
+++ b/
lib/compress.js
@@
-1118,6
+1118,15
@@
merge(Compressor.prototype, {
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){
var cond = self.condition;
if (cond) {