{
item->type = calloc(1, sizeof(Type));
item->type->form = FORM_RECORD;
- Symbol head = {0};
- int nfields = 0;
+
+// long offset = 0;
+ Field **field = &(item->type->fields);
while (peek(p)->type != END)
{
+ int nfields = 0;
+ Field* first = NULL;
do
{
char* name = expect_text(p, IDENT);
bool export = accept(p, '*');
- (void)symbol_addfield(p, &head, name, SYM_FIELD, export);
+ *field = calloc(1, sizeof(Field));
+ (*field)->name = name;
+ (*field)->export = export;
+ field = &((*field)->next);
+ if (!first)
+ {
+ first = *field;
+ }
nfields++;
}
while (accept(p, ','));
type(p, &field_type);
/* apply the type to the newly created symbols */
- Symbol* field = head.desc;
for (int i = 0; i < nfields; i++)
{
- field->type = field_type.type;
- field = field->next;
+ first->type = field_type.type;
+ first = first->next;
}
- item->type->fields = head.desc;
}
expect(p, END);