forked from M-Labs/artiq
1
0
Fork 0

Error out on unsupported expressions by default.

This commit is contained in:
whitequark 2015-06-04 14:43:00 +03:00
parent 10a269d77e
commit c9623a106e
1 changed files with 28 additions and 0 deletions

View File

@ -255,6 +255,34 @@ class Inferencer(algorithm.Transformer):
node.target.loc, node.iter.loc) node.target.loc, node.iter.loc)
return node return node
# Unsupported visitors
#
def visit_unsupported(self, node):
diag = diagnostic.Diagnostic('fatal',
"this syntax is not supported", {},
node.loc)
self.engine.process(diag)
visit_Attribute = visit_unsupported
visit_BinOp = visit_unsupported
visit_BoolOp = visit_unsupported
visit_Call = visit_unsupported
visit_Compare = visit_unsupported
visit_Dict = visit_unsupported
visit_DictComp = visit_unsupported
visit_Ellipsis = visit_unsupported
visit_GeneratorExp = visit_unsupported
visit_IfExp = visit_unsupported
visit_Lambda = visit_unsupported
visit_ListComp = visit_unsupported
visit_Set = visit_unsupported
visit_SetComp = visit_unsupported
visit_Str = visit_unsupported
visit_Starred = visit_unsupported
visit_UnaryOp = visit_unsupported
visit_Yield = visit_unsupported
visit_YieldFrom = visit_unsupported
class Printer(algorithm.Visitor): class Printer(algorithm.Visitor):
def __init__(self, buf): def __init__(self, buf):
self.rewriter = source.Rewriter(buf) self.rewriter = source.Rewriter(buf)