]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Use correct ctype for result variable in methods in more cases
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 6 May 2024 12:20:21 +0000 (14:20 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 29 May 2024 08:35:35 +0000 (10:35 +0200)
codegen/valaccodemethodmodule.vala
tests/methods/bug699956.c-expected

index 05b9a29166da1d5e271fa9b4db98adf67aa494cf..41099ab5149c720d06c20e16add5f06de5c8ad0a 100644 (file)
@@ -831,7 +831,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        } else {
                                vardecl = new CCodeVariableDeclarator ("result");
                        }
-                       ccode.add_declaration (get_ccode_name (m.return_type), vardecl);
+                       ccode.add_declaration (get_creturn_type (m, get_ccode_name (m.return_type)), vardecl);
                }
 
                pop_context ();
@@ -1210,7 +1210,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        } else {
                                vardecl = new CCodeVariableDeclarator ("result");
                        }
-                       ccode.add_declaration (get_ccode_name (m.return_type), vardecl);
+                       ccode.add_declaration (get_creturn_type (m, get_ccode_name (m.return_type)), vardecl);
                }
 
                // add a typecheck statement for "self"
index 369d7f3e3c17fec6d8a813d797801d2b8e10f891..9cc94a0b9664b2ba1a4ccf2c9f9053bc7f81ea31 100644 (file)
@@ -364,7 +364,7 @@ bar_get_type (void)
 Foo*
 foo (void)
 {
-       Bar* result;
+       Foo* result;
        result = NULL;
        return result;
 }