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
ec5dbe46
Commit
ec5dbe46
authored
Jun 11, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream-lined Node.end_pos()
parent
860d2932
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+8
-8
No files found.
Cython/Compiler/Nodes.py
View file @
ec5dbe46
...
...
@@ -153,24 +153,24 @@ class Node(object):
self
.
body
.
annotate
(
code
)
def
end_pos
(
self
):
if
not
self
.
child_attrs
:
return
self
.
pos
try
:
return
self
.
_end_pos
except
AttributeError
:
flat
=
[]
pos
=
self
.
pos
for
attr
in
self
.
child_attrs
:
child
=
getattr
(
self
,
attr
)
# Sometimes lists, sometimes nodes
if
child
is
None
:
pass
elif
isinstance
(
child
,
list
):
flat
+=
child
for
c
in
child
:
pos
=
max
(
pos
,
c
.
end_pos
())
else
:
flat
.
append
(
child
)
if
len
(
flat
)
==
0
:
self
.
_end_pos
=
self
.
pos
else
:
self
.
_end_pos
=
max
([
child
.
end_pos
()
for
child
in
flat
])
return
self
.
_end_pos
pos
=
max
(
pos
,
child
.
end_pos
())
self
.
_end_pos
=
pos
return
pos
class
BlockNode
:
...
...
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