Permalink
Browse files

wrong stack position for headless case; close #675

  • Loading branch information...
1 parent be122b7 commit 9d56acb7092928d4c8c84e7af80eb3be8aaa2e4e @matz matz committed Dec 28, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/codegen.c
View
@@ -1205,6 +1205,7 @@ codegen(codegen_scope *s, node *tree, int val)
pop();
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern(s->mrb, "===")), 1));
}
+ pop();
tmp = new_label(s);
genop(s, MKOP_AsBx(OP_JMPIF, cursp(), pos2));
pos2 = tmp;
@@ -1215,19 +1216,18 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch_linked(s, pos2);
}
- pop(); /* pop HEAD */
codegen(s, tree->car->cdr, val);
if (val) pop();
tmp = new_label(s);
genop(s, MKOP_sBx(OP_JMP, pos3));
pos3 = tmp;
if (pos1) dispatch(s, pos1);
tree = tree->cdr;
- push(); /* push HEAD */
}
- pop(); /* pop HEAD */
- genop(s, MKOP_A(OP_LOADNIL, cursp()));
- if (val) push();
+ if (val) {
+ genop(s, MKOP_A(OP_LOADNIL, cursp()));
+ push();
+ }
if (pos3) dispatch_linked(s, pos3);
}
break;

0 comments on commit 9d56acb

Please sign in to comment.