Skip to content

Commit

Permalink
codegen.c: fix a bug in gen_values().
Browse files Browse the repository at this point in the history
- Fix limit handling that fails 15 arguments method calls.
- Fix too early argument packing in arrays.
  • Loading branch information
matz committed Feb 12, 2022
1 parent 0ed3fcf commit 38b164a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 38b164a

Please sign in to comment.