Introduce column number in AST nodes #1724
Open
+1,567
−373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces column numbers in all AST nodes.
It also modifies the existing tests for the parser, and adds a lot more cases in a different class. I have gone through
Parser
measuring code coverage to ensure that the tests cover (almost) all the cases - the things I didn't really test are the non-standard things like xml, array comprehension, or let expression.There is a breaking change: in case of a function call such as:
rhino will now assign line
1
to the expression, not line2
(i.e. we assign the start of the expression, not the position of the parenthesis for the function call). This is for coherency with other parsers - I've checked what happen via https://astexplorer.net/ and it seems like the consensus is what I have implemented.