Skip to content

Commit

Permalink
codegen.c: fixed a bug in hash code generation with !val.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 3, 2022
1 parent 8d06e79 commit ae3c997
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -1603,7 +1603,7 @@ gen_hash(codegen_scope *s, node *tree, int val, int limit)

while (tree) {
if (nint(tree->car->car->car) == NODE_KW_REST_ARGS) {
if (len > 0) {
if (val && len > 0) {
pop_n(len*2);
if (!update) {
genop_2(s, OP_HASH, cursp(), len);
Expand All @@ -1615,7 +1615,7 @@ gen_hash(codegen_scope *s, node *tree, int val, int limit)
push();
}
codegen(s, tree->car->cdr, val);
if (len > 0 || update) {
if (val && (len > 0 || update)) {
pop(); pop();
genop_1(s, OP_HASHCAT, cursp());
push();
Expand Down

0 comments on commit ae3c997

Please sign in to comment.