child_attrs = ["args"]
- def flatten_args(self):
- return self._flatten_args(self, [])
-
- def _flatten_args(self, seq, result):
- for arg in seq.args:
- if arg.is_sequence_constructor:
- self._flatten_args(arg, result)
- else:
- result.append(arg)
- return result
-
def analyse_declarations(self, env):
- for arg in self.flatten_args():
+ for arg in self.args:
arg.analyse_target_declaration(env)
def analyse_expressions(self, env):
- for arg in self.flatten_args():
+ for arg in self.args:
arg.analyse_target_expression(env, None)
if arg.type.is_pyobject:
pass
#arg.release_target_temp(env)
def nogil_check(self, env):
- for arg in self.flatten_args():
+ for arg in self.args:
if arg.type.is_pyobject:
self.gil_error()
gil_message = "Deleting Python object"
def generate_execution_code(self, code):
- for arg in self.flatten_args():
+ for arg in self.args:
if arg.type.is_pyobject:
arg.generate_deletion_code(code)
elif arg.type.is_ptr and arg.type.base_type.is_cpp_class:
return assign_node
+ def _flatten_sequence(self, seq, result):
+ for arg in seq.args:
+ if arg.is_sequence_constructor:
+ self._flatten_sequence(arg, result)
+ else:
+ result.append(arg)
+ return result
+
+ def visit_DelStatNode(self, node):
+ self.visitchildren(node)
+ node.args = self._flatten_sequence(node, [])
+ return node
+
+
def eliminate_rhs_duplicates(expr_list_list, ref_node_sequence):
"""Replace rhs items by LetRefNodes if they appear more than once.
Creates a sequence of LetRefNodes that set up the required temps