From 815148cd788261d070721b4ce9e9df7a13d87295 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Wed, 23 Feb 2011 08:22:39 +0100 Subject: [PATCH] codegen: Use destroy_field in finalizers --- codegen/valaccodebasemodule.vala | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 4bba12ca..5a8f4058 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1012,11 +1012,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { set_cvalue (this_access, new CCodeIdentifier ("self")); } - var ma = new MemberAccess (this_access, f.name); - ma.symbol_reference = f; - ma.value_type = f.variable_type.copy (); - visit_member_access (ma); - ccode.add_expression (get_unref_expression (lhs, f.variable_type, ma)); + ccode.add_expression (destroy_field (f, this_access)); pop_context (); } @@ -5819,17 +5815,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { foreach (Field f in st.get_fields ()) { if (f.binding == MemberBinding.INSTANCE) { if (requires_destroy (f.variable_type)) { - var lhs = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), f.get_cname ()); - var this_access = new MemberAccess.simple ("this"); this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol); set_cvalue (this_access, new CCodeIdentifier ("(*self)")); - var ma = new MemberAccess (this_access, f.name); - ma.symbol_reference = f; - ma.value_type = f.variable_type.copy (); - visit_member_access (ma); - ccode.add_expression (get_unref_expression (lhs, f.variable_type, ma)); + ccode.add_expression (destroy_field (f, this_access)); } } } -- 2.11.4.GIT