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
Boxiang Sun
cython
Commits
08cc20e9
Commit
08cc20e9
authored
Nov 21, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
declare internal visitor functions 'final' to inject direct function calls
parent
95447d55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+6
-0
No files found.
Cython/Compiler/Visitor.py
View file @
08cc20e9
...
...
@@ -9,6 +9,8 @@ import ExprNodes
import
Errors
import
DebugFlags
import
cython
class
TreeVisitor
(
object
):
"""
Base class for writing visitors for a Cython tree, contains utilities for
...
...
@@ -132,6 +134,7 @@ class TreeVisitor(object):
getattr
(
last_node
,
'pos'
,
None
),
self
.
__class__
.
__name__
,
u'
\
n
'
.
join
(
trace
),
e
,
stacktrace
)
@
cython
.
final
def
find_handler
(
self
,
obj
):
# to resolve, try entire hierarchy
cls
=
type
(
obj
)
...
...
@@ -152,6 +155,7 @@ class TreeVisitor(object):
def
visit
(
self
,
obj
):
return
self
.
_visit
(
obj
)
@
cython
.
final
def
_visit
(
self
,
obj
):
try
:
handler_method
=
self
.
dispatch_table
[
type
(
obj
)]
...
...
@@ -160,6 +164,7 @@ class TreeVisitor(object):
self
.
dispatch_table
[
type
(
obj
)]
=
handler_method
return
handler_method
(
obj
)
@
cython
.
final
def
_visitchild
(
self
,
child
,
parent
,
attrname
,
idx
):
self
.
access_path
.
append
((
parent
,
attrname
,
idx
))
try
:
...
...
@@ -183,6 +188,7 @@ class TreeVisitor(object):
def
visitchildren
(
self
,
parent
,
attrs
=
None
):
return
self
.
_visitchildren
(
parent
,
attrs
)
@
cython
.
final
def
_visitchildren
(
self
,
parent
,
attrs
):
"""
Visits the children of the given parent. If parent is None, returns
...
...
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