Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle ++ on strings in normalization #3

Open
msridhar opened this issue Jan 15, 2014 · 1 comment
Open

handle ++ on strings in normalization #3

msridhar opened this issue Jan 15, 2014 · 1 comment

Comments

@msridhar
Copy link
Member

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.

@xiemaisi
Copy link

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants