Commit 749fe583 authored by Stefan Behnel's avatar Stefan Behnel

Clean up individual child traversals in transforms using the new visitchild() method.

parent 84ed66f4
......@@ -914,7 +914,7 @@ class InterpretCompilerDirectives(CythonTransform):
def visit_NameNode(self, node):
if node.annotation:
self.visit(node.annotation)
self.visitchild(node, 'annotation')
if node.name in self.cython_module_names:
node.is_cython_module = True
else:
......@@ -941,7 +941,7 @@ class InterpretCompilerDirectives(CythonTransform):
return node
def visit_NewExprNode(self, node):
self.visit(node.cppclass)
self.visitchild(node, 'cppclass')
self.visitchildren(node)
return node
......@@ -950,7 +950,7 @@ class InterpretCompilerDirectives(CythonTransform):
# decorator), returns a list of (directivename, value) pairs.
# Otherwise, returns None
if isinstance(node, ExprNodes.CallNode):
self.visit(node.function)
self.visitchild(node, 'function')
optname = node.function.as_cython_attribute()
if optname:
directivetype = Options.directive_types.get(optname)
......@@ -1253,7 +1253,7 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
return node
def visit_CallNode(self, node):
self.visit(node.function)
self.visitchild(node, 'function')
if not self.parallel_directive:
self.visitchildren(node, exclude=('function',))
return node
......@@ -1286,7 +1286,7 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
"Nested parallel with blocks are disallowed")
self.state = 'parallel with'
body = self.visit(node.body)
body = self.visitchild(node, 'body')
self.state = None
newnode.body = body
......@@ -1302,13 +1302,13 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
error(node.pos, "The parallel directive must be called")
return None
node.body = self.visit(node.body)
self.visitchild(node, 'body')
return node
def visit_ForInStatNode(self, node):
"Rewrite 'for i in cython.parallel.prange(...):'"
self.visit(node.iterator)
self.visit(node.target)
self.visitchild(node, 'iterator')
self.visitchild(node, 'target')
in_prange = isinstance(node.iterator.sequence,
Nodes.ParallelRangeNode)
......@@ -1331,9 +1331,9 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
self.state = 'prange'
self.visit(node.body)
self.visitchild(node, 'body')
self.state = previous_state
self.visit(node.else_clause)
self.visitchild(node, 'else_clause')
return node
def visit(self, node):
......@@ -1960,7 +1960,7 @@ if VALUE is not None:
"Handle def or cpdef fused functions"
# Create PyCFunction nodes for each specialization
node.stats.insert(0, node.py_func)
node.py_func = self.visit(node.py_func)
self.visitchild(node, 'py_func')
node.update_fused_defnode_entry(env)
# For the moment, fused functions do not support METH_FASTCALL
node.py_func.entry.signature.use_fastcall = False
......@@ -2242,13 +2242,12 @@ if VALUE is not None:
return None
def visit_CnameDecoratorNode(self, node):
child_node = self.visit(node.node)
child_node = self.visitchild(node, 'node')
if not child_node:
return None
if type(child_node) is list: # Assignment synthesized
node.child_node = child_node[0]
node.node = child_node[0]
return [node] + child_node[1:]
node.node = child_node
return node
def create_Property(self, entry):
......
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