Exemplo n.º 1
0
 def visit_with(self, node, parent):
     """visit a With node by returning a fresh instance of it"""
     newnode = new.With()
     self._set_infos(node, newnode, parent)
     newnode.expr = self.visit(node.expr, newnode)
     newnode.vars = self.visit(node.vars, newnode)
     newnode.body = [self.visit(child, newnode) for child in node.body]
     return newnode
Exemplo n.º 2
0
 def visit_with(self, node, parent):
     """visit a With node by returning a fresh instance of it"""
     newnode = new.With()
     _lineno_parent(node, newnode, parent)
     newnode.expr = self.visit(node.context_expr, newnode)
     self.asscontext = "Ass"
     newnode.vars = self.visit(node.optional_vars, newnode)
     self.asscontext = None
     newnode.body = [self.visit(child, newnode) for child in node.body]
     newnode.set_line_info(newnode.last_child())
     return newnode
Exemplo n.º 3
0
 def visit_with(self, node, parent):
     newnode = new.With()
     _lineno_parent(node, newnode, parent)
     _node = getattr(node, 'items', [node])[0] # python 3.3 XXX
     newnode.expr = self.visit(_node.context_expr, newnode)
     self.asscontext = "Ass"
     if _node.optional_vars is not None:
         newnode.vars = self.visit(_node.optional_vars, newnode)
     self.asscontext = None
     newnode.body = [self.visit(child, newnode) for child in node.body]
     newnode.set_line_info(newnode.last_child())
     return newnode