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
ff75036d
Commit
ff75036d
authored
Dec 06, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
da68bab8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+14
-15
No files found.
Cython/Compiler/TypeInference.py
View file @
ff75036d
...
...
@@ -52,24 +52,23 @@ class MarkAssignments(CythonTransform):
def
visit_ForInStatNode
(
self
,
node
):
# TODO: Remove redundancy with range optimization...
is_
range
=
False
is_
special
=
False
sequence
=
node
.
iterator
.
sequence
if
isinstance
(
sequence
,
ExprNodes
.
SimpleCallNode
):
function
=
sequence
.
function
if
sequence
.
self
is
None
and
\
isinstance
(
function
,
ExprNodes
.
NameNode
)
and
\
function
.
name
in
(
'range'
,
'xrange'
):
is_range
=
True
self
.
mark_assignment
(
node
.
target
,
sequence
.
args
[
0
])
if
len
(
sequence
.
args
)
>
1
:
self
.
mark_assignment
(
node
.
target
,
sequence
.
args
[
1
])
if
sequence
.
self
is
None
and
function
.
is_name
:
if
function
.
name
in
(
'range'
,
'xrange'
):
is_special
=
True
for
arg
in
sequence
.
args
[:
2
]:
self
.
mark_assignment
(
node
.
target
,
arg
)
if
len
(
sequence
.
args
)
>
2
:
self
.
mark_assignment
(
node
.
target
,
ExprNodes
.
binop_node
(
node
.
pos
,
'+'
,
sequence
.
args
[
0
],
sequence
.
args
[
2
]))
if
not
is_range
:
self
.
mark_assignment
(
node
.
target
,
ExprNodes
.
binop_node
(
node
.
pos
,
'+'
,
sequence
.
args
[
0
],
sequence
.
args
[
2
]))
if
not
is_special
:
self
.
mark_assignment
(
node
.
target
,
object_expr
)
self
.
visitchildren
(
node
)
return
node
...
...
@@ -166,7 +165,7 @@ class SimpleAssignmentTypeInferer:
if
types
:
result_type
=
reduce
(
spanning_type
,
types
)
else
:
#
List comprehension
?
#
FIXME: raise a warning
?
# print "No assignments", entry.pos, entry
result_type
=
py_object_type
entry
.
type
=
find_safe_type
(
result_type
,
which_types_to_infer
)
...
...
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