mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
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:
parent
4b42016837
commit
bebe784d1d
3 changed files with 8 additions and 1 deletions
|
@ -129,7 +129,7 @@ class IdentValue(Value):
|
||||||
def validate_for_type(self):
|
def validate_for_type(self):
|
||||||
type = self.parent.value_type
|
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:
|
if self.tokens["value"] not in type.members:
|
||||||
raise CompileError(
|
raise CompileError(
|
||||||
f"{self.tokens['value']} is not a member of {type.full_name}",
|
f"{self.tokens['value']} is not a member of {type.full_name}",
|
||||||
|
|
|
@ -4,3 +4,7 @@ using Gio 2.0;
|
||||||
Gio.Application {
|
Gio.Application {
|
||||||
flags: is_service | handles_open;
|
flags: is_service | handles_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventControllerScroll {
|
||||||
|
flags: vertical;
|
||||||
|
}
|
||||||
|
|
|
@ -4,4 +4,7 @@
|
||||||
<object class="GApplication">
|
<object class="GApplication">
|
||||||
<property name="flags">is_service|handles_open</property>
|
<property name="flags">is_service|handles_open</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkEventControllerScroll">
|
||||||
|
<property name="flags">vertical</property>
|
||||||
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue