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
Kirill Smelkov
cython
Commits
46f2563c
Commit
46f2563c
authored
Aug 05, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support named labels to improve code readability
parent
d5a8f001
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+7
-4
No files found.
Cython/Compiler/Code.py
View file @
46f2563c
...
...
@@ -30,14 +30,17 @@ class FunctionContext(object):
self
.
temps_used_type
=
{}
# name -> type
self
.
temp_counter
=
0
def
new_label
(
self
):
def
new_label
(
self
,
name
=
None
):
n
=
self
.
label_counter
self
.
label_counter
=
n
+
1
return
"%s%d"
%
(
Naming
.
label_prefix
,
n
)
label
=
"%s%d"
%
(
Naming
.
label_prefix
,
n
)
if
name
is
not
None
:
label
+=
'_'
+
name
return
label
def
new_error_label
(
self
):
old_err_lbl
=
self
.
error_label
self
.
error_label
=
self
.
new_label
()
self
.
error_label
=
self
.
new_label
(
'error'
)
return
old_err_lbl
def
get_loop_labels
(
self
):
...
...
@@ -219,7 +222,7 @@ class CCodeWriter(object):
# Functions delegated to function scope
def
new_label
(
self
):
return
self
.
func
.
new_label
(
)
def
new_label
(
self
,
name
=
None
):
return
self
.
func
.
new_label
(
name
)
def
new_error_label
(
self
):
return
self
.
func
.
new_error_label
()
def
get_loop_labels
(
self
):
return
self
.
func
.
get_loop_labels
()
def
set_loop_labels
(
self
,
labels
):
return
self
.
func
.
set_loop_labels
(
labels
)
...
...
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