mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix mypy errors & other bugs
This commit is contained in:
parent
98ba7d467a
commit
90001bd885
2 changed files with 12 additions and 12 deletions
|
@ -104,8 +104,8 @@ class LiteralExpr(Expr):
|
||||||
def type_complete(self) -> bool:
|
def type_complete(self) -> bool:
|
||||||
from .values import IdentLiteral
|
from .values import IdentLiteral
|
||||||
|
|
||||||
if isinstance(self.literal, IdentLiteral):
|
if isinstance(self.literal.value, IdentLiteral):
|
||||||
if object := self.root.objects_by_id.get(self.ident):
|
if object := self.root.objects_by_id.get(self.literal.value.ident):
|
||||||
return not isinstance(object, Template)
|
return not isinstance(object, Template)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class LookupOp(InfixExpr):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(self.lhs.type, UncheckedType):
|
if isinstance(self.lhs.type, UncheckedType) or not self.lhs.type_complete:
|
||||||
return
|
return
|
||||||
|
|
||||||
elif not isinstance(self.lhs.type, gir.Class) and not isinstance(
|
elif not isinstance(self.lhs.type, gir.Class) and not isinstance(
|
||||||
|
|
|
@ -160,19 +160,19 @@ class XmlOutput(OutputFormat):
|
||||||
xml.end_tag()
|
xml.end_tag()
|
||||||
|
|
||||||
def _emit_literal(self, literal: Literal, xml: XmlEmitter):
|
def _emit_literal(self, literal: Literal, xml: XmlEmitter):
|
||||||
literal = literal.value
|
value = literal.value
|
||||||
if isinstance(literal, IdentLiteral):
|
if isinstance(value, IdentLiteral):
|
||||||
value_type = literal.context[ValueTypeCtx].value_type
|
value_type = value.context[ValueTypeCtx].value_type
|
||||||
if isinstance(value_type, gir.BoolType):
|
if isinstance(value_type, gir.BoolType):
|
||||||
xml.put_text(literal.ident)
|
xml.put_text(value.ident)
|
||||||
elif isinstance(value_type, gir.Enumeration):
|
elif isinstance(value_type, gir.Enumeration):
|
||||||
xml.put_text(str(value_type.members[literal.ident].value))
|
xml.put_text(str(value_type.members[value.ident].value))
|
||||||
else:
|
else:
|
||||||
xml.put_text(literal.ident)
|
xml.put_text(value.ident)
|
||||||
elif isinstance(literal, TypeLiteral):
|
elif isinstance(value, TypeLiteral):
|
||||||
xml.put_text(literal.type_name.glib_type_name)
|
xml.put_text(value.type_name.glib_type_name)
|
||||||
else:
|
else:
|
||||||
xml.put_text(literal.value)
|
xml.put_text(value.value)
|
||||||
|
|
||||||
def _emit_value(self, value: Value, xml: XmlEmitter):
|
def _emit_value(self, value: Value, xml: XmlEmitter):
|
||||||
if isinstance(value.child, Literal):
|
if isinstance(value.child, Literal):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue