Revert "vm.c: add assertions instead of `mrb_ensure_hash_type()`."

This reverts commit 913a0a5a.
In some cases, `OP_HASHADD` operand may not be `Hash`. We should check
explicitly in those cases.
parent ab54ca27
...@@ -2687,7 +2687,7 @@ RETRY_TRY_BLOCK: ...@@ -2687,7 +2687,7 @@ RETRY_TRY_BLOCK:
int lim = a+b*2+1; int lim = a+b*2+1;
hash = regs[a]; hash = regs[a];
mrb_assert(mrb_type(hash) == MRB_TT_HASH); mrb_ensure_hash_type(mrb, hash);
for (i=a+1; i<lim; i+=2) { for (i=a+1; i<lim; i+=2) {
mrb_hash_set(mrb, hash, regs[i], regs[i+1]); mrb_hash_set(mrb, hash, regs[i], regs[i+1]);
} }
...@@ -2697,7 +2697,7 @@ RETRY_TRY_BLOCK: ...@@ -2697,7 +2697,7 @@ RETRY_TRY_BLOCK:
CASE(OP_HASHCAT, B) { CASE(OP_HASHCAT, B) {
mrb_value hash = regs[a]; mrb_value hash = regs[a];
mrb_assert(mrb_type(hash) == MRB_TT_HASH); mrb_ensure_hash_type(mrb, hash);
mrb_hash_merge(mrb, hash, regs[a+1]); mrb_hash_merge(mrb, hash, regs[a+1]);
mrb_gc_arena_restore(mrb, ai); mrb_gc_arena_restore(mrb, ai);
NEXT; NEXT;
......
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