2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 19:28:26 +08:00

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

View File

@ -255,6 +255,34 @@ class Inferencer(algorithm.Transformer):
node.target.loc, node.iter.loc)
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):
def __init__(self, buf):
self.rewriter = source.Rewriter(buf)