Page MenuHomePhabricator

Add a method to query whether an AASTNode is a descendent of another node
ClosedPublic

Authored by joshuaspence on Aug 7 2015, 3:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 12:12 AM
Unknown Object (File)
Tue, Apr 16, 5:02 AM
Unknown Object (File)
Fri, Apr 12, 6:53 AM
Unknown Object (File)
Thu, Apr 11, 8:29 AM
Unknown Object (File)
Fri, Apr 5, 1:54 AM
Unknown Object (File)
Mon, Apr 1, 9:50 AM
Unknown Object (File)
Mar 10 2024, 3:10 AM
Unknown Object (File)
Mar 4 2024, 6:28 AM
Subscribers

Details

Summary

Ref T8674. This implementation is not really very efficient, but I'll try to iterate on that.

Test Plan

See D13820.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Add a method to query whether an AASTNode is a descendent of another node.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

Consider isDescendantOf($x) or hasDescendant($x) or isAncestorOf($x) or hasAncestor($x) or similar to make intent more clear -- I think this $x->isDescendant($y) can be reasonably be read as either "$x is a descendant of $y" or "$y is a descendant of $x".

Specifically, I would expect this to mean "$x is a descendant of $y", because most $x->is...() methods return information about $x, but it actually means "$y is a descendant of $x". I would perhaps call this method isAncestorOf($y). This makes the $x/$y relationship more clear, although I don't think X being an ancestor of itself is always intuitive (but I don't have a better term for it offhand).

This revision is now accepted and ready to land.Aug 8 2015, 4:47 PM
joshuaspence edited edge metadata.
This revision was automatically updated to reflect the committed changes.