Skip to content

Commit

Permalink
OP_RETRUN to take B as matching exception; ref #3487
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 11, 2017
1 parent 4ab7029 commit 000c68d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/mruby/opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ enum {
OP_JMPIF,/* A sBx if R(A) pc+=sBx */
OP_JMPNOT,/* A sBx if !R(A) pc+=sBx */
OP_ONERR,/* sBx rescue_push(pc+sBx) */
OP_RESCUE,/* A clear(exc); R(A) := exception (ignore when A=0) */
OP_RESCUE,/* A B R(A) := exc; R(B) := matched (ignore if A/B=0) */
OP_POPERR,/* A A.times{rescue_pop()} */
OP_RAISE,/* A raise(R(A)) */
OP_EPUSH,/* Bx ensure_push(SEQ[Bx]) */
Expand Down
4 changes: 2 additions & 2 deletions mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ codegen(codegen_scope *s, node *tree, int val)
node *n2 = tree->car;
int exc = cursp();

genop(s, MKOP_A(OP_RESCUE, exc));
genop(s, MKOP_AB(OP_RESCUE, exc, 0));
push();
while (n2) {
node *n3 = n2->car;
Expand Down Expand Up @@ -1788,7 +1788,7 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_A(OP_POPERR, 1));
noexc = genop(s, MKOP_Bx(OP_JMP, 0));
dispatch(s, onerr);
genop(s, MKOP_A(OP_RESCUE, exc));
genop(s, MKOP_AB(OP_RESCUE, exc, 0));
genop(s, MKOP_A(OP_LOADF, exc));
dispatch(s, noexc);
loop_pop(s, NOVAL);
Expand Down

0 comments on commit 000c68d

Please sign in to comment.