block_given? should return correct value when called in blocks; close #2678

avoid a loop to find parent's callinfo using mrb->c->cibase[env->cioff]
parent 5014bfb5
......@@ -192,12 +192,8 @@ mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
/* top-level does not have block slot (alway false) */
if (sp == mrb->c->stbase)
return mrb_false_value();
while (mrb->c->cibase < ci) {
if (ci->stackent == sp) {
break;
}
ci--;
}
ci = mrb->c->cibase + ci->proc->env->cioff;
bp = ci[1].stackent + 1;
}
if (ci->argc > 0) {
bp += ci->argc;
......
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