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
5215b5b2
Commit
5215b5b2
authored
Nov 12, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimise Visitor.ScopeTrackingTransform
parent
356808fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
Cython/Compiler/Visitor.pxd
Cython/Compiler/Visitor.pxd
+5
-0
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+2
-2
No files found.
Cython/Compiler/Visitor.pxd
View file @
5215b5b2
...
@@ -21,6 +21,11 @@ cdef class CythonTransform(VisitorTransform):
...
@@ -21,6 +21,11 @@ cdef class CythonTransform(VisitorTransform):
cdef
public
context
cdef
public
context
cdef
public
current_directives
cdef
public
current_directives
cdef
class
ScopeTrackingTransform
(
CythonTransform
):
cdef
public
scope_type
cdef
public
scope_node
cdef
visit_scope
(
self
,
node
,
scope_type
)
cdef
class
EnvTransform
(
CythonTransform
):
cdef
class
EnvTransform
(
CythonTransform
):
cdef
public
list
env_stack
cdef
public
list
env_stack
...
...
Cython/Compiler/Visitor.py
View file @
5215b5b2
...
@@ -291,8 +291,8 @@ class CythonTransform(VisitorTransform):
...
@@ -291,8 +291,8 @@ class CythonTransform(VisitorTransform):
class
ScopeTrackingTransform
(
CythonTransform
):
class
ScopeTrackingTransform
(
CythonTransform
):
# Keeps track of type of scopes
# Keeps track of type of scopes
scope_type
=
None
# can be either of 'module', 'function', 'cclass', 'pyclass
'
#scope_type: can be either of 'module', 'function', 'cclass', 'pyclass', 'struct
'
scope_node
=
Non
e
#scope_node: the node that owns the current scop
e
def
visit_ModuleNode
(
self
,
node
):
def
visit_ModuleNode
(
self
,
node
):
self
.
scope_type
=
'module'
self
.
scope_type
=
'module'
...
...
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