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
88213614
Commit
88213614
authored
Dec 21, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more cythonisation in Visitor.py
parent
aaa5c5f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
Cython/Compiler/Visitor.pxd
Cython/Compiler/Visitor.pxd
+3
-2
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+5
-2
No files found.
Cython/Compiler/Visitor.pxd
View file @
88213614
cdef
class
BasicVisitor
:
cdef
obje
ct
dispatch_table
cdef
di
ct
dispatch_table
cpdef
visit
(
self
,
obj
)
cdef
class
TreeVisitor
(
BasicVisitor
):
cdef
public
access_path
cdef
public
list
access_path
cpdef
visitchild
(
self
,
child
,
parent
,
attrname
,
idx
)
cdef
class
VisitorTransform
(
TreeVisitor
):
cdef
object
_super_visitchildren
cpdef
visitchildren
(
self
,
parent
,
attrs
=*
)
cpdef
recurse_to_children
(
self
,
node
)
...
...
Cython/Compiler/Visitor.py
View file @
88213614
...
...
@@ -142,9 +142,12 @@ class VisitorTransform(TreeVisitor):
was not, an exception will be raised. (Typically you want to ensure that you
are within a StatListNode or similar before doing this.)
"""
def
__init__
(
self
):
super
(
VisitorTransform
,
self
).
__init__
()
self
.
_super_visitchildren
=
super
(
VisitorTransform
,
self
).
visitchildren
def
visitchildren
(
self
,
parent
,
attrs
=
None
):
# result = super(VisitorTransform, self).visitchildren(parent, attrs)
result
=
TreeVisitor
.
visitchildren
(
self
,
parent
,
attrs
)
result
=
self
.
_super_visitchildren
(
parent
,
attrs
)
for
attr
,
newnode
in
result
.
iteritems
():
if
not
isinstance
(
newnode
,
list
):
setattr
(
parent
,
attr
,
newnode
)
...
...
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