Page MenuHomePhabricator

Extend nodes in both directions in XHPAST
ClosedPublic

Authored by epriestley on Jan 7 2015, 1:38 PM.
Tags
None
Referenced Files
F14829505: D11268.id27071.diff
Wed, Jan 29, 4:52 PM
F14826973: D11268.diff
Wed, Jan 29, 3:01 AM
Unknown Object (File)
Mon, Jan 27, 11:52 PM
Unknown Object (File)
Thu, Jan 23, 8:56 PM
Unknown Object (File)
Thu, Jan 23, 8:56 PM
Unknown Object (File)
Thu, Jan 23, 8:56 PM
Unknown Object (File)
Tue, Jan 21, 11:42 AM
Unknown Object (File)
Fri, Jan 17, 8:41 PM
Subscribers

Details

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.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable