Skip to content

Commit

Permalink
codegen.c: generate OP_HASH in gen_hash() if limit exceeds.
Browse files Browse the repository at this point in the history
That means when `limit` is `0` it should always generate a hash.
  • Loading branch information
matz committed Feb 8, 2022
1 parent 6f5e74f commit 4c13188
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -1643,6 +1643,12 @@ gen_hash(codegen_scope *s, node *tree, int val, int limit)
len = 0;
}
}
if (val && len > limit) {
pop_n(len*2);
genop_2(s, OP_HASH, cursp(), len);
push();
return -1;
}
if (update) {
if (val && len > 0) {
pop_n(len*2+1);
Expand Down

0 comments on commit 4c13188

Please sign in to comment.