Commit 09a9be1d authored by Stefan Behnel's avatar Stefan Behnel

merge

parents a08d2d04 5c16873c
......@@ -9701,6 +9701,14 @@ class BoolBinopNode(ExprNode):
operand = BoolBinopResultNode(operand, self.type, env)
return operand
def wrap_operands(self, env):
"""
Must get called by transforms that want to create a correct BoolBinopNode
after the type analysis phase.
"""
self.operand1 = self._wrap_operand(self.operand1, env)
self.operand2 = self._wrap_operand(self.operand2, env)
def coerce_to_boolean(self, env):
return self.coerce_to(PyrexTypes.c_bint_type, env)
......
......@@ -2138,7 +2138,7 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
"""Transform int() into a faster C function call.
"""
if len(pos_args) == 0:
return ExprNodes.IntNode(node, value="0", constant_result=0,
return ExprNodes.IntNode(node.pos, value="0", constant_result=0,
type=PyrexTypes.py_object_type)
elif len(pos_args) != 1:
return node # int(x, base)
......@@ -2316,10 +2316,10 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
is_temp = True,
))
def join_with_or(a,b, make_binop_node=ExprNodes.binop_node):
def join_with_or(a, b, make_binop_node=ExprNodes.binop_node):
or_node = make_binop_node(node.pos, 'or', a, b)
or_node.type = PyrexTypes.c_bint_type
or_node.is_temp = True
or_node.wrap_operands(env)
return or_node
test_node = reduce(join_with_or, test_nodes).coerce_to(node.type, env)
......
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