Homec4science

Extend nodes in both directions in XHPAST

Authored by epriestley <git@epriestley.com> on Jan 7 2015, 14:49.

Description

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

Details

Committed
epriestley <git@epriestley.com>Jan 7 2015, 14:49
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU00fe30dd9ebf: Fix a minor XHPAST bug
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU31110f222572: Extend nodes in both directions in XHPAST (authored by epriestley <git@epriestley.com>).Jan 7 2015, 14:49