Permalink
Browse files

Fixed a bug in OP_SUPER block conversion; fix #3590

  • Loading branch information...
matz committed Apr 5, 2017
1 parent bd7bf26 commit d9fb8b69b0621e8cd2c7c43fd8511a83718d7e45
Showing with 22 additions and 21 deletions.
  1. +22 −21 src/vm.c
View
@@ -1375,6 +1375,8 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
mrb_sym mid = ci->mid;
int a = GETARG_A(i);
int n = GETARG_C(i);
mrb_value blk;
int bidx;
if (mid == 0 || !ci->target_class) {
mrb_value exc;
@@ -1414,34 +1416,33 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
}
}
if (n == CALL_MAXARGS) {
bidx = a+2;
}
else {
bidx = a+n+1;
}
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1, ci->nregs);
ci->nregs = bidx+1;
}
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
/* push callinfo */
ci = cipush(mrb);
ci->mid = mid;
ci->proc = m;
ci->stackent = mrb->c->stack;
ci->target_class = c;
ci->pc = pc + 1;
{
int bidx;
mrb_value blk;
if (n == CALL_MAXARGS) {
ci->argc = -1;
bidx = a+2;
}
else {
ci->argc = n;
bidx = a+n+1;
}
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1, ci->nregs);
ci->nregs = bidx+1;
}
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
ci = mrb->c->ci;
}
if (n == CALL_MAXARGS) {
ci->argc = -1;
}
else {
ci->argc = n;
}
/* prepare stack */

0 comments on commit d9fb8b6

Please sign in to comment.