mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Make break in lambdas work as return according to CRuby behavior.
This commit is contained in:
+1
-1
@@ -168,7 +168,7 @@ static mrb_value
|
||||
packed_backtrace(mrb_state *mrb)
|
||||
{
|
||||
struct RData *backtrace;
|
||||
mrb_int ciidx = mrb->c->ci - mrb->c->cibase;
|
||||
ptrdiff_t ciidx = mrb->c->ci - mrb->c->cibase;
|
||||
mrb_int len = (ciidx+1)*sizeof(struct backtrace_location);
|
||||
void *ptr;
|
||||
|
||||
|
||||
@@ -1841,6 +1841,7 @@ RETRY_TRY_BLOCK:
|
||||
break;
|
||||
}
|
||||
case OP_R_NORMAL:
|
||||
NORMAL_RETURN:
|
||||
if (ci == mrb->c->cibase) {
|
||||
if (!mrb->c->prev) { /* toplevel return */
|
||||
localjump_error(mrb, LOCALJUMP_ERROR_RETURN);
|
||||
@@ -1862,6 +1863,7 @@ RETRY_TRY_BLOCK:
|
||||
ci = mrb->c->ci;
|
||||
break;
|
||||
case OP_R_BREAK:
|
||||
if (MRB_PROC_STRICT_P(proc)) goto NORMAL_RETURN;
|
||||
if (!proc->env || !MRB_ENV_STACK_SHARED_P(proc->env)) {
|
||||
mrb_value exc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user