Page MenuHomePhabricator

Extend nodes in both directions in XHPAST
ClosedPublic

Authored by epriestley on Jan 7 2015, 1:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 15, 4:18 AM
Unknown Object (File)
Dec 17 2024, 8:21 AM
Unknown Object (File)
Dec 14 2024, 5:25 PM
Unknown Object (File)
Nov 24 2024, 6:49 AM
Unknown Object (File)
Nov 24 2024, 1:16 AM
Unknown Object (File)
Nov 19 2024, 3:45 AM
Unknown Object (File)
Nov 18 2024, 11:43 AM
Unknown Object (File)
Nov 18 2024, 11:43 AM
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
Branch
nlmore
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 3664
Build 3674: [Placeholder Plan] Wait for 30 Seconds