Commit f2b2ac04 authored by Stefan Behnel's avatar Stefan Behnel

code cleanup

parent c733640d
......@@ -967,10 +967,12 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
if node.type.assignable_from(arg.arg.type):
# completely redundant C->Py->C coercion
return arg.arg.coerce_to(node.type, self.env_stack[-1])
if not isinstance(arg, ExprNodes.SimpleCallNode):
return node
if not (node.type.is_int or node.type.is_float):
return node
if isinstance(arg, ExprNodes.SimpleCallNode):
if node.type.is_int or node.type.is_float:
return self._optimise_numeric_cast_call(node, arg)
return node
def _optimise_numeric_cast_call(self, node, arg):
function = arg.function
if not isinstance(function, ExprNodes.NameNode) \
or not function.type.is_builtin_type \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment