Skip to content

Commit

Permalink
type check before pool scan
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Nov 7, 2013
1 parent b6a73f9 commit cba07b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/codegen.c
Expand Up @@ -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;
Expand Down

0 comments on commit cba07b0

Please sign in to comment.