Make break in lambdas work as return according to CRuby behavior.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-06-02 14:22:18 +09:00
parent 7f417ade42
commit ab85d3c814
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -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;
+2
View File
@@ -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;