From: Stefan Behnel Date: Fri, 12 Nov 2010 11:18:56 +0000 (+0100) Subject: optimise Visitor.ScopeTrackingTransform X-Git-Tag: 0.14.alpha0~172 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5215b5b2204639b213c3d24da7813b3e51f0144d;p=cython.git optimise Visitor.ScopeTrackingTransform --- diff --git a/Cython/Compiler/Visitor.pxd b/Cython/Compiler/Visitor.pxd index 495cece4..8c88a3dc 100644 --- a/Cython/Compiler/Visitor.pxd +++ b/Cython/Compiler/Visitor.pxd @@ -21,6 +21,11 @@ cdef class CythonTransform(VisitorTransform): cdef public context 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 public list env_stack diff --git a/Cython/Compiler/Visitor.py b/Cython/Compiler/Visitor.py index 6ff36034..a9cd264c 100644 --- a/Cython/Compiler/Visitor.py +++ b/Cython/Compiler/Visitor.py @@ -291,8 +291,8 @@ class CythonTransform(VisitorTransform): class ScopeTrackingTransform(CythonTransform): # Keeps track of type of scopes - scope_type = None # can be either of 'module', 'function', 'cclass', 'pyclass' - scope_node = None + #scope_type: can be either of 'module', 'function', 'cclass', 'pyclass', 'struct' + #scope_node: the node that owns the current scope def visit_ModuleNode(self, node): self.scope_type = 'module'