Changed evaluation order of `yield`; ref #3613

So that `yield expr_with_error` will cause the error from the
argument rather than `LocalJumpError` when no block is given.
parent f6c70bc6
...@@ -2017,7 +2017,6 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2017,7 +2017,6 @@ codegen(codegen_scope *s, node *tree, int val)
if (!s2) break; if (!s2) break;
} }
if (s2) ainfo = s2->ainfo; if (s2) ainfo = s2->ainfo;
genop(s, MKOP_ABx(OP_BLKPUSH, cursp(), (ainfo<<4)|(lv & 0xf)));
push(); push();
if (tree) { if (tree) {
n = gen_values(s, tree, VAL, 0); n = gen_values(s, tree, VAL, 0);
...@@ -2027,6 +2026,7 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2027,6 +2026,7 @@ codegen(codegen_scope *s, node *tree, int val)
} }
} }
pop_n(n+1); pop_n(n+1);
genop(s, MKOP_ABx(OP_BLKPUSH, cursp(), (ainfo<<4)|(lv & 0xf)));
if (sendv) n = CALL_MAXARGS; if (sendv) n = CALL_MAXARGS;
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "call")), n)); genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "call")), n));
if (val) push(); if (val) push();
......
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