[vala] codegen: Use destroy_field in finalizers



commit 815148cd788261d070721b4ce9e9df7a13d87295
Author: Jürg Billeter <j bitron ch>
Date:   Wed Feb 23 08:22:39 2011 +0100

    codegen: Use destroy_field in finalizers

 codegen/valaccodebasemodule.vala |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4bba12c..5a8f405 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));
 				}
 			}
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]