}
public override string? get_custom_creturn_type (Method m) {
- var attr = m.get_attribute ("CCode");
- if (attr != null) {
- string type = attr.get_string ("type");
- if (type != null) {
- return type;
- }
- }
- return null;
+ return m.custom_return_type_cname;
}
string get_creturn_type (Method m, string default_value) {
ccode_params.append_printf ("%ssentinel = \"%s\"", separator, m.sentinel);
separator = ", ";
}
+ if (m.custom_return_type_cname != null) {
+ ccode_params.append_printf ("%stype = \"%s\"", separator, m.custom_return_type_cname);
+ separator = ", ";
+ }
+
var cm = m as CreationMethod;
if (cm != null) {
- if (cm.custom_return_type_cname != null) {
- ccode_params.append_printf ("%stype = \"%s\"", separator, cm.custom_return_type_cname);
- separator = ", ";
- }
if (!m.has_new_function) {
ccode_params.append_printf ("%shas_new_function = false", separator);
separator = ", ";
*/
public string class_name { get; set; }
- /**
- * Specifies a custom C return type for that creation method.
- * Only the idl parser and the interface writer should use this.
- * FIXME: remove this as soon the compiler has a decent attribute
- * handling.
- */
- public string? custom_return_type_cname { get; set; }
-
/**
* Specifies whether this constructor chains up to a base
* constructor or a different constructor of the same class.
*/
public string? array_length_type { get; set; default = null; }
+ /**
+ * Specifies a custom C return type for this method.
+ */
+ public string? custom_return_type_cname { get; set; }
+
/**
* Specifies whether this method expects printf-style format arguments.
*/
if (a.has_argument ("returns_floating_reference")) {
returns_floating_reference = a.get_bool ("returns_floating_reference");
}
+ if (a.has_argument ("type")) {
+ custom_return_type_cname = a.get_string ("type");
+ }
}
/**
// return type.
if (current_data_type is Class && res != null) {
if ("%s*".printf (current_data_type.get_cname()) != res.type.unparsed) {
- ((CreationMethod)m).custom_return_type_cname = res.type.unparsed;
+ m.custom_return_type_cname = res.type.unparsed;
}
}
} else {