fixed a bug when number of LHS and RHS differs; fix #3239

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-11 04:37:42 +09:00
parent 872517dff3
commit 3f002b6993
+12 -2
View File
@@ -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;
}
}