mirror of https://github.com/m-labs/artiq.git
compiler/tools: support int64 in value_to_ast
This commit is contained in:
parent
fc9cf67069
commit
1e654f5da2
|
@ -12,7 +12,12 @@ def eval_ast(expr, symdict=dict()):
|
||||||
return eval(code, symdict)
|
return eval(code, symdict)
|
||||||
|
|
||||||
def value_to_ast(value):
|
def value_to_ast(value):
|
||||||
if isinstance(value, int):
|
if isinstance(value, core_language.int64): # must be before int
|
||||||
|
return ast.Call(
|
||||||
|
func=ast.Name("int64", ast.Load()),
|
||||||
|
args=[ast.Num(int(value))],
|
||||||
|
keywords=[], starargs=None, kwargs=None)
|
||||||
|
elif isinstance(value, int):
|
||||||
return ast.Num(value)
|
return ast.Num(value)
|
||||||
elif isinstance(value, Fraction):
|
elif isinstance(value, Fraction):
|
||||||
return ast.Call(func=ast.Name("Fraction", ast.Load()),
|
return ast.Call(func=ast.Name("Fraction", ast.Load()),
|
||||||
|
|
Loading…
Reference in New Issue