mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Refactor child types
Didn't change the actual syntax, but changed the rules around to be less confusing.
This commit is contained in:
parent
9dcd06de51
commit
71f52d350a
11 changed files with 74 additions and 55 deletions
|
@ -109,9 +109,9 @@ class AstNode:
|
|||
else:
|
||||
return self.parent.root
|
||||
|
||||
def parent_by_type(self, type):
|
||||
def parent_by_type(self, type: T.Type[TType]) -> TType:
|
||||
if self.parent is None:
|
||||
return None
|
||||
raise CompilerBugError()
|
||||
elif isinstance(self.parent, type):
|
||||
return self.parent
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue