})).optimize(compressor);
}
}
+ if (e instanceof AST_Binary
+ && (self.operator == "+" || self.operator == "-")
+ && (e.operator == "*" || e.operator == "/" || e.operator == "%")) {
+ self.expression = e.left;
+ e.left = self;
+ return e.optimize(compressor);
+ }
// avoids infinite recursion of numerals
if (self.operator != "-"
|| !(self.expression instanceof AST_Number
}
expect_stdout: true
}
+
+unary_binary_parenthesis: {
+ input: {
+ var v = [ 0, 1, NaN, Infinity, null, undefined, true, false, "", "foo", /foo/ ];
+ v.forEach(function(x) {
+ v.forEach(function(y) {
+ console.log(
+ +(x*y),
+ +(x/y),
+ +(x%y),
+ -(x*y),
+ -(x/y),
+ -(x%y)
+ );
+ });
+ });
+ }
+ expect: {
+ var v = [ 0, 1, 0/0, 1/0, null, void 0, true, false, "", "foo", /foo/ ];
+ v.forEach(function(x) {
+ v.forEach(function(y) {
+ console.log(
+ +x*y,
+ +x/y,
+ +x%y,
+ -x*y,
+ -x/y,
+ -x%y
+ );
+ });
+ });
+ }
+ expect_stdout: true
+}