Skip to content

Commit

Permalink
redo should work well in for statement; fix #3275
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Nov 24, 2016
1 parent 0c924b9 commit 22f7325
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,6 @@ for_body(codegen_scope *s, node *tree)

push(); /* push for a block parameter */

lp = loop_push(s, LOOP_FOR);
lp->pc1 = new_label(s);

/* generate loop variable */
n2 = tree->car;
genop(s, MKOP_Ax(OP_ENTER, 0x40000));
Expand All @@ -600,6 +597,11 @@ for_body(codegen_scope *s, node *tree)
else {
gen_vmassignment(s, n2, 1, VAL);
}
/* construct loop */
lp = loop_push(s, LOOP_FOR);
lp->pc2 = new_label(s);

/* loop body */
codegen(s, tree->cdr->cdr->car, VAL);
pop();
if (s->pc > 0) {
Expand Down

0 comments on commit 22f7325

Please sign in to comment.