should be able to create hash with 127+ entries; close #1894

parent c2d8b030
......@@ -1501,16 +1501,32 @@ codegen(codegen_scope *s, node *tree, int val)
case NODE_HASH:
{
int len = 0;
mrb_bool update = FALSE;
while (tree) {
codegen(s, tree->car->car, val);
codegen(s, tree->car->cdr, val);
len++;
tree = tree->cdr;
if (val && len == 126) {
pop_n(len*2);
genop(s, MKOP_ABC(OP_HASH, cursp(), cursp(), len));
if (update) {
pop();
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "merge")), 1));
}
push();
update = TRUE;
len = 0;
}
}
if (val) {
pop_n(len*2);
genop(s, MKOP_ABC(OP_HASH, cursp(), cursp(), len));
if (update) {
pop();
genop(s, MKOP_ABC(OP_SEND, cursp(), new_msym(s, mrb_intern_lit(s->mrb, "merge")), 1));
}
push();
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment