Merge branch 'main' into 'main'

compile: fix flag values

Closes #180

See merge request jwestman/blueprint-compiler!220
This commit is contained in:
kotontrion 2025-01-13 20:08:42 +00:00
commit baf9602b03
2 changed files with 3 additions and 3 deletions

View file

@ -225,12 +225,12 @@ class Flag(AstNode):
return self.tokens["value"]
@property
def value(self) -> T.Optional[int]:
def value(self) -> T.Optional[str]:
type = self.context[ValueTypeCtx].value_type
if not isinstance(type, Enumeration):
return None
elif member := type.members.get(self.name):
return member.value
return member.nick
else:
return None

View file

@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GApplication">
<property name="flags">1|4</property>
<property name="flags">is-service|handles-open</property>
</object>
<object class="GtkEventControllerScroll">
<property name="flags">1</property>