Fix type check for flags when only one is present

When only one flag is specified, it's parsed as an IdentValue rather
than a FlagsValue, so IdentValue needs to be able to type check flags
(aka bitfields) properly.

Fixes #47
This commit is contained in:
James Westman 2022-03-02 13:57:30 -06:00
parent 4b42016837
commit bebe784d1d
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
3 changed files with 8 additions and 1 deletions

View file

@ -129,7 +129,7 @@ class IdentValue(Value):
def validate_for_type(self):
type = self.parent.value_type
if isinstance(type, gir.Enumeration):
if isinstance(type, gir.Enumeration) or isinstance(type, gir.Bitfield):
if self.tokens["value"] not in type.members:
raise CompileError(
f"{self.tokens['value']} is not a member of {type.full_name}",