2007-12-24 Jürg Billeter <j@bitron.ch>
+ * vala/valainterfacewriter.vala: fix writing delegate types
+
+2007-12-24 Jürg Billeter <j@bitron.ch>
+
* vala/valasymbolresolver.vala: fix void types with vapigen
2007-12-24 Jürg Billeter <j@bitron.ch>
write_indent ();
write_string ("public static delegate ");
- var type = cb.return_type.data_type;
- if (type == null) {
- write_string ("void");
- } else {
- if (cb.return_type.transfers_ownership) {
- } else if ((cb.return_type.data_type != null && cb.return_type.data_type.is_reference_type ()) || cb.return_type.type_parameter != null) {
- write_string ("weak ");
- }
-
- write_type (cb.return_type);
- }
+ write_return_type (cb.return_type);
write_string (" ");
write_identifier (cb.name);
if (!(m is CreationMethod)) {
write_string (" ");
- if (m.return_type.data_type == null && m.return_type.type_parameter == null) {
- write_string ("void");
- } else {
- if (m.return_type.transfers_ownership) {
- } else if ((m.return_type.data_type != null && m.return_type.data_type.is_reference_type ()) || m.return_type.type_parameter != null) {
- write_string ("weak ");
- }
-
- write_type (m.return_type);
- }
+ write_return_type (m.return_type);
write_string (" ");
write_identifier (m.name);
write_indent ();
write_string ("public signal ");
- var type = sig.return_type.data_type;
- if (type == null) {
- write_string ("void");
- } else {
- if (sig.return_type.transfers_ownership) {
- } else if ((sig.return_type.data_type != null && sig.return_type.data_type.is_reference_type ()) || sig.return_type.type_parameter != null) {
- write_string ("weak ");
- }
-
- write_type (sig.return_type);
- }
+ write_return_type (sig.return_type);
write_string (" ");
write_identifier (sig.name);
write_string (s);
}
+ private void write_return_type (DataType! type) {
+ if ((type.data_type != null && type.data_type.is_reference_type ()) || type.type_parameter != null) {
+ if (!type.transfers_ownership) {
+ write_string ("weak ");
+ }
+ }
+
+ write_type (type);
+ }
+
private void write_type (DataType! type) {
write_string (type.to_string ());
}