From: Jürg Billeter Date: Sun, 10 Oct 2010 10:06:14 +0000 (+0200) Subject: codegen: Use builder API for struct destroy function X-Git-Tag: 0.11.1~142 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=1cf5b53148633899e323b261a0f498a1ab4555db;p=thirdparty%2Fvala.git codegen: Use builder API for struct destroy function --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 3fa1796c7..22b95a429 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); }