vm.c: need to adjust argument after packing keyword args; fix #5632

It was caused by #5628.
parent 7e7f1b2f
...@@ -1729,6 +1729,7 @@ RETRY_TRY_BLOCK: ...@@ -1729,6 +1729,7 @@ RETRY_TRY_BLOCK:
} }
mrb_assert(bidx < irep->nregs); mrb_assert(bidx < irep->nregs);
blk = regs[bidx];
uint8_t nk = (b >> 4) & 0x0f; uint8_t nk = (b >> 4) & 0x0f;
if (nk > 0 && nk < CALL_MAXARGS) { /* pack keyword arguments */ if (nk > 0 && nk < CALL_MAXARGS) { /* pack keyword arguments */
uint8_t n = b & 0x0f; uint8_t n = b & 0x0f;
...@@ -1737,6 +1738,8 @@ RETRY_TRY_BLOCK: ...@@ -1737,6 +1738,8 @@ RETRY_TRY_BLOCK:
regs[kidx] = kdict; regs[kidx] = kdict;
nk = 15; nk = 15;
b = n | (nk<<4); b = n | (nk<<4);
bidx = kidx + 1;
regs[bidx] = blk;
} }
if (mid == 0 || !target_class) { if (mid == 0 || !target_class) {
...@@ -1761,7 +1764,6 @@ RETRY_TRY_BLOCK: ...@@ -1761,7 +1764,6 @@ RETRY_TRY_BLOCK:
mrb_exc_set(mrb, exc); mrb_exc_set(mrb, exc);
goto L_RAISE; goto L_RAISE;
} }
blk = regs[bidx];
if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) { if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) {
blk = mrb_type_convert(mrb, blk, MRB_TT_PROC, MRB_SYM(to_proc)); blk = mrb_type_convert(mrb, blk, MRB_TT_PROC, MRB_SYM(to_proc));
/* The stack or ci stack might have been reallocated during /* The stack or ci stack might have been reallocated during
......
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