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
Gwenaël Samain
cython
Commits
bf6f3c10
Commit
bf6f3c10
authored
Nov 11, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Visitor cleanup: mark internal (cdef) methods with leading underscore in .py files
parent
3facfcec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
Cython/Compiler/Visitor.pxd
Cython/Compiler/Visitor.pxd
+2
-2
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+5
-5
No files found.
Cython/Compiler/Visitor.pxd
View file @
bf6f3c10
...
@@ -4,11 +4,11 @@ cdef class BasicVisitor:
...
@@ -4,11 +4,11 @@ cdef class BasicVisitor:
cdef
dict
dispatch_table
cdef
dict
dispatch_table
cpdef
visit
(
self
,
obj
)
cpdef
visit
(
self
,
obj
)
cdef
_visit
(
self
,
obj
)
cdef
_visit
(
self
,
obj
)
cdef
find_handler
(
self
,
obj
)
cdef
_
find_handler
(
self
,
obj
)
cdef
class
TreeVisitor
(
BasicVisitor
):
cdef
class
TreeVisitor
(
BasicVisitor
):
cdef
public
list
access_path
cdef
public
list
access_path
cdef
visitchild
(
self
,
child
,
parent
,
attrname
,
idx
)
cdef
_
visitchild
(
self
,
child
,
parent
,
attrname
,
idx
)
@
cython
.
locals
(
idx
=
int
)
@
cython
.
locals
(
idx
=
int
)
cdef
dict
_visitchildren
(
self
,
parent
,
attrs
)
cdef
dict
_visitchildren
(
self
,
parent
,
attrs
)
cpdef
visitchildren
(
self
,
parent
,
attrs
=*
)
cpdef
visitchildren
(
self
,
parent
,
attrs
=*
)
...
...
Cython/Compiler/Visitor.py
View file @
bf6f3c10
...
@@ -26,11 +26,11 @@ class BasicVisitor(object):
...
@@ -26,11 +26,11 @@ class BasicVisitor(object):
try
:
try
:
handler_method
=
self
.
dispatch_table
[
type
(
obj
)]
handler_method
=
self
.
dispatch_table
[
type
(
obj
)]
except
KeyError
:
except
KeyError
:
handler_method
=
self
.
find_handler
(
obj
)
handler_method
=
self
.
_
find_handler
(
obj
)
self
.
dispatch_table
[
type
(
obj
)]
=
handler_method
self
.
dispatch_table
[
type
(
obj
)]
=
handler_method
return
handler_method
(
obj
)
return
handler_method
(
obj
)
def
find_handler
(
self
,
obj
):
def
_
find_handler
(
self
,
obj
):
cls
=
type
(
obj
)
cls
=
type
(
obj
)
#print "Cache miss for class %s in visitor %s" % (
#print "Cache miss for class %s in visitor %s" % (
# cls.__name__, type(self).__name__)
# cls.__name__, type(self).__name__)
...
@@ -176,7 +176,7 @@ class TreeVisitor(BasicVisitor):
...
@@ -176,7 +176,7 @@ class TreeVisitor(BasicVisitor):
last_node
.
pos
,
self
.
__class__
.
__name__
,
last_node
.
pos
,
self
.
__class__
.
__name__
,
u'
\
n
'
.
join
(
trace
),
e
,
stacktrace
)
u'
\
n
'
.
join
(
trace
),
e
,
stacktrace
)
def
visitchild
(
self
,
child
,
parent
,
attrname
,
idx
):
def
_
visitchild
(
self
,
child
,
parent
,
attrname
,
idx
):
self
.
access_path
.
append
((
parent
,
attrname
,
idx
))
self
.
access_path
.
append
((
parent
,
attrname
,
idx
))
try
:
try
:
result
=
self
.
_visit
(
child
)
result
=
self
.
_visit
(
child
)
...
@@ -209,9 +209,9 @@ class TreeVisitor(BasicVisitor):
...
@@ -209,9 +209,9 @@ class TreeVisitor(BasicVisitor):
child
=
getattr
(
parent
,
attr
)
child
=
getattr
(
parent
,
attr
)
if
child
is
not
None
:
if
child
is
not
None
:
if
type
(
child
)
is
list
:
if
type
(
child
)
is
list
:
childretval
=
[
self
.
visitchild
(
x
,
parent
,
attr
,
idx
)
for
idx
,
x
in
enumerate
(
child
)]
childretval
=
[
self
.
_
visitchild
(
x
,
parent
,
attr
,
idx
)
for
idx
,
x
in
enumerate
(
child
)]
else
:
else
:
childretval
=
self
.
visitchild
(
child
,
parent
,
attr
,
None
)
childretval
=
self
.
_
visitchild
(
child
,
parent
,
attr
,
None
)
assert
not
isinstance
(
childretval
,
list
),
'Cannot insert list here: %s in %r'
%
(
attr
,
parent
)
assert
not
isinstance
(
childretval
,
list
),
'Cannot insert list here: %s in %r'
%
(
attr
,
parent
)
result
[
attr
]
=
childretval
result
[
attr
]
=
childretval
return
result
return
result
...
...
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