+
+ /* execute pre method */
+ if (pre)
+ pre(tore, env);
+
+ /* iterate */
+ switch (get_kind(tore.ent)) {
+ case k_entity:
+ cont.typ = get_entity_owner(ent);
+ do_type_walk(cont, pre, post, env);
+ cont.typ = get_entity_type(ent);
+ do_type_walk(cont, pre, post, env);
+
+ /* walk over the value types */
+ if (ent->initializer != NULL) {
+ walk_initializer(ent->initializer, pre, post, env);
+ } else if (entity_has_compound_ent_values(ent)) {
+ size_t i, n_mem = get_compound_ent_n_values(ent);
+ for (i = 0; i < n_mem; ++i) {
+ n = get_compound_ent_value(ent, i);
+ irn_type_walker(n, pre, post, env);
+ }
+ }
+ break;
+ case k_type:
+ switch (get_type_tpop_code(tp)) {
+ case tpo_class:
+ n_types = get_class_n_supertypes(tp);
+ for (i = 0; i < n_types; ++i) {
+ cont.typ = get_class_supertype(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ n_mem = get_class_n_members(tp);
+ for (i = 0; i < n_mem; ++i) {
+ cont.ent = get_class_member(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ n_types = get_class_n_subtypes(tp);
+ for (i = 0; i < n_types; ++i) {
+ cont.typ = get_class_subtype(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ break;
+
+ case tpo_struct:
+ n_mem = get_struct_n_members(tp);
+ for (i = 0; i < n_mem; ++i) {
+ cont.ent = get_struct_member(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ break;
+
+ case tpo_method:
+ n_mem = get_method_n_params(tp);
+ for (i = 0; i < n_mem; ++i) {
+ cont.typ = get_method_param_type(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ n_mem = get_method_n_ress(tp);
+ for (i = 0; i < n_mem; ++i) {
+ cont.typ = get_method_res_type(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ break;
+
+ case tpo_union:
+ n_mem = get_union_n_members(tp);
+ for (i = 0; i < n_mem; ++i) {
+ cont.ent = get_union_member(tp, i);
+ do_type_walk(cont, pre, post, env);
+ }
+ break;
+
+ case tpo_array:
+ cont.typ = get_array_element_type(tp);
+ do_type_walk(cont, pre, post, env);
+ cont.ent = get_array_element_entity(tp);
+ do_type_walk(cont, pre, post, env);
+ break;
+
+ case tpo_enumeration:
+ /* a leave */
+ break;
+
+ case tpo_pointer:
+ cont.typ = get_pointer_points_to_type(tp);
+ do_type_walk(cont, pre, post, env);
+ break;
+
+ case tpo_code:
+ case tpo_primitive:
+ case tpo_none:
+ case tpo_unknown:
+ /* a leave. */
+ break;
+ case tpo_uninitialized:
+ assert(0 && "Faulty type");
+ break;
+ }
+ break; /* end case k_type */
+
+ default:
+ printf(" *** Faulty type or entity! \n");
+ break;