static mrb_value f_instance_eval(mrb_state *mrb, mrb_value self) { struct mrb_context *c = mrb->c; mrb_value b; mrb_int argc; mrb_value *argv; mrb_get_args(mrb, "*&", &argv, &argc, &b); if (mrb_nil_p(b)) { char *s; mrb_int len; char *file = NULL; mrb_int line = 1; mrb_value cv; struct RProc *proc; mrb_get_args(mrb, "s|zi", &s, &len, &file, &line); c->ci->acc = CI_ACC_SKIP; cv = mrb_singleton_class(mrb, self); c->ci->target_class = mrb_class_ptr(cv); proc = create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line); mrb->c->ci->env = NULL; return mrb_vm_run(mrb, proc, mrb->c->stack[0], 0); } else { mrb_get_args(mrb, "&", &b); return mrb_obj_instance_eval(mrb, self); } }
static mrb_value f_instance_eval(mrb_state *mrb, mrb_value self) { mrb_value b; mrb_int argc; mrb_value *argv; mrb_get_args(mrb, "*!&", &argv, &argc, &b); if (mrb_nil_p(b)) { char *s; mrb_int len; char *file = NULL; mrb_int line = 1; mrb_value cv; struct RProc *proc; mrb_get_args(mrb, "s|zi", &s, &len, &file, &line); cv = mrb_singleton_class(mrb, self); proc = create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line); MRB_PROC_SET_TARGET_CLASS(proc, mrb_class_ptr(cv)); mrb_assert(!MRB_PROC_CFUNC_P(proc)); mrb->c->ci->target_class = mrb_class_ptr(cv); return exec_irep(mrb, self, proc); } else { mrb_get_args(mrb, "&", &b); return mrb_obj_instance_eval(mrb, self); } }
static mrb_value f_instance_eval(mrb_state *mrb, mrb_value self) { mrb_value b; mrb_int argc; mrb_value *argv; mrb_get_args(mrb, "*&", &argv, &argc, &b); if (mrb_nil_p(b)) { char *s; mrb_int len; char *file = NULL; mrb_int line = 1; mrb_get_args(mrb, "s|zi", &s, &len, &file, &line); mrb->c->ci->acc = CI_ACC_SKIP; return mrb_run(mrb, create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line), self); } else { mrb_get_args(mrb, "&", &b); return mrb_obj_instance_eval(mrb, self); } }