Commit 8fc460f8 authored by Tom Niget's avatar Tom Niget

Pass class to annotation visitor

parent 75879658
......@@ -13,9 +13,10 @@ PRELUDE = Scope.make_global()
class ScoperVisitor(NodeVisitorSeq):
scope: Scope = field(default_factory=lambda: PRELUDE.child(ScopeKind.GLOBAL))
root_decls: Dict[str, VarDecl] = field(default_factory=dict)
cur_class: Optional[TypeType] = None
def anno(self) -> "TypeAnnotationVisitor":
return TypeAnnotationVisitor(self.scope)
return TypeAnnotationVisitor(self.scope, self.cur_class)
def visit_annotation(self, expr: Optional[ast.expr]) -> BaseType:
return self.anno().visit(expr) if expr else TypeVariable()
......
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