type check before pool scan

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-11-07 09:14:44 +09:00
parent b6a73f99bf
commit cba07b0275
+2
View File
@@ -414,12 +414,14 @@ new_lit(codegen_scope *s, mrb_value val)
case MRB_TT_FLOAT:
for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i];
if (pv->type != MRB_TT_FLOAT) continue;
if (pv->value.f == mrb_float(val)) return i;
}
break;
case MRB_TT_FIXNUM:
for (i=0; i<s->irep->plen; i++) {
pv = &s->irep->pool[i];
if (pv->type != MRB_TT_FIXNUM) continue;
if (pv->value.i == mrb_fixnum(val)) return i;
}
break;