Decode field slot when we get around to declaring it rather than early as the names aren't resolved yet

This commit is contained in:
James McKaskill 2013-09-12 14:17:57 -04:00
parent 316f470c3b
commit cada8df6c2

View file

@ -375,13 +375,8 @@ static void decode_field(struct field *fields, Field_list l, int i) {
exit(3); exit(3);
} }
switch (f.f.which) { if (f.f.which == Field_group) {
case Field_slot:
decode_value(&f.v, f.f.slot.type, f.f.slot.defaultValue, NULL);
break;
case Field_group:
f.group = find_node(f.f.group.typeId); f.group = find_node(f.f.group.typeId);
break;
} }
memcpy(&fields[f.f.codeOrder], &f, sizeof(f)); memcpy(&fields[f.f.codeOrder], &f, sizeof(f));
@ -806,6 +801,10 @@ static void define_group(struct strings *s, struct node *n, const char *group_na
str_addf(&s->var, "%s.", group_name); str_addf(&s->var, "%s.", group_name);
} }
for (f = n->fields; f < n->fields + flen; f++) {
decode_value(&f->v, f->f.slot.type, f->f.slot.defaultValue, NULL);
}
/* fields before the union members */ /* fields before the union members */
for (f = n->fields; f < n->fields + flen && !in_union(f); f++) { for (f = n->fields; f < n->fields + flen && !in_union(f); f++) {
define_field(s, f); define_field(s, f);