diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2017-08-21 16:06:16 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-08-21 16:06:16 +0200 |
commit | ba75e1df396843fbfc012a9336906912f110eef2 (patch) | |
tree | 0dbbff1b5dc209dab1b607f7923562b5d778af0e /Cython/Compiler/ParseTreeTransforms.py | |
parent | 96b20eb00e84cce0022e77c75120d2cc700ae82e (diff) | |
download | cython-ba75e1df396843fbfc012a9336906912f110eef2.tar.gz |
Simplify TrackNumpyAttributes transform.
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r-- | Cython/Compiler/ParseTreeTransforms.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index aee77f81d..9e720c941 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -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: |