diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-13 10:03:34 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-13 10:03:34 +0900 |
| commit | 09eae5ceb2e9e7e509864091e2400af4ca3bfce1 (patch) | |
| tree | fb21bfd6ce9af97b6765f3ceb244df3e00b5bbda | |
| parent | c3b79e11f37ce757bfd4d3715fb4ce3d31aa571d (diff) | |
| download | mruby-09eae5ceb2e9e7e509864091e2400af4ca3bfce1.tar.gz mruby-09eae5ceb2e9e7e509864091e2400af4ca3bfce1.zip | |
move no block check to mrb_yield_internal
| -rw-r--r-- | src/kernel.c | 3 | ||||
| -rw-r--r-- | src/vm.c | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/kernel.c b/src/kernel.c index e578918af..54c90dfc0 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -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; |
