Skip to content

Commit

Permalink
jump address error when value taken from if statement without else cl…
Browse files Browse the repository at this point in the history
…ause; close #712
  • Loading branch information
matz committed Jan 9, 2013
1 parent eab894e commit f134e8e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/codegen.c
Expand Up @@ -1106,18 +1106,24 @@ codegen(codegen_scope *s, node *tree, int val)
if (e) {
if (val) pop();
pos2 = new_label(s);
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch(s, pos1);
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch(s, pos1);
codegen(s, e, val);
dispatch(s, pos2);
}
else {
if (val) {
pop();
pos2 = new_label(s);
genop(s, MKOP_sBx(OP_JMP, 0));
dispatch(s, pos1);
genop(s, MKOP_A(OP_LOADNIL, cursp()));
dispatch(s, pos2);
push();
}
dispatch(s, pos1);
else {
dispatch(s, pos1);
}
}
}
break;
Expand Down

1 comment on commit f134e8e

@mattn
Copy link
Contributor

@mattn mattn commented on f134e8e Jan 10, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to be broken indentation...

Please sign in to comment.