transforms/tools/eval_constant: fix int64 handling

This commit is contained in:
Sebastien Bourdeauducq 2014-10-29 17:30:35 +08:00
parent 70cc0d1766
commit c82c631a1d
1 changed files with 3 additions and 1 deletions

View File

@ -57,7 +57,9 @@ def eval_constant(node):
return node.value return node.value
elif isinstance(node, ast.Call): elif isinstance(node, ast.Call):
funcname = node.func.id funcname = node.func.id
if funcname == "Fraction": if funcname == "int64":
return core_language.int64(eval_constant(node.args[0]))
elif funcname == "Fraction":
numerator = eval_constant(node.args[0]) numerator = eval_constant(node.args[0])
denominator = eval_constant(node.args[1]) denominator = eval_constant(node.args[1])
return Fraction(numerator, denominator) return Fraction(numerator, denominator)