Skip to content

Commit

Permalink
codegen.c: stack position may be wrong on assignments.
Browse files Browse the repository at this point in the history
When `[]=` access includes keyword arguments.
  • Loading branch information
matz committed Feb 8, 2022
1 parent 4c13188 commit 0849a28
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -1865,15 +1865,21 @@ gen_assignment(codegen_scope *s, node *tree, node *rhs, int sp, int val)
}
}
if (tree->cdr->car) { /* keyword arguments */
if (n == 14) {
pop_n(n);
genop_2(s, OP_ARRAY, cursp(), n);
push();
n = 15;
}
gen_hash(s, tree->cdr->car->cdr, VAL, 0);
if (n < 14) {
n++;
push();
}
else {
pop();
pop_n(2);
genop_2(s, OP_ARYPUSH, cursp(), 1);
}
push();
}
}
if (rhs) {
Expand Down

0 comments on commit 0849a28

Please sign in to comment.