codegen.c: fix a bug in `gen_values()`.

- Fix limit handling that fails 15 arguments method calls.
- Fix too early argument packing in arrays.
parent 0ed3fcfa
......@@ -1551,7 +1551,7 @@ gen_values(codegen_scope *s, node *t, int val, int limit)
while (t) {
int is_splat = nint(t->car->car) == NODE_SPLAT;
if (is_splat || n > limit || cursp() >= slimit) { /* flush stack */
if (is_splat || cursp() >= slimit) { /* flush stack */
pop_n(n);
if (first) {
if (n == 0) {
......@@ -1590,6 +1590,11 @@ gen_values(codegen_scope *s, node *t, int val, int limit)
}
return -1; /* variable length */
}
else if (n > limit) {
pop_n(n);
genop_2(s, OP_ARRAY, cursp(), n);
return -1;
}
return n;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment