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
Reported coordinates not accurate for BinaryOp while getting json dump of AST #411
Comments
A simpler reproducer:
It seems like the coordinate attribution for binary ops could be improved, though it's not clear what the right way to report it is. The way it currently works is that the |
To me, a good approach seems to be a relative coordinate reporting for the individual operators wrt the index of the LHS. |
I think that what's often done is nodes would have a start coord and end coord, covering their extent, e.g. consider:
This is valid code, and yet where would you report the coord for the binary op node? Right now it's reported on It's a large feature request though. |
This is probably bad advice - but what I did to get around this issue in the meantime when I came across it |
Look at this code:
And consider the only the JSON output for only the binary operators:
How can the coordinates 6:4 have 2 operators? (namely '%' and '/')
This is the line in question:
j=a/10%10;
Am I missing something or is this the expected behavior?
I've only included the sections of the JSON in question for easier readability.
The text was updated successfully, but these errors were encountered: