move no block check to mrb_yield_internal

parent c3b79e11
......@@ -507,9 +507,6 @@ mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
if (mrb_get_args(mrb, "|S&", &a, &b) == 1) {
mrb_raise(mrb, E_NOTIMP_ERROR, "instance_eval with string not implemented");
}
if (mrb_nil_p(b)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
}
switch (mrb_type(self)) {
case MRB_TT_SYMBOL:
case MRB_TT_FIXNUM:
......
......@@ -392,6 +392,9 @@ mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_v
int n = mrb->ci->nregs;
mrb_value val;
if (mrb_nil_p(b)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
}
p = mrb_proc_ptr(b);
ci = cipush(mrb);
ci->mid = mid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment