assert(get_entity_offset(get_class_member(tp, i)) > -1);
assert(is_method_type(get_entity_type(get_class_member(tp, i))) ||
(get_entity_allocation(get_class_member(tp, i)) == automatic_allocated));
- /* @@@ lowerfirm geht nicht durch */
}
} break;
case tpo_struct:
assert(tp->visit < type_visited);
tp->visit = type_visited;
}
+/* @@@ name clash with master flag
+bool type_visited(type *tp) {
+ assert(tp && tp->kind == k_type);
+ return tp->visit >= type_visited;
+ }*/
+bool type_not_visited(type *tp) {
+ assert(tp && tp->kind == k_type);
+ return tp->visit < type_visited;
+}
+
int is_type (void *thing) {
assert(thing);
}
} break;
case tpo_method: {
+ if (get_method_variadicity(typ1) != get_method_variadicity(typ2)) return false;
if (get_method_n_params(typ1) != get_method_n_params(typ2)) return false;
if (get_method_n_ress(typ1) != get_method_n_ress(typ2)) return false;
for (i = 0; i < get_method_n_params(typ1); i++) {
}
} break;
case tpo_array: {
- type *set, *let; /* small/large elt. type */
if (get_array_n_dimensions(typ1) != get_array_n_dimensions(typ2))
return false;
if (!equal_type(get_array_element_type(typ1), get_array_element_type(typ2)))
}
} break;
case tpo_method: {
+ if (get_method_variadicity(st) != get_method_variadicity(lt)) return false;
if (get_method_n_params(st) != get_method_n_params(lt)) return false;
if (get_method_n_ress(st) != get_method_n_ress(lt)) return false;
for (i = 0; i < get_method_n_params(st); i++) {
assert(clss && (clss->type_op == type_class));
return (ARR_LEN (clss->attr.ca.members))-1;
}
+int get_class_member_index(type *clss, entity *mem) {
+ int i;
+ assert(clss && (clss->type_op == type_class));
+ for (i = 0; i < get_class_n_members(clss); i++)
+ if (get_class_member(clss, i) == mem)
+ return i;
+ return -1;
+}
entity *get_class_member (type *clss, int pos) {
assert(clss && (clss->type_op == type_class));
assert(pos >= 0 && pos < get_class_n_members(clss));
assert(clss && (clss->type_op == type_class));
return (ARR_LEN (clss->attr.ca.supertypes))-1;
}
+int get_class_supertype_index(type *clss, type *super_clss) {
+ int i;
+ assert(clss && (clss->type_op == type_class));
+ assert(super_clss && (super_clss->type_op == type_class));
+ for (i = 0; i < get_class_n_supertypes(clss); i++)
+ if (get_class_supertype(clss, i) == super_clss)
+ return i;
+ return -1;
+}
type *get_class_supertype (type *clss, int pos) {
assert(clss && (clss->type_op == type_class));
assert(pos >= 0 && pos < get_class_n_supertypes(clss));
res->attr.ma.param_type = (type **) xmalloc (sizeof (type *) * n_param);
res->attr.ma.n_res = n_res;
res->attr.ma.res_type = (type **) xmalloc (sizeof (type *) * n_res);
+ res->attr.ma.variadicity = non_variadic;
return res;
}
type *new_d_type_method (ident *name, int n_param, int n_res, dbg_info* db) {
method->attr.ma.res_type[pos] = tp;
}
+variadicity get_method_variadicity(type *method)
+{
+ assert(method && (method->type_op == type_method));
+ return method->attr.ma.variadicity;
+}
+
+void set_method_variadicity(type *method, variadicity vari)
+{
+ assert(method && (method->type_op == type_method));
+ method->attr.ma.variadicity = vari;
+}
+
/* typecheck */
bool is_method_type (type *method) {
assert(method);