Commit 16e4fbd6 authored by Stefan Behnel's avatar Stefan Behnel

more dead code removal for conditionals

parent 491aa659
......@@ -327,8 +327,9 @@ class ExprNode(Node):
# time we get the result.
self.analyse_types(env)
bool = self.coerce_to_boolean(env)
temp_bool = bool.coerce_to_temp(env)
return temp_bool
if not bool.is_simple():
bool = bool.coerce_to_temp(env)
return bool
# --------------- Type Inference -----------------
......@@ -6383,6 +6384,7 @@ class CoerceToTempNode(CoercionNode):
def __init__(self, arg, env):
CoercionNode.__init__(self, arg)
self.type = self.arg.type
self.constant_result = self.arg.constant_result
self.is_temp = 1
if self.type.is_pyobject:
self.result_ctype = py_object_type
......@@ -6395,6 +6397,8 @@ class CoerceToTempNode(CoercionNode):
def coerce_to_boolean(self, env):
self.arg = self.arg.coerce_to_boolean(env)
if self.arg.is_simple():
return self.arg
self.type = self.arg.type
self.result_ctype = self.type
return self
......
......@@ -16,11 +16,14 @@ except: pass
try: break
finally: pass
if True:
if bool_result():
break
else:
break
def bool_result():
return True
_ERRORS = u'''
2:0: break statement not inside loop
......
......@@ -16,11 +16,13 @@ except: pass
try: continue
finally: pass
if True:
if bool_result():
continue
else:
continue
def bool_result():
return True
_ERRORS = u'''
2:0: continue statement not inside loop
......
def f():
cdef int* p
if False:
if false():
p = [1, 2, 3]
def false():
return False
_ERRORS = u"""
4:10: Literal list must be assigned to pointer at time of declaration
"""
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