Commit ba75e1df authored by Stefan Behnel's avatar Stefan Behnel

Simplify TrackNumpyAttributes transform.

parent 96b20eb0
......@@ -611,9 +611,11 @@ class PxdPostParse(CythonTransform, SkipDeclarations):
else:
return node
class TrackNumpyAttributes(CythonTransform, SkipDeclarations):
def __init__(self, context):
super(TrackNumpyAttributes, self).__init__(context)
class TrackNumpyAttributes(VisitorTransform, SkipDeclarations):
# TODO: Make name handling as good as in InterpretCompilerDirectives() below - probably best to merge the two.
def __init__(self):
super(TrackNumpyAttributes, self).__init__()
self.numpy_module_names = set()
def visit_CImportStatNode(self, node):
......@@ -627,6 +629,9 @@ class TrackNumpyAttributes(CythonTransform, SkipDeclarations):
node.is_numpy_attribute = True
return node
visit_Node = VisitorTransform.recurse_to_children
class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
"""
After parsing, directives can be stored in a number of places:
......
......@@ -6,7 +6,6 @@ from time import time
from . import Errors
from . import DebugFlags
from . import Options
from .Visitor import CythonTransform
from .Errors import CompileError, InternalError, AbortError
from . import Naming
......@@ -183,7 +182,7 @@ def create_pipeline(context, mode, exclude_classes=()):
NormalizeTree(context),
PostParse(context),
_specific_post_parse,
TrackNumpyAttributes(context),
TrackNumpyAttributes(),
InterpretCompilerDirectives(context, context.compiler_directives),
ParallelRangeTransform(context),
AdjustDefByDirectives(context),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment