Revert "transforms.artiq_ir_generator: treat builtins in 'with' syntactically."

This reverts commit ccc993071b.
This commit is contained in:
whitequark 2015-12-10 22:25:15 +08:00
parent ccc993071b
commit 3ec9b677b2
3 changed files with 3 additions and 17 deletions

View File

@ -695,11 +695,9 @@ class ARTIQIRGenerator(algorithm.Visitor):
context_expr_node = node.items[0].context_expr context_expr_node = node.items[0].context_expr
optional_vars_node = node.items[0].optional_vars optional_vars_node = node.items[0].optional_vars
if isinstance(context_expr_node, asttyped.NameT) and \ if types.is_builtin(context_expr_node.type, "sequential"):
context_expr_node.id == "sequential":
self.visit(node.body) self.visit(node.body)
elif isinstance(context_expr_node, asttyped.NameT) and \ elif types.is_builtin(context_expr_node.type, "parallel"):
context_expr_node.id == "parallel":
parallel = self.append(ir.Parallel([])) parallel = self.append(ir.Parallel([]))
heads, tails = [], [] heads, tails = [], []
@ -717,9 +715,6 @@ class ARTIQIRGenerator(algorithm.Visitor):
if not tail.is_terminated(): if not tail.is_terminated():
tail.append(ir.Branch(self.current_block)) tail.append(ir.Branch(self.current_block))
else:
assert False
# Expression visitors # Expression visitors
# These visitors return a node in addition to mutating # These visitors return a node in addition to mutating
# the IR. # the IR.

View File

@ -762,11 +762,7 @@ class Inferencer(algorithm.Visitor):
self._unify(node.type, typ.find().instance, self._unify(node.type, typ.find().instance,
node.loc, None) node.loc, None)
else: else:
diag = diagnostic.Diagnostic("error", assert False
"builtin function '{name}' cannot be used in this context",
{"name": typ.name},
node.loc)
self.engine.process(diag)
def visit_CallT(self, node): def visit_CallT(self, node):
self.generic_visit(node) self.generic_visit(node)

View File

@ -1,5 +0,0 @@
# RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
# CHECK-L: ${LINE:+1}: error: builtin function 'sequential' cannot be used in this context
sequential()