Example #1
0
File: soa.py Project: climbus/rope
 def _Call(self, node):
     for child in rope.base.ast.get_child_nodes(node):
         rope.base.ast.walk(child, self)
     primary, pyname = evaluate.eval_node2(self.scope, node.func)
     if pyname is None:
         return
     pyfunction = pyname.get_object()
     if isinstance(pyfunction, pyobjects.AbstractFunction):
         args = arguments.create_arguments(primary, pyfunction, node, self.scope)
     elif isinstance(pyfunction, pyobjects.PyClass):
         pyclass = pyfunction
         if "__init__" in pyfunction:
             pyfunction = pyfunction["__init__"].get_object()
         pyname = rope.base.pynames.UnboundName(pyobjects.PyObject(pyclass))
         args = self._args_with_self(primary, pyname, pyfunction, node)
     elif "__call__" in pyfunction:
         pyfunction = pyfunction["__call__"].get_object()
         args = self._args_with_self(primary, pyname, pyfunction, node)
     else:
         return
     self._call(pyfunction, args)
Example #2
0
 def _Call(self, node):
     for child in rope.base.ast.get_child_nodes(node):
         rope.base.ast.walk(child, self)
     primary, pyname = evaluate.get_primary_and_result(self.scope, node.func)
     if pyname is None:
         return
     pyfunction = pyname.get_object()
     if isinstance(pyfunction, pyobjects.AbstractFunction):
         args = arguments.create_arguments(primary, pyfunction, node, self.scope)
     elif isinstance(pyfunction, pyobjects.PyClass):
         pyclass = pyfunction
         if "__init__" in pyfunction:
             pyfunction = pyfunction["__init__"].get_object()
         pyname = rope.base.pynames.UnboundName(pyobjects.PyObject(pyclass))
         args = self._args_with_self(primary, pyname, pyfunction, node)
     elif "__call__" in pyfunction:
         pyfunction = pyfunction["__call__"].get_object()
         args = self._args_with_self(primary, pyname, pyfunction, node)
     else:
         return
     self._call(pyfunction, args)
Example #3
0
 def _get_returned(pyobject):
     args = arguments.create_arguments(primary, pyobject, node, self.scope)
     return pyobject.get_returned_object(args)
Example #4
0
 def _args_with_self(self, primary, self_pyname, pyfunction, node):
     base_args = arguments.create_arguments(primary, pyfunction,
                                            node, self.scope)
     return arguments.MixedArguments(self_pyname, base_args, self.scope)
Example #5
0
 def _get_returned(pyobject):
     args = arguments.create_arguments(primary, pyobject, node,
                                       self.scope)
     return pyobject.get_returned_object(args)
Example #6
0
 def _args_with_self(self, primary, self_pyname, pyfunction, node):
     base_args = arguments.create_arguments(primary, pyfunction, node,
                                            self.scope)
     return arguments.MixedArguments(self_pyname, base_args, self.scope)