type check before pool scan

parent b6a73f99
...@@ -414,12 +414,14 @@ new_lit(codegen_scope *s, mrb_value val) ...@@ -414,12 +414,14 @@ new_lit(codegen_scope *s, mrb_value val)
case MRB_TT_FLOAT: case MRB_TT_FLOAT:
for (i=0; i<s->irep->plen; i++) { for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i]; pv = &s->irep->pool[i];
if (pv->type != MRB_TT_FLOAT) continue;
if (pv->value.f == mrb_float(val)) return i; if (pv->value.f == mrb_float(val)) return i;
} }
break; break;
case MRB_TT_FIXNUM: case MRB_TT_FIXNUM:
for (i=0; i<s->irep->plen; i++) { for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i]; pv = &s->irep->pool[i];
if (pv->type != MRB_TT_FIXNUM) continue;
if (pv->value.i == mrb_fixnum(val)) return i; if (pv->value.i == mrb_fixnum(val)) return i;
} }
break; break;
......
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