diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-24 01:09:36 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-24 01:09:36 +0900 |
| commit | ad9e841c5359efdd37a132767e03ad7a2d5ae72e (patch) | |
| tree | 8e60edf2dce29e86d8b47d0b2e8dc8a2a2329ded /src/vm.c | |
| parent | 4f012f578f22cca67af8c633845464abc79913f4 (diff) | |
| download | mruby-ad9e841c5359efdd37a132767e03ad7a2d5ae72e.tar.gz mruby-ad9e841c5359efdd37a132767e03ad7a2d5ae72e.zip | |
made mrb_get_args() better (optinal args, type checks); close #173 #176
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -160,7 +160,7 @@ ecall(mrb_state *mrb, int i) } mrb_value -mrb_funcall_with_block(mrb_state *mrb, mrb_value self, const char *name, int argc, mrb_value *argv, struct RProc *blk) +mrb_funcall_with_block(mrb_state *mrb, mrb_value self, const char *name, int argc, mrb_value *argv, mrb_value blk) { struct RProc *p; struct RClass *c; @@ -197,12 +197,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, const char *name, int arg else if (argc > 0) { memcpy(mrb->stack+1, argv, sizeof(mrb_value)*argc); } - if (!blk) { - mrb->stack[argc+1] = mrb_nil_value(); - } - else { - mrb->stack[argc+1] = mrb_obj_value(blk); - } + mrb->stack[argc+1] = blk; if (MRB_PROC_CFUNC_P(p)) { val = p->body.func(mrb, self); @@ -218,7 +213,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, const char *name, int arg mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value self, const char *name, int argc, mrb_value *argv) { - return mrb_funcall_with_block(mrb, self, name, argc, argv, 0); + return mrb_funcall_with_block(mrb, self, name, argc, argv, mrb_nil_value()); } mrb_value |
