forked from M-Labs/artiq
1
0
Fork 0

Add support for With.

This commit is contained in:
whitequark 2015-06-14 23:13:41 +03:00
parent cd22b8178c
commit 77adf2f6b5
1 changed files with 9 additions and 1 deletions

View File

@ -312,7 +312,6 @@ class ASTTypedRewriter(algorithm.Transformer):
visit_Import = visit_unsupported
visit_ImportFrom = visit_unsupported
visit_Try = visit_unsupported
visit_With = visit_unsupported
class Inferencer(algorithm.Visitor):
@ -725,6 +724,15 @@ class Inferencer(algorithm.Visitor):
node.keyword_loc)
self.engine.process(diag)
def visit_withitem(self, node):
self.generic_visit(node)
if True: # none are supported yet
diag = diagnostic.Diagnostic("error",
"value of type {type} cannot act as a context manager",
{"type": types.TypePrinter().name(node.context_expr.type)},
node.context_expr.loc)
self.engine.process(diag)
def visit_FunctionDefT(self, node):
old_function, self.function = self.function, node
old_in_loop, self.in_loop = self.in_loop, False