Skip to content

Commit 38b164a

Browse files
committed
codegen.c: fix a bug in gen_values().
- Fix limit handling that fails 15 arguments method calls. - Fix too early argument packing in arrays.
1 parent 0ed3fcf commit 38b164a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: mrbgems/mruby-compiler/core/codegen.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ gen_values(codegen_scope *s, node *t, int val, int limit)
15511551
while (t) {
15521552
int is_splat = nint(t->car->car) == NODE_SPLAT;
15531553

1554-
if (is_splat || n > limit || cursp() >= slimit) { /* flush stack */
1554+
if (is_splat || cursp() >= slimit) { /* flush stack */
15551555
pop_n(n);
15561556
if (first) {
15571557
if (n == 0) {
@@ -1590,6 +1590,11 @@ gen_values(codegen_scope *s, node *t, int val, int limit)
15901590
}
15911591
return -1; /* variable length */
15921592
}
1593+
else if (n > limit) {
1594+
pop_n(n);
1595+
genop_2(s, OP_ARRAY, cursp(), n);
1596+
return -1;
1597+
}
15931598
return n;
15941599
}
15951600

0 commit comments

Comments
 (0)