Commit 234ea64e authored by Tom Niget's avatar Tom Niget

Fix expression evaluation scope in stdlib analyzer

parent 1871431a
......@@ -19,6 +19,9 @@ class StdlibVisitor(NodeVisitorSeq):
cur_class: Optional[BaseType] = None
typevars: Dict[str, BaseType] = field(default_factory=dict)
def expr(self) -> ScoperExprVisitor:
return ScoperExprVisitor(self.scope)
def visit_Module(self, node: ast.Module):
for stmt in node.body:
self.visit(stmt)
......@@ -76,7 +79,7 @@ class StdlibVisitor(NodeVisitorSeq):
self.scope.vars[node.name] = VarDecl(VarKind.LOCAL, ty)
def visit_Assert(self, node: ast.Assert):
print("Type of", ast.unparse(node.test), ":=", ScoperExprVisitor().visit(node.test))
print("Type of", ast.unparse(node.test), ":=", self.expr().visit(node.test))
def visit_Call(self, node: ast.Call) -> BaseType:
ty_op = self.visit(node.func)
......
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