Skip to content

Commit

Permalink
Changed evaluation order of yield; ref #3613
Browse files Browse the repository at this point in the history
So that `yield expr_with_error` will cause the error from the
argument rather than `LocalJumpError` when no block is given.
  • Loading branch information
matz committed Apr 18, 2017
1 parent f6c70bc commit f4119f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,6 @@ codegen(codegen_scope *s, node *tree, int val)
if (!s2) break;
}
if (s2) ainfo = s2->ainfo;
genop(s, MKOP_ABx(OP_BLKPUSH, cursp(), (ainfo<<4)|(lv & 0xf)));
push();
if (tree) {
n = gen_values(s, tree, VAL, 0);
Expand All @@ -2027,6 +2026,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
}
pop_n(n+1);
genop(s, MKOP_ABx(OP_BLKPUSH, cursp(), (ainfo<<4)|(lv & 0xf)));
if (sendv) n = CALL_MAXARGS;
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "call")), n));
if (val) push();
Expand Down

0 comments on commit f4119f5

Please sign in to comment.