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
Boxiang Sun
cython
Commits
d95362ee
Commit
d95362ee
authored
Aug 18, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mark_assignment: lookup for entry in current scope if None
parent
8f3dce93
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
Cython/Compiler/FlowControl.pxd
Cython/Compiler/FlowControl.pxd
+1
-1
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+11
-7
No files found.
Cython/Compiler/FlowControl.pxd
View file @
d95362ee
...
@@ -54,7 +54,7 @@ cdef class ControlFlow:
...
@@ -54,7 +54,7 @@ cdef class ControlFlow:
cpdef
nextblock
(
self
,
parent
=*
)
cpdef
nextblock
(
self
,
parent
=*
)
cpdef
bint
is_tracked
(
self
,
entry
)
cpdef
bint
is_tracked
(
self
,
entry
)
cpdef
mark_position
(
self
,
node
)
cpdef
mark_position
(
self
,
node
)
cpdef
mark_assignment
(
self
,
lhs
,
rhs
,
entry
=*
)
cpdef
mark_assignment
(
self
,
lhs
,
rhs
,
entry
)
cpdef
mark_argument
(
self
,
lhs
,
rhs
,
entry
)
cpdef
mark_argument
(
self
,
lhs
,
rhs
,
entry
)
cpdef
mark_deletion
(
self
,
node
,
entry
)
cpdef
mark_deletion
(
self
,
node
,
entry
)
cpdef
mark_reference
(
self
,
node
,
entry
)
cpdef
mark_reference
(
self
,
node
,
entry
)
...
...
Cython/Compiler/FlowControl.py
View file @
d95362ee
...
@@ -151,10 +151,8 @@ class ControlFlow(object):
...
@@ -151,10 +151,8 @@ class ControlFlow(object):
if
self
.
block
:
if
self
.
block
:
self
.
block
.
positions
.
add
(
node
.
pos
[:
2
])
self
.
block
.
positions
.
add
(
node
.
pos
[:
2
])
def
mark_assignment
(
self
,
lhs
,
rhs
,
entry
=
None
):
def
mark_assignment
(
self
,
lhs
,
rhs
,
entry
):
if
self
.
block
:
if
self
.
block
:
if
entry
is
None
:
entry
=
lhs
.
entry
if
not
self
.
is_tracked
(
entry
):
if
not
self
.
is_tracked
(
entry
):
return
return
assignment
=
NameAssignment
(
lhs
,
rhs
,
entry
)
assignment
=
NameAssignment
(
lhs
,
rhs
,
entry
)
...
@@ -619,7 +617,10 @@ class CreateControlFlowGraph(CythonTransform):
...
@@ -619,7 +617,10 @@ class CreateControlFlowGraph(CythonTransform):
def
visit_DefNode
(
self
,
node
):
def
visit_DefNode
(
self
,
node
):
## XXX: no target name node here
## XXX: no target name node here
node
.
used
=
True
node
.
used
=
True
self
.
flow
.
mark_assignment
(
node
,
object_expr
,
self
.
env
.
lookup
(
node
.
name
))
entry
=
node
.
entry
if
entry
.
is_anonymous
:
entry
=
self
.
env
.
lookup
(
node
.
name
)
self
.
flow
.
mark_assignment
(
node
,
object_expr
,
entry
)
return
self
.
visit_FuncDefNode
(
node
)
return
self
.
visit_FuncDefNode
(
node
)
def
visit_GeneratorBodyDefNode
(
self
,
node
):
def
visit_GeneratorBodyDefNode
(
self
,
node
):
...
@@ -643,10 +644,13 @@ class CreateControlFlowGraph(CythonTransform):
...
@@ -643,10 +644,13 @@ class CreateControlFlowGraph(CythonTransform):
if
not
rhs
:
if
not
rhs
:
rhs
=
object_expr
rhs
=
object_expr
if
lhs
.
is_name
:
if
lhs
.
is_name
:
if
lhs
.
entry
is
None
:
if
lhs
.
entry
is
not
None
:
# TODO: This shouldn't happen...
entry
=
lhs
.
entry
else
:
entry
=
self
.
env
.
lookup
(
lhs
.
name
)
if
entry
is
None
:
# TODO: This shouldn't happen...
return
return
self
.
flow
.
mark_assignment
(
lhs
,
rhs
)
self
.
flow
.
mark_assignment
(
lhs
,
rhs
,
entry
)
elif
isinstance
(
lhs
,
ExprNodes
.
SequenceNode
):
elif
isinstance
(
lhs
,
ExprNodes
.
SequenceNode
):
for
arg
in
lhs
.
args
:
for
arg
in
lhs
.
args
:
self
.
mark_assignment
(
arg
)
self
.
mark_assignment
(
arg
)
...
...
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