Skip to content

Commit

Permalink
fixed a bug when number of LHS and RHS differs; fix #3239
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Nov 10, 2016
1 parent 872517d commit 3f002b6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1655,11 +1655,21 @@ codegen(codegen_scope *s, node *tree, int val)
}
tree = tree->car;
if (tree->car) { /* pre */
int first = TRUE;
t = tree->car;
n = 0;
while (t) {
gen_assignment(s, t->car, rhs+n, NOVAL);
n++;
if (n < len) {
gen_assignment(s, t->car, rhs+n, NOVAL);
n++;
}
else {
if (first) {
genop(s, MKOP_A(OP_LOADNIL, rhs+n));
first = FALSE;
}
gen_assignment(s, t->car, rhs+n, NOVAL);
}
t = t->cdr;
}
}
Expand Down

0 comments on commit 3f002b6

Please sign in to comment.