mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: fix a bug in gen_values().
- Fix limit handling that fails 15 arguments method calls. - Fix too early argument packing in arrays.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user