mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix crash in flags value for unchecked classes
This commit is contained in:
parent
3f8b38d219
commit
417f163a5a
5 changed files with 13 additions and 3 deletions
|
@ -133,7 +133,7 @@ class FlagsValue(Value):
|
||||||
@validate()
|
@validate()
|
||||||
def parent_is_bitfield(self):
|
def parent_is_bitfield(self):
|
||||||
type = self.parent.value_type
|
type = self.parent.value_type
|
||||||
if not isinstance(type, gir.Bitfield):
|
if type is not None and not isinstance(type, gir.Bitfield):
|
||||||
raise CompileError(f"{type.full_name} is not a bitfield type")
|
raise CompileError(f"{type.full_name} is not a bitfield type")
|
||||||
|
|
||||||
def emit_xml(self, xml: XmlEmitter):
|
def emit_xml(self, xml: XmlEmitter):
|
||||||
|
|
|
@ -2,5 +2,6 @@ using Gtk 4.0;
|
||||||
|
|
||||||
.MyComponent component {
|
.MyComponent component {
|
||||||
.MyComponent2 {
|
.MyComponent2 {
|
||||||
|
flags-value: a | b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<requires lib="gtk" version="4.0"/>
|
<requires lib="gtk" version="4.0"/>
|
||||||
<object class="MyComponent" id="component">
|
<object class="MyComponent" id="component">
|
||||||
<child>
|
<child>
|
||||||
<object class="MyComponent2"></object>
|
<object class="MyComponent2">
|
||||||
|
<property name="flags-value">a|b</property>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
7
tests/samples/unchecked_class_dec.blp
Normal file
7
tests/samples/unchecked_class_dec.blp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
.MyComponent component {
|
||||||
|
.MyComponent2 {
|
||||||
|
flags-value: "a|b";
|
||||||
|
}
|
||||||
|
}
|
|
@ -217,4 +217,4 @@ class TestSamples(unittest.TestCase):
|
||||||
self.assert_decompile("template")
|
self.assert_decompile("template")
|
||||||
self.assert_decompile("translated")
|
self.assert_decompile("translated")
|
||||||
self.assert_decompile("using")
|
self.assert_decompile("using")
|
||||||
self.assert_decompile("unchecked_class")
|
self.assert_decompile("unchecked_class_dec")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue