recurd-type must be of symbol type

This commit is contained in:
Yuichi Nishiwaki 2017-04-09 17:34:56 +09:00
parent b62ec2ad9a
commit 3ac392628e
3 changed files with 6 additions and 8 deletions

View File

@ -401,10 +401,8 @@ gc_mark_object(pic_state *pic, struct object *obj)
break;
}
case PIC_TYPE_RECORD: {
gc_mark(pic, obj->u.rec.type);
if (obj_p(pic, obj->u.rec.datum)) {
LOOP(obj_ptr(pic, obj->u.rec.datum));
}
gc_mark(pic, obj->u.rec.datum);
LOOP(obj->u.rec.type);
break;
}
case PIC_TYPE_SYMBOL: {

View File

@ -77,7 +77,7 @@ struct data {
struct record {
OBJECT_HEADER
pic_value type;
struct symbol *type;
pic_value datum;
};

View File

@ -11,7 +11,7 @@ pic_make_record(pic_state *pic, pic_value type, pic_value datum)
struct record *rec;
rec = (struct record *)pic_obj_alloc(pic, sizeof(struct record), PIC_TYPE_RECORD);
rec->type = type;
rec->type = sym_ptr(pic, type);
rec->datum = datum;
return obj_value(pic, rec);
@ -20,7 +20,7 @@ pic_make_record(pic_state *pic, pic_value type, pic_value datum)
pic_value
pic_record_type(pic_state *pic, pic_value rec)
{
return rec_ptr(pic, rec)->type;
return obj_value(pic, rec_ptr(pic, rec)->type);
}
pic_value
@ -34,7 +34,7 @@ pic_rec_make_record(pic_state *pic)
{
pic_value type, datum;
pic_get_args(pic, "oo", &type, &datum);
pic_get_args(pic, "mo", &type, &datum);
return pic_make_record(pic, type, datum);
}