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

fix missing parentheses around NaN/Infinity shorthands #1726

Merged
merged 1 commit into from
Mar 29, 2017

Conversation

alexlamsl
Copy link
Collaborator

fixes #1724
fixes #1725

@alexlamsl alexlamsl merged commit 2e41cd6 into mishoo:master Mar 29, 2017
@alexlamsl alexlamsl deleted the issue-1724 branch March 29, 2017 12:53
@kzc
Copy link
Contributor

kzc commented Mar 29, 2017

A couple of things:

  • The tests should be using expect_exact.
  • The uglified code is larger for NaN and 0/0 cases with this PR.

This PR:

$ echo 'var a = 0; console.log(++a % NaN | NaN ? a++ : 0);' | bin/uglifyjs -c
var a=0;console.log(++a%(0/0)|0/0?a++:0);
$ echo 'var a = 0; console.log(++a % (0/0) | (0/0) ? a++ : 0);' | bin/uglifyjs -c
var a=0;console.log(++a%(0/0)|0/0?a++:0);

v2.7.5:

$ echo 'var a = 0; console.log(++a % NaN | NaN ? a++ : 0);' | uglifyjs -c
var a=0;console.log(++a%NaN|NaN?a++:0);
$ echo 'var a = 0; console.log(++a % (0/0) | (0/0) ? a++ : 0);' | uglifyjs -c
var a=0;console.log(++a%NaN|NaN?a++:0);

@alexlamsl
Copy link
Collaborator Author

The tests should be using expect_exact

Good point - will update.

The uglified code is larger for NaN and 0/0 cases with this PR

See discussion on #1723 (comment)

alexlamsl added a commit to alexlamsl/UglifyJS that referenced this pull request Mar 29, 2017
alexlamsl added a commit that referenced this pull request Mar 29, 2017
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

Successfully merging this pull request may close these issues.

Bug: mod infinity Bug: Infinity op soup
2 participants