Use helper functions for type checks

They hide the evil details of aliased types. More to come :/
This commit is contained in:
Bill Currie 2020-02-19 20:52:27 +09:00
parent 9610788dea
commit 6bcc2c49ab

View file

@ -307,10 +307,9 @@ init_elements (struct def_s *def, expr_t *eles)
elements[i].offset = base_offset + i * type_size (array_type); elements[i].offset = base_offset + i * type_size (array_type);
} }
num_elements = i; num_elements = i;
} else if (is_struct (def->type) } else if (is_struct (def->type) || is_vector (def->type)
|| def->type == &type_vector || is_quaternion (def->type)) {
|| def->type == &type_quaternion) { symtab_t *symtab = unalias_type (def->type)->t.symtab;
symtab_t *symtab = def->type->t.symtab;
symbol_t *field; symbol_t *field;
for (i = 0, field = symtab->symbols; field; field = field->next) { for (i = 0, field = symtab->symbols; field; field = field->next) {