}
} 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_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++) {
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);
type *get_method_res_type(type *method, int pos);
void set_method_res_type(type *method, int pos, type* tp);
+/*
+ * this enum flags the variadicity of methods (methods with a
+ * variable amount of arguments (e.g. C's printf). Default is
+ * non_variadic.
+ */
+typedef enum variadicity {
+ non_variadic,
+ variadic
+} variadicity;
+
+variadicity get_method_variadicity(type *method);
+void set_method_variadicity(type *method, variadicity vari);
+
/* typecheck */
bool is_method_type (type *method);