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

More friendly artiq.py2llvm.typing testbench.

This commit is contained in:
whitequark 2015-06-15 15:59:36 +03:00
parent 20e0e69358
commit a3789868f2

View File

@ -916,13 +916,14 @@ def main():
else: else:
def process_diagnostic(diag): def process_diagnostic(diag):
print("\n".join(diag.render())) print("\n".join(diag.render()))
if diag.level == 'fatal': if diag.level in ('fatal', 'error'):
exit(1) exit(1)
engine = diagnostic.Engine() engine = diagnostic.Engine()
engine.process = process_diagnostic engine.process = process_diagnostic
buf = source.Buffer("".join(fileinput.input()), os.path.basename(fileinput.filename())) buf = source.Buffer("".join(fileinput.input()).expandtabs(),
os.path.basename(fileinput.filename()))
parsed, comments = parse_buffer(buf, engine=engine) parsed, comments = parse_buffer(buf, engine=engine)
typed = ASTTypedRewriter(engine=engine).visit(parsed) typed = ASTTypedRewriter(engine=engine).visit(parsed)
Inferencer(engine=engine).visit(typed) Inferencer(engine=engine).visit(typed)