def op_primitive_method_call(self, arg): primitive = primitives.primitives_by_name[arg] arity = primitives.all_primitives_arg_count[arg] arguments = [] for i in xrange(arity): arguments.append(self.stack.pop()) receiver = self.stack.pop() res = primitives.call(primitive, receiver, arguments, self.interpreter.builtins) self.stack.append(res)
def eval_PrimitiveMethodCall(self, ast, context): receiver = self.eval(ast.receiver, context) arguments = map(lambda a: self.eval(a, context), ast.arguments) return primitives.call(ast.methodname, receiver, arguments, self.builtins)