-
Notifications
You must be signed in to change notification settings - Fork 680
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
Storten Number and Infinity constants #340
base: master
Are you sure you want to change the base?
Conversation
When it comes to evaluating the production MemberExpression : MemberExpression [ Expression ], this is to be expected. Relevant steps are as follows:
Would it not be more consequent to replace |
Thanks for the explanation. Also, |
@@ -44,6 +44,37 @@ function ast_squeeze_more(ast) { | |||
} | |||
} | |||
}, | |||
|
|||
// shorten Number constants: | |||
// Number.POSITIVE_INFINITY to 1/0, Number.NEGATIVE_INFINITY to -1/0, Number.NaN to NaN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number.NaN
to 0/0
As suggested in #262, should this transformation be applied, it could be more useful to transform |
Add unsafe shortcuts for Number constants (idea taken from #262).
Number.POSITIVE_INFINITY
andInfinity
to1/0
,Number.NEGATIVE_INFINITY
and-Infinity
to-1/0
,Number.NaN
toNaN
Transformations are only made if the are no
Infinity
orNaN
in scope, but still there is a curios thing:using them as array index/property name also gets affected. It (possibly) can lead to a problem, but current browsers handle it correctly: