Extend nodes in both directions in XHPAST
Summary:
Currently, appendChild() extends tokens only to the right, so this produces the wrong result:
NLMORE($$, $2); $$->apppendChild($1);
Instead of separate setBegin() + setEnd() operations, just always extend both sides of the range if applicable. This reduces NLMORE to NMORE and removes the pitfall from the codebase.
(I retained NEXTEND() because I think it makes the code a little more clear.)
Test Plan:
- Unit tests.
- Parsed a snippet with methods-with-modifiers and methods-without-modifiers and saw the whole method definition end up in the n_METHOD_DECLARATION node.
Reviewers: joshuaspence, richardvanvelzen
Reviewed By: richardvanvelzen
Subscribers: epriestley
Maniphest Tasks: T6885
Differential Revision: https://secure.phabricator.com/D11268