forked from M-Labs/artiq
1
0
Fork 0

compiler/tools: support int64 in value_to_ast

This commit is contained in:
Sebastien Bourdeauducq 2014-08-18 21:31:56 +08:00
parent fc9cf67069
commit 1e654f5da2
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,12 @@ def eval_ast(expr, symdict=dict()):
return eval(code, symdict)
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)
elif isinstance(value, Fraction):
return ast.Call(func=ast.Name("Fraction", ast.Load()),