+/*
+ * Returns the first variadic parameter index of a type.
+ * If this index was NOT set, the index of the last parameter
+ * of the method type plus one is returned for variadic functions.
+ * Non-variadic function types always return -1 here.
+ */
+int get_method_first_variadic_param_index(type *method)
+{
+ assert(method && (method->type_op == type_method));
+
+ if (method->attr.ma.variadicity == variadicity_non_variadic)
+ return -1;
+
+ if (method->attr.ma.first_variadic_param == -1)
+ return get_method_n_params(method);
+ return method->attr.ma.first_variadic_param;
+}
+
+/*
+ * Sets the first variadic parameter index. This allows to specify
+ * a complete call type (containing the type of all parameters)
+ * but still have the knowledge, which parameter must be passed as
+ * variadic one.
+ */
+void set_method_first_variadic_param_index(type *method, int index)
+{
+ assert(method && (method->type_op == type_method));
+ assert(index >= 0 && index <= get_method_n_params(method));
+
+ method->attr.ma.first_variadic_param = index;
+}
+