adw-breakpoint: Fix bug when setting template prop

When a breakpoint setter's target object was the template, the compiler
failed with an assertion error. Fixed by allowing TemplateType objects
there. The assertion is still needed to make the type checker happy.
This commit is contained in:
James Westman 2024-07-22 20:31:15 -05:00
parent adc2be1454
commit b33cc7ccd7
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6

View file

@ -98,7 +98,9 @@ class AdwBreakpointSetter(AstNode):
and not isinstance(self.gir_class, ExternType)
and self.property_name is not None
):
assert isinstance(self.gir_class, gir.Class)
assert isinstance(self.gir_class, gir.Class) or isinstance(
self.gir_class, gir.TemplateType
)
return self.gir_class.properties.get(self.property_name)
else:
return None