[vala] codegen: Use builder API for struct destroy function
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Use builder API for struct destroy function
- Date: Sun, 10 Oct 2010 16:39:43 +0000 (UTC)
commit 1cf5b53148633899e323b261a0f498a1ab4555db
Author: Jürg Billeter <j bitron ch>
Date: Sun Oct 10 12:06:14 2010 +0200
codegen: Use builder API for struct destroy function
codegen/valaccodebasemodule.vala | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3fa1796..22b95a4 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5454,7 +5454,8 @@ public class Vala.CCodeBaseModule : CodeGenerator {
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
- var cblock = new CCodeBlock ();
+ push_function (function);
+
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
if (requires_destroy (f.variable_type)) {
@@ -5468,13 +5469,14 @@ public class Vala.CCodeBaseModule : CodeGenerator {
ma.symbol_reference = f;
ma.value_type = f.variable_type.copy ();
visit_member_access (ma);
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (lhs, f.variable_type, ma)));
+ ccode.add_expression (get_unref_expression (lhs, f.variable_type, ma));
}
}
}
+ pop_function ();
+
cfile.add_function_declaration (function);
- function.block = cblock;
cfile.add_function (function);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]