&& alternative instanceof AST_Assign
&& consequent.operator == alternative.operator
&& consequent.left.equivalent_to(alternative.left)
+ && !consequent.left.has_side_effects(compressor)
) {
/*
* Stuff like this:
x(foo)[10].bar.baz = something_else();
}
expect: {
- x(foo)[10].bar.baz = (foo && bar) ? something() : something_else();
+ foo && bar
+ ? x(foo)[10].bar.baz = something()
+ : x(foo)[10].bar.baz = something_else();
}
}
comparisons: true
};
input: {
+ var x;
if (!foo && !bar && !baz && !boo) {
x = 10;
} else {
}
}
expect: {
+ var x;
x = foo || bar || baz || boo ? 20 : 10;
}
}
conditionals: true
};
input: {
+ var x;
if (some_condition()) {
x = new FooBar(1);
} else {
}
}
expect: {
+ var x;
x = new FooBar(some_condition() ? 1 : 2);
}
}
evaluate : true
};
input: {
+ var x;
// access to global should be assumed to have side effects
if (y) {
x = 1+1;
}
}
expect: {
+ var x;
x = (y, 2);
}
}
evaluate : true
};
input: {
+ var a;
// compress these
a = condition ? true : false;
}
expect: {
+ var a;
a = !!condition;
a = !condition;
a = !!condition();
a = condition ? 0 : true;
a = condition ? 1 : 0;
}
-}
\ No newline at end of file
+}