-
Notifications
You must be signed in to change notification settings - Fork 334
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
Member expression on number literal generates wrong output #104
Comments
P.S.: I'm using version: '0.0.23' |
Thx for filing issue. But this is completely valid ECMAScript.
You can check it in your JS engine OR http://esprima.org/demo/parse.html?code=4..foo |
Of cource, |
Oh wow I have not realized that :) Thanks |
@Constellation but why does it coerce it to 4..foo? If you translate 4..foo back to an AST, the "raw" value of the Literal type is "4.", but the AST provided by @Gozala doesn't have that dot following the 4. It seems like the AST should actually be considered invalid, no? |
@dannycochran If the Literal AST node has a |
@michaelficarra but the AST changes roundtrip, no? |
Ah, I think I see what you mean. Thanks, @dannycochran. The fix here would be to compile to 4 .foo; |
@michaelficarra -- I think that seems right, though I could also see the case for escodegen to throw an error and say an AST like the one provided by @Gozala is invalid. it seems like ESTree should have a separate way of represeting 4 .foo and (4).foo, as it does for 4..foo |
@dannycochran I disagree. Those should be identical in an AST. The fact that they're not due to |
While it should output:
The text was updated successfully, but these errors were encountered: