recurd-type must be of symbol type
This commit is contained in:
parent
b62ec2ad9a
commit
3ac392628e
6
lib/gc.c
6
lib/gc.c
|
@ -401,10 +401,8 @@ gc_mark_object(pic_state *pic, struct object *obj)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PIC_TYPE_RECORD: {
|
case PIC_TYPE_RECORD: {
|
||||||
gc_mark(pic, obj->u.rec.type);
|
gc_mark(pic, obj->u.rec.datum);
|
||||||
if (obj_p(pic, obj->u.rec.datum)) {
|
LOOP(obj->u.rec.type);
|
||||||
LOOP(obj_ptr(pic, obj->u.rec.datum));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PIC_TYPE_SYMBOL: {
|
case PIC_TYPE_SYMBOL: {
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct data {
|
||||||
|
|
||||||
struct record {
|
struct record {
|
||||||
OBJECT_HEADER
|
OBJECT_HEADER
|
||||||
pic_value type;
|
struct symbol *type;
|
||||||
pic_value datum;
|
pic_value datum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ pic_make_record(pic_state *pic, pic_value type, pic_value datum)
|
||||||
struct record *rec;
|
struct record *rec;
|
||||||
|
|
||||||
rec = (struct record *)pic_obj_alloc(pic, sizeof(struct record), PIC_TYPE_RECORD);
|
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;
|
rec->datum = datum;
|
||||||
|
|
||||||
return obj_value(pic, rec);
|
return obj_value(pic, rec);
|
||||||
|
@ -20,7 +20,7 @@ pic_make_record(pic_state *pic, pic_value type, pic_value datum)
|
||||||
pic_value
|
pic_value
|
||||||
pic_record_type(pic_state *pic, pic_value rec)
|
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
|
pic_value
|
||||||
|
@ -34,7 +34,7 @@ pic_rec_make_record(pic_state *pic)
|
||||||
{
|
{
|
||||||
pic_value type, datum;
|
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);
|
return pic_make_record(pic, type, datum);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue