From c9623a106ecd1d1bed5e9ff03450a281cb42ffab Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 4 Jun 2015 14:43:00 +0300 Subject: [PATCH] Error out on unsupported expressions by default. --- artiq/py2llvm/typing.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/artiq/py2llvm/typing.py b/artiq/py2llvm/typing.py index 1d89c1729..857cd4b25 100644 --- a/artiq/py2llvm/typing.py +++ b/artiq/py2llvm/typing.py @@ -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)