Expression: Fix some crashes

This commit is contained in:
James Westman 2022-05-05 10:03:37 -05:00
parent cd33266452
commit 3416546eac
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6

View file

@ -106,6 +106,7 @@ class ClosureExpr(AstNode):
@property
def gir_type(self):
if isinstance(self.parent.parent, CastExpr):
return self.parent.parent.gir_type
@property
@ -125,6 +126,7 @@ class LookupOp(InfixExpr):
@property
def gir_type(self):
if parent_type := self.lhs.gir_type:
if isinstance(parent_type, gir.Class) or isinstance(parent_type, gir.Interface):
if prop := parent_type.properties.get(self.tokens["property"]):
return prop.type