Commit 26b46351 authored by Tom Niget's avatar Tom Niget

Add fields to member list of class

parent 4855c26b
......@@ -30,7 +30,14 @@ class StdlibVisitor(NodeVisitorSeq):
self.scope.vars[node.targets[0].id] = VarDecl(VarKind.LOCAL, self.visit(node.value))
def visit_AnnAssign(self, node: ast.AnnAssign):
self.scope.vars[node.target.id] = VarDecl(VarKind.LOCAL, self.anno().visit(node.annotation))
ty = self.anno().visit(node.annotation)
if self.cur_class:
assert isinstance(self.cur_class, TypeType)
if isinstance(self.cur_class.type_object, ABCMeta):
raise NotImplementedError
else:
self.cur_class.type_object.members[node.target.id] = ty.gen_sub(self.cur_class.type_object, self.typevars)
self.scope.vars[node.target.id] = VarDecl(VarKind.LOCAL, ty)
def visit_ImportFrom(self, node: ast.ImportFrom):
pass
......
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