forked from M-Labs/artiq
Add support for With.
This commit is contained in:
parent
cd22b8178c
commit
77adf2f6b5
|
@ -312,7 +312,6 @@ class ASTTypedRewriter(algorithm.Transformer):
|
||||||
visit_Import = visit_unsupported
|
visit_Import = visit_unsupported
|
||||||
visit_ImportFrom = visit_unsupported
|
visit_ImportFrom = visit_unsupported
|
||||||
visit_Try = visit_unsupported
|
visit_Try = visit_unsupported
|
||||||
visit_With = visit_unsupported
|
|
||||||
|
|
||||||
|
|
||||||
class Inferencer(algorithm.Visitor):
|
class Inferencer(algorithm.Visitor):
|
||||||
|
@ -725,6 +724,15 @@ class Inferencer(algorithm.Visitor):
|
||||||
node.keyword_loc)
|
node.keyword_loc)
|
||||||
self.engine.process(diag)
|
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):
|
def visit_FunctionDefT(self, node):
|
||||||
old_function, self.function = self.function, node
|
old_function, self.function = self.function, node
|
||||||
old_in_loop, self.in_loop = self.in_loop, False
|
old_in_loop, self.in_loop = self.in_loop, False
|
||||||
|
|
Loading…
Reference in New Issue