4 static int check_class(type *tp) {
8 //printf("\n"); DDMT(tp);
10 for (i = 0; i < get_class_n_members(tp); i++) {
12 entity *mem = get_class_member(tp, i);
13 assert(mem && "NULL members not allowed");
14 //printf(" %d, %d", get_entity_n_overwrites(mem), get_class_n_supertypes(tp)); DDME(mem);
15 if (!mem) return error_null_mem;
16 assert(get_entity_n_overwrites(mem) <= get_class_n_supertypes(tp));
17 for (j = 0; j < get_entity_n_overwrites(mem); j++) {
18 entity *ovw = get_entity_overwrites(mem, j);
19 //printf(" overwrites: "); DDME(ovw);
20 /* Check whether ovw is member of one of tp's supertypes. If so,
21 the representation is correct. */
23 for (k = 0; k < get_class_n_supertypes(tp); k++) {
24 if (get_class_member_index(get_class_supertype(tp, k), ovw) >= 0) {
31 assert(found && "overwrites an entity not contained in direct supertype");
32 return error_ent_not_cont;
40 static int check_type(type *tp) {
41 switch (get_type_tpop_code(tp)) {
43 return check_class(tp);
50 static int check_entity(entity *ent) {
54 static void check_tore(type_or_ent *tore, void *env) {
57 *res = check_type((type *)tore);
59 assert(is_entity(tore));
60 *res = check_entity((entity *)tore);
68 type_walk(check_tore, NULL, &res);