Add properties to AST types

I want to have a cleaner API that relies less on the specifics of the
grammar and parser.
This commit is contained in:
James Westman 2023-01-09 21:55:14 -06:00
parent 0b7dbaf90d
commit 6938267952
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
4 changed files with 34 additions and 10 deletions

View file

@ -203,6 +203,10 @@ class Flag(AstNode):
class FlagsValue(Value):
grammar = [Flag, "|", Delimited(Flag, "|")]
@property
def flags(self) -> T.List[Flag]:
return self.children
@validate()
def parent_is_bitfield(self):
type = self.parent.value_type