Skip to content

Commit

Permalink
glad: add is_descendant method to Type
Browse files Browse the repository at this point in the history
  • Loading branch information
pipehuffer authored and Dav1dde committed Oct 21, 2022
1 parent 41ab48e commit c469e78
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions glad/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,17 @@ def from_element(element):
def is_equivalent(self, other):
return self._raw == other._raw

def is_descendant(self, basetype, typeslist):
if self.name == basetype:
return True

cur = self
while cur.parent is not None:
if cur.parent == basetype:
return True
cur = typeslist[cur.parent][0]
return False;

def __str__(self):
return self.name

Expand Down

0 comments on commit c469e78

Please sign in to comment.