Skip hidden tree nodes in path expressions #323
Merged
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.
When we were evaluating path expressions, we were not skipping hidden tree
nodes, i.e. tree nodes whose label is NULL. In most cases, that's not
visible to users, but when we match something like /foo/*[2] where /foo has
a bunch of hidden children, the result was not what the user might expect,
as we might actually return a hidden node to aug_match, which would
suppress that node and make it seem to the user as if nothing had matched.
With this patch, we try to skip over hidden nodes while evaluating the path
expression to avoid this issue.