mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
add variant support for menus
This commit is contained in:
parent
f894301571
commit
a75adc7d1b
4 changed files with 39 additions and 13 deletions
|
@ -393,7 +393,9 @@ class VariantValue(AstNode):
|
|||
@validate()
|
||||
def validate_for_type(self) -> None:
|
||||
expected_type = self.context[ValueTypeCtx].value_type
|
||||
if (
|
||||
if expected_type is None:
|
||||
pass
|
||||
elif (
|
||||
isinstance(expected_type, gir.IntType)
|
||||
or isinstance(expected_type, gir.UIntType)
|
||||
or isinstance(expected_type, gir.FloatType)
|
||||
|
@ -402,7 +404,7 @@ class VariantValue(AstNode):
|
|||
raise CompileError(f"Cannot convert variant to number")
|
||||
elif isinstance(expected_type, gir.StringType):
|
||||
raise CompileError("Cannot convert variant to string")
|
||||
if isinstance(expected_type, gir.Boxed) and expected_type.full_name == "GLib.Variant":
|
||||
elif isinstance(expected_type, gir.Boxed) and expected_type.full_name == "GLib.Variant":
|
||||
pass
|
||||
else:
|
||||
raise CompileError(f"Cannot convert variant into {expected_type.full_name}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue