From 5215b5b2204639b213c3d24da7813b3e51f0144d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 12 Nov 2010 12:18:56 +0100 Subject: [PATCH] optimise Visitor.ScopeTrackingTransform --- Cython/Compiler/Visitor.pxd | 5 +++++ Cython/Compiler/Visitor.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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' -- 2.26.2