mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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]
This commit is contained in:
+2
-6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user