summaryrefslogtreecommitdiff
path: root/codegen/valagtypemodule.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-04-24 09:11:27 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2021-04-24 09:14:54 +0200
commitf6be4cbd7f901683a1e6f4f4a0070b1e87dcce65 (patch)
tree57d34c5daaba155348f68dbd0b80f0a461195691 /codegen/valagtypemodule.vala
parent145bfaf7be06daedade0048b938ceb29169081f9 (diff)
downloadvala-f6be4cbd7f901683a1e6f4f4a0070b1e87dcce65.tar.gz
codegen: Add missing "_return" label and "_inner_error*_" declaration in dtors
Diffstat (limited to 'codegen/valagtypemodule.vala')
-rw-r--r--codegen/valagtypemodule.vala20
1 files changed, 20 insertions, 0 deletions
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 138201008..6ec1f6b6d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1703,6 +1703,16 @@ public class Vala.GTypeModule : GErrorModule {
if (cl.static_destructor != null) {
cl.static_destructor.body.emit (this);
+
+ if (current_method_inner_error) {
+ ccode.add_declaration ("GError*", new CCodeVariableDeclarator.zero ("_inner_error%d_".printf (current_inner_error_id), new CCodeConstant ("NULL")));
+ }
+
+ if (current_method_return) {
+ // support return statements in destructors
+ ccode.add_label ("_return");
+ ccode.add_statement (new CCodeEmptyStatement ());
+ }
}
pop_context ();
@@ -1726,6 +1736,16 @@ public class Vala.GTypeModule : GErrorModule {
if (cl.class_destructor != null) {
cl.class_destructor.body.emit (this);
+
+ if (current_method_inner_error) {
+ ccode.add_declaration ("GError*", new CCodeVariableDeclarator.zero ("_inner_error%d_".printf (current_inner_error_id), new CCodeConstant ("NULL")));
+ }
+
+ if (current_method_return) {
+ // support return statements in destructors
+ ccode.add_label ("_return");
+ ccode.add_statement (new CCodeEmptyStatement ());
+ }
}
pop_context ();