Exemplo n.º 1
0
 def visit_while(self, node, parent):
     """visit a While node by returning a fresh instance of it"""
     newnode = new.While()
     self._set_infos(node, newnode, parent)
     newnode.test = self.visit(node.test, newnode)
     newnode.body = [self.visit(child, newnode) for child in node.body.nodes]
     newnode.orelse = self._init_else_node(node, newnode)
     return newnode
Exemplo n.º 2
0
 def visit_while(self, node, parent):
     """visit a While node by returning a fresh instance of it"""
     newnode = new.While()
     _lineno_parent(node, newnode, parent)
     newnode.test = self.visit(node.test, newnode)
     newnode.body = [self.visit(child, newnode) for child in node.body]
     newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
     newnode.set_line_info(newnode.last_child())
     return newnode