Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
16e4fbd6
Commit
16e4fbd6
authored
Apr 27, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more dead code removal for conditionals
parent
491aa659
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-2
tests/errors/break_outside_loop.pyx
tests/errors/break_outside_loop.pyx
+4
-1
tests/errors/continue_outside_loop.pyx
tests/errors/continue_outside_loop.pyx
+3
-1
tests/errors/literal_lists.pyx
tests/errors/literal_lists.pyx
+4
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
16e4fbd6
...
...
@@ -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
...
...
tests/errors/break_outside_loop.pyx
View file @
16e4fbd6
...
...
@@ -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
...
...
tests/errors/continue_outside_loop.pyx
View file @
16e4fbd6
...
...
@@ -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
...
...
tests/errors/literal_lists.pyx
View file @
16e4fbd6
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
"""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment