});
OPT(AST_Boolean, function(self, compressor){
+ if (compressor.in_boolean_context()) return make_node(AST_Number, self, {
+ value: +self.value
+ });
if (compressor.option("booleans")) {
var p = compressor.parent();
if (p instanceof AST_Binary && (p.operator == "=="
expect: {
y();
x() && y();
- (x(), 0) || y();
+ (x(), 1) && y();
x() && y();
x() && y();
x() && y();
- (x(), 1) || y();
+ (x(), 0) && y();
}
}
}
expect: {
for (var a = 100, b = 10, L1 = 5; --L1 > 0;)
- if (--b, !1) var ignore = 0;
+ if (--b, 0) var ignore = 0;
console.log(a, b);
}
expect_stdout: true
expect: {
var a = 100, b = 10;
function f19() {
- ++a, 1;
+ ++a, 0;
}
f19(),
console.log(a, b);
foo();
}
// TODO: optimize to `func(), bar()`
- (func(), 0) || bar();
+ (func(), 1) && bar();
}
}
foo();
}
// TODO: optimize to `func(), bar()`
- if (func(), !0) bar();
+ if (func(), 1) bar();
}
}
}
expect: {
console.log(function(a) {
- if (!1);
+ if (0);
switch (!1) {
case 0:
return "FAIL";
if (void 0 == null);
}
expect: {
- while (!1);
- for (; !0;);
- if (!0);
+ while (0);
+ for (; 1;);
+ if (1);
}
}
function f2() { return g(), "Yes"; }
foo();
console.log(1);
- var a = !(console.log(2), !0);
+ var a = !(console.log(2), 1);
foo();
}
}
if (typeof bar);
}
expect: {
- if (!0);
+ if (1);
}
}