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

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()),