mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 19:28:26 +08:00
Add channel name as the first argument to rtio_log (#206).
This commit is contained in:
parent
f28b259b5f
commit
1465fe6f81
@ -1608,10 +1608,16 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
|||||||
return self.append(ir.Builtin("round", [arg], node.type))
|
return self.append(ir.Builtin("round", [arg], node.type))
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
elif types.is_builtin(typ, "print") or types.is_builtin(typ, "rtio_log"):
|
elif types.is_builtin(typ, "print"):
|
||||||
self.polymorphic_print([self.visit(arg) for arg in node.args],
|
self.polymorphic_print([self.visit(arg) for arg in node.args],
|
||||||
separator=" ", suffix="\n",
|
separator=" ", suffix="\n")
|
||||||
as_rtio=types.is_builtin(typ, "rtio_log"))
|
return ir.Constant(None, builtins.TNone())
|
||||||
|
elif types.is_builtin(typ, "rtio_log"):
|
||||||
|
prefix, *args = node.args
|
||||||
|
self.polymorphic_print([self.visit(prefix)],
|
||||||
|
separator=" ", suffix="\x1E", as_rtio=True)
|
||||||
|
self.polymorphic_print([self.visit(arg) for arg in args],
|
||||||
|
separator=" ", suffix="\n", as_rtio=True)
|
||||||
return ir.Constant(None, builtins.TNone())
|
return ir.Constant(None, builtins.TNone())
|
||||||
elif types.is_builtin(typ, "now"):
|
elif types.is_builtin(typ, "now"):
|
||||||
if len(node.args) == 0 and len(node.keywords) == 0:
|
if len(node.args) == 0 and len(node.keywords) == 0:
|
||||||
|
@ -753,7 +753,7 @@ class Inferencer(algorithm.Visitor):
|
|||||||
node.loc, None)
|
node.loc, None)
|
||||||
else:
|
else:
|
||||||
diagnose(valid_forms())
|
diagnose(valid_forms())
|
||||||
elif types.is_builtin(typ, "print") or types.is_builtin(typ, "rtio_log"):
|
elif types.is_builtin(typ, "print"):
|
||||||
valid_forms = lambda: [
|
valid_forms = lambda: [
|
||||||
valid_form("print(args...) -> None"),
|
valid_form("print(args...) -> None"),
|
||||||
]
|
]
|
||||||
@ -766,6 +766,21 @@ class Inferencer(algorithm.Visitor):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
diagnose(valid_forms())
|
diagnose(valid_forms())
|
||||||
|
elif types.is_builtin(typ, "rtio_log"):
|
||||||
|
valid_forms = lambda: [
|
||||||
|
valid_form("rtio_log(channel:str, args...) -> None"),
|
||||||
|
]
|
||||||
|
|
||||||
|
self._unify(node.type, builtins.TNone(),
|
||||||
|
node.loc, None)
|
||||||
|
|
||||||
|
if len(node.args) >= 1 and len(node.keywords) == 0:
|
||||||
|
arg = node.args[0]
|
||||||
|
|
||||||
|
self._unify(arg.type, builtins.TStr(),
|
||||||
|
arg.loc, None)
|
||||||
|
else:
|
||||||
|
diagnose(valid_forms())
|
||||||
elif types.is_builtin(typ, "now"):
|
elif types.is_builtin(typ, "now"):
|
||||||
simple_form("now() -> float",
|
simple_form("now() -> float",
|
||||||
[], builtins.TFloat())
|
[], builtins.TFloat())
|
||||||
|
Loading…
Reference in New Issue
Block a user