2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-24 19:04:02 +08:00

compiler/ir: compile fractions with denominator==1 as integers

This commit is contained in:
Sebastien Bourdeauducq 2014-08-13 17:58:48 +08:00
parent 70fbc6ad56
commit 9cbf31153a

View File

@ -72,6 +72,10 @@ def _emit_expr(env, builder, ns, node):
[_emit_expr(env, builder, ns, expr) for expr in node.args[1:]])
elif node.func.id == "Quantity":
return _emit_expr(env, builder, ns, node.args[0])
elif node.func.id == "Fraction":
if not isinstance(node.args[1], ast.Num) or node.args[1].n != 1:
raise NotImplementedError
return _emit_expr(env, builder, ns, node.args[0])
else:
raise NotImplementedError
else: