]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: Write return value before parameters
authorJürg Billeter <j@bitron.ch>
Sun, 24 Jun 2012 15:32:27 +0000 (17:32 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 24 Jun 2012 15:32:27 +0000 (17:32 +0200)
Fixes bug 669552.

codegen/valagirwriter.vala

index 7a5cacf61d06d476d72ba04d92e0a07b4eaf9fd0..3e5c3164b7205366bb98ac9abaa1c0d78e105d81 100644 (file)
@@ -826,6 +826,13 @@ public class Vala.GIRWriter : CodeVisitor {
        private void write_params_and_return (List<Parameter> params, DataType? return_type, bool return_array_length, string? return_comment = null, bool constructor = false, DataType? instance_type = null, bool user_data = false) {
                int last_index = 0;
                bool ret_is_struct = return_type != null && return_type.is_real_non_null_struct_type ();
+
+               if (return_type != null && !ret_is_struct) {
+                       write_param_or_return (return_type, false, ref last_index, return_array_length, null, return_comment, ParameterDirection.IN, constructor);
+               } else if (ret_is_struct) {
+                       write_param_or_return (new VoidType (), false, ref last_index, false, null, return_comment, ParameterDirection.IN);
+               }
+
                if (params.size != 0 || instance_type != null || (return_type is ArrayType && return_array_length) || (return_type is DelegateType) || ret_is_struct) {
                        write_indent ();
                        buffer.append_printf ("<parameters>\n");
@@ -866,12 +873,6 @@ public class Vala.GIRWriter : CodeVisitor {
                        write_indent ();
                        buffer.append_printf ("</parameters>\n");
                }
-
-               if (return_type != null && !ret_is_struct) {
-                       write_param_or_return (return_type, false, ref last_index, return_array_length, null, return_comment, ParameterDirection.IN, constructor);
-               } else if (ret_is_struct) {
-                       write_param_or_return (new VoidType (), false, ref last_index, false, null, return_comment, ParameterDirection.IN);
-               }
        }
 
        public override void visit_delegate (Delegate cb) {