JS_WALA
JS_WALA copied to clipboard
handle ++ on strings in normalization
Consider the following code:
var j = "0";
var k = j++;
console.log(j);
console.log(k);
var l = "1";
var m = ++l;
console.log(l);
console.log(m);
When run under node, the output is:
1
0
2
2
But after normalization, we get:
01
0
11
11
Gotta love JavaScript.
Nice. The normaliser currently ignores implicit conversions, which is, I believe, what leads to this bug.
It currently transforms ++x into x = x + 1, but this example suggests it should be `x = +x + 1'.