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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
e8b82966
Commit
e8b82966
authored
May 04, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use cf prefix for control-flow related members
parent
51af284d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+9
-9
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-0
No files found.
Cython/Compiler/FlowControl.py
View file @
e8b82966
...
...
@@ -383,9 +383,9 @@ def check_definitions(flow, compiler_directives):
else
:
state
[
stat
.
entry
]
=
set
([
Uninitialized
])
assignments
.
add
(
stat
)
stat
.
entry
.
_assignments
.
append
(
stat
)
stat
.
entry
.
cf
_assignments
.
append
(
stat
)
elif
isinstance
(
stat
,
NameReference
):
stat
.
entry
.
references
.
append
(
stat
)
stat
.
entry
.
cf_
references
.
append
(
stat
)
if
Uninitialized
in
state
[
stat
.
entry
]:
if
stat
.
entry
.
from_closure
:
pass
# Can be uninitialized here
...
...
@@ -406,21 +406,21 @@ def check_definitions(flow, compiler_directives):
for
assmt
in
assignments
:
if
not
assmt
.
refs
and
not
assmt
.
entry
.
is_pyclass_attr
\
and
not
assmt
.
entry
.
in_closure
:
if
assmt
.
entry
.
references
and
warn_unused_result
:
if
assmt
.
entry
.
cf_
references
and
warn_unused_result
:
if
assmt
.
is_arg
:
messages
.
warning
(
assmt
.
pos
,
"Unused argument value '%s'"
%
assmt
.
entry
.
name
)
else
:
messages
.
warning
(
assmt
.
pos
,
"Unused result in '%s'"
%
assmt
.
entry
.
name
)
assmt
.
lhs
.
used
=
False
assmt
.
lhs
.
cf_
used
=
False
for
entry
in
flow
.
entries
:
if
not
entry
.
references
and
not
entry
.
is_pyclass_attr
and
not
entry
.
in_closure
:
if
not
entry
.
cf_
references
and
not
entry
.
is_pyclass_attr
and
not
entry
.
in_closure
:
# TODO: handle unused buffers
if
entry
.
type
.
is_buffer
:
entry
.
used
=
True
entry
.
cf_
used
=
True
continue
# TODO: starred args entries are not marked with is_arg flag
for
assmt
in
entry
.
_assignments
:
for
assmt
in
entry
.
cf
_assignments
:
if
assmt
.
is_arg
:
is_arg
=
True
break
...
...
@@ -430,11 +430,11 @@ def check_definitions(flow, compiler_directives):
if
warn_unused_arg
:
messages
.
warning
(
entry
.
pos
,
"Unused argument '%s'"
%
entry
.
name
)
# TODO: handle unused arguments
entry
.
used
=
True
entry
.
cf_
used
=
True
else
:
if
warn_unused
:
messages
.
warning
(
entry
.
pos
,
"Unused entry '%s'"
%
entry
.
name
)
entry
.
used
=
False
entry
.
cf_
used
=
False
# Sort warnings by position
messages
.
sort
()
...
...
Cython/Compiler/Symtab.py
View file @
e8b82966
...
...
@@ -186,6 +186,8 @@ class Entry(object):
self.init = init
self.overloaded_alternatives = []
self.assignments = []
self.cf_assignments = []
self.cf_references = []
def __repr__(self):
return "
Entry
(
name
=%
s
,
type
=%
s
)
" % (self.name, self.type)
...
...
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