diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/array.c | 2 | ||||
| -rw-r--r-- | src/vm.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/array.c b/src/array.c index 285e48a0f..43d2b824f 100644 --- a/src/array.c +++ b/src/array.c @@ -256,7 +256,6 @@ mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len) ary_modify(mrb, a); old_len = RARRAY_LEN(ary); if (old_len != new_len) { - ARY_SET_LEN(a, new_len); if (new_len < old_len) { ary_shrink_capa(mrb, a); } @@ -264,6 +263,7 @@ mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len) ary_expand_capa(mrb, a, new_len); ary_fill_with_nil(ARY_PTR(a) + old_len, new_len - old_len); } + ARY_SET_LEN(a, new_len); } return ary; @@ -516,7 +516,7 @@ mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) } ci->nregs = p->body.irep->nregs; if (ci->argc < 0) keep = 3; - else keep = ci->argc + 1; + else keep = ci->argc + 2; if (ci->nregs < keep) { stack_extend(mrb, keep); } @@ -1662,6 +1662,9 @@ RETRY_TRY_BLOCK: if (MRB_METHOD_CFUNC_P(m)) { mrb_value v; ci->nregs = (argc < 0) ? 3 : n+2; + if (MRB_METHOD_PROC_P(m)) { + ci->proc = MRB_METHOD_PROC(m); + } v = MRB_METHOD_CFUNC(m)(mrb, recv); mrb_gc_arena_restore(mrb, ai); if (mrb->exc) goto L_RAISE; |
