def invoke_with(self, args, self_fn): from pixie.vm.array import array argc = len(args) if self._required_arity == 0: return self._code.invoke_with([array(args)], self_fn) if argc == self._required_arity: new_args = resize_list(args, len(args) + 1) new_args[len(args)] = array([]) return self._code.invoke_with(new_args, self_fn) elif argc > self._required_arity: start = slice_from_start(args, self._required_arity, 1) rest = slice_to_end(args, self._required_arity) start[self._required_arity] = array(rest) return self._code.invoke_with(start, self_fn) affirm(False, u"Got " + unicode(str(argc)) + u" arg(s) need at least " + unicode(str(self._required_arity)))
def invoke_other(obj, args): from pixie.vm.array import array return rt.apply(_invoke, obj, array(args))