Optimisation bug with subtracting negative numbers
I just came across this scenario with a piece of code of ours. The following (valid) C# code:
int number = somevar - -10; // legitimately subtracting a negative number
.. becomes this, when optimised and minified in Javascript:
var $a=somevar--10;
.. which is invalid, both in C# and Javascript. The code works when using the debug script, but it doesn't when minified, causing a discrepency between the two scripts. I think this is maybe more of an issue with the minifier being used thought, just thought I'd make you aware.
Is this with 0.8 or older builds? In the new minimizer I'd expect it gets simplified at minimization time to be +10.
Ah, yes this is with 0.7.5.
Looks like the new minimizer doesn't convert to +10 but it does leave the code as somevar- -10. so it shouldn't result in invalid code. Marking as fixed (for 0.8).
Nice one. It was just the removal of the spaces in between the minus operator that was causing the problem, so as long as that remains intact, it should be fine.