Skip to content

Commit

Permalink
codegen: Use correct ctype for result variable in methods in more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ricotz committed May 18, 2024
1 parent 7bb6259 commit 5245a38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions codegen/valaccodemethodmodule.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/methods/bug699956.c-expected
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ bar_get_type (void)
Foo*
foo (void)
{
Bar* result;
Foo* result;
result = NULL;
return result;
}
Expand Down

0 comments on commit 5245a38

Please sign in to comment.