Skip to content
Browse files

Merge pull request #408 from RGustBardon/if-not

Remove NOT in IfStatement with EmptyStatement (-s)
  • Loading branch information...
2 parents 46f0610 + e90dbc9 commit 4c72a635f2165c58e5b5e8097188a02d55b37329 @mishoo committed Jun 5, 2012
Showing with 5 additions and 2 deletions.
  1. +3 −2 lib/process.js
  2. +1 −0 test/unit/compress/expected/if-not.js
  3. +1 −0 test/unit/compress/test/if-not.js
View
5 lib/process.js
@@ -1242,6 +1242,9 @@ function ast_squeeze(ast, options) {
t = walk(t);
e = walk(e);
+ if (empty(e) && empty(t))
+ return [ "stat", c ];
+
if (empty(t)) {
c = negate(c);
t = e;
@@ -1262,8 +1265,6 @@ function ast_squeeze(ast, options) {
}
})();
}
- if (empty(e) && empty(t))
- return [ "stat", c ];
var ret = [ "if", c, t, e ];
if (t[0] == "if" && empty(t[3]) && empty(e)) {
ret = best_of(ret, walk([ "if", [ "binary", "&&", c, t[1] ], t[2] ]));
View
1 test/unit/compress/expected/if-not.js
@@ -0,0 +1 @@
+_,_
View
1 test/unit/compress/test/if-not.js
@@ -0,0 +1 @@
+if(_);if(_);else;

0 comments on commit 4c72a63

Please sign in to comment.
Something went wrong with that request. Please try again.