forked from M-Labs/artiq
compiler/ir: compile fractions with denominator==1 as integers
This commit is contained in:
parent
70fbc6ad56
commit
9cbf31153a
|
@ -72,6 +72,10 @@ def _emit_expr(env, builder, ns, node):
|
||||||
[_emit_expr(env, builder, ns, expr) for expr in node.args[1:]])
|
[_emit_expr(env, builder, ns, expr) for expr in node.args[1:]])
|
||||||
elif node.func.id == "Quantity":
|
elif node.func.id == "Quantity":
|
||||||
return _emit_expr(env, builder, ns, node.args[0])
|
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:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue