Skip to content

Remove NOT in IfStatement with EmptyStatement (-s) #408

Merged
merged 1 commit into from Jun 5, 2012
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;
Something went wrong with that request. Please try again.