Commit ba75e1df authored by Stefan Behnel's avatar Stefan Behnel

Simplify TrackNumpyAttributes transform.

parent 96b20eb0
...@@ -611,9 +611,11 @@ class PxdPostParse(CythonTransform, SkipDeclarations): ...@@ -611,9 +611,11 @@ class PxdPostParse(CythonTransform, SkipDeclarations):
else: else:
return node return node
class TrackNumpyAttributes(CythonTransform, SkipDeclarations):
def __init__(self, context): class TrackNumpyAttributes(VisitorTransform, SkipDeclarations):
super(TrackNumpyAttributes, self).__init__(context) # 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() self.numpy_module_names = set()
def visit_CImportStatNode(self, node): def visit_CImportStatNode(self, node):
...@@ -627,6 +629,9 @@ class TrackNumpyAttributes(CythonTransform, SkipDeclarations): ...@@ -627,6 +629,9 @@ class TrackNumpyAttributes(CythonTransform, SkipDeclarations):
node.is_numpy_attribute = True node.is_numpy_attribute = True
return node return node
visit_Node = VisitorTransform.recurse_to_children
class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
""" """
After parsing, directives can be stored in a number of places: After parsing, directives can be stored in a number of places:
......
...@@ -6,7 +6,6 @@ from time import time ...@@ -6,7 +6,6 @@ from time import time
from . import Errors from . import Errors
from . import DebugFlags from . import DebugFlags
from . import Options from . import Options
from .Visitor import CythonTransform
from .Errors import CompileError, InternalError, AbortError from .Errors import CompileError, InternalError, AbortError
from . import Naming from . import Naming
...@@ -183,7 +182,7 @@ def create_pipeline(context, mode, exclude_classes=()): ...@@ -183,7 +182,7 @@ def create_pipeline(context, mode, exclude_classes=()):
NormalizeTree(context), NormalizeTree(context),
PostParse(context), PostParse(context),
_specific_post_parse, _specific_post_parse,
TrackNumpyAttributes(context), TrackNumpyAttributes(),
InterpretCompilerDirectives(context, context.compiler_directives), InterpretCompilerDirectives(context, context.compiler_directives),
ParallelRangeTransform(context), ParallelRangeTransform(context),
AdjustDefByDirectives(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