Commit 1790573a authored by Stefan Behnel's avatar Stefan Behnel

in ResultRefNode: avoid re-inferring the expression type if the expression knows its type already

parent 52c8f6b5
...@@ -143,10 +143,12 @@ class ResultRefNode(AtomicExprNode): ...@@ -143,10 +143,12 @@ class ResultRefNode(AtomicExprNode):
self.type = self.expression.type self.type = self.expression.type
def infer_type(self, env): def infer_type(self, env):
if self.expression is not None:
return self.expression.infer_type(env)
if self.type is not None: if self.type is not None:
return self.type return self.type
if self.expression is not None:
if self.expression.type is not None:
return self.expression.type
return self.expression.infer_type(env)
assert False, "cannot infer type of ResultRefNode" assert False, "cannot infer type of ResultRefNode"
def may_be_none(self): def may_be_none(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment