Commit b5f8b688 authored by Stefan Behnel's avatar Stefan Behnel

Fix compiler crash in some error cases where ExprStatNode accidentally contains a StatNode.

parent 63ed2429
...@@ -4786,7 +4786,7 @@ class ExprStatNode(StatNode): ...@@ -4786,7 +4786,7 @@ class ExprStatNode(StatNode):
else: else:
env.declare_var(var.value, type, var.pos, is_cdef=True) env.declare_var(var.value, type, var.pos, is_cdef=True)
self.__class__ = PassStatNode self.__class__ = PassStatNode
elif expr.annotation is not None: elif getattr(expr, 'annotation', None) is not None:
if expr.is_name: if expr.is_name:
# non-code variable annotation, e.g. "name: type" # non-code variable annotation, e.g. "name: type"
expr.declare_from_annotation(env) expr.declare_from_annotation(env)
......
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