move no block check to mrb_yield_internal

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-04-13 10:03:34 +09:00
parent c3b79e11f3
commit 09eae5ceb2
2 changed files with 3 additions and 3 deletions
-3
View File
@@ -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:
+3
View File
@@ -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;