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
931b8d94
Commit
931b8d94
authored
May 26, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move message reporting to MessageCollection
parent
8df60525
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+13
-15
No files found.
Cython/Compiler/FlowControl.py
View file @
931b8d94
...
@@ -394,20 +394,24 @@ class GV(object):
...
@@ -394,20 +394,24 @@ class GV(object):
fp
.
write
(
' }
\
n
'
)
fp
.
write
(
' }
\
n
'
)
class
MessageCollection
(
list
)
:
class
MessageCollection
:
"""Collect error/warnings messages first then sort"""
"""Collect error/warnings messages first then sort"""
def
__init__
(
self
):
self
.
messages
=
[]
def
error
(
self
,
pos
,
message
):
def
error
(
self
,
pos
,
message
):
self
.
append
((
pos
,
True
,
message
))
self
.
messages
.
append
((
pos
,
True
,
message
))
def
warning
(
self
,
pos
,
message
):
def
warning
(
self
,
pos
,
message
):
self
.
append
((
pos
,
False
,
message
))
self
.
messages
.
append
((
pos
,
False
,
message
))
def
_key
(
self
,
item
):
return
item
[
0
]
def
sort
(
self
):
def
report
(
self
):
list
.
sort
(
self
,
key
=
self
.
_key
)
self
.
messages
.
sort
()
for
pos
,
is_error
,
message
in
self
.
messages
:
if
is_error
:
error
(
pos
,
message
)
else
:
warning
(
pos
,
message
,
2
)
def
check_definitions
(
flow
,
compiler_directives
):
def
check_definitions
(
flow
,
compiler_directives
):
...
@@ -524,13 +528,7 @@ def check_definitions(flow, compiler_directives):
...
@@ -524,13 +528,7 @@ def check_definitions(flow, compiler_directives):
messages
.
warning
(
entry
.
pos
,
"Unused entry '%s'"
%
entry
.
name
)
messages
.
warning
(
entry
.
pos
,
"Unused entry '%s'"
%
entry
.
name
)
entry
.
cf_used
=
False
entry
.
cf_used
=
False
# Sort warnings by position
messages
.
report
()
messages
.
sort
()
for
pos
,
is_error
,
message
in
messages
:
if
is_error
:
error
(
pos
,
message
)
else
:
warning
(
pos
,
message
,
2
)
class
AssignmentCollector
(
TreeVisitor
):
class
AssignmentCollector
(
TreeVisitor
):
...
...
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