[vala/emit-let: 2/8] codegen: Drop MemberAccess creation in struct destroy function



commit c9f86b27edc8ed5187c9203cebef8401f578c6df
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Mar 16 11:35:16 2011 +0100

    codegen: Drop MemberAccess creation in struct destroy function

 codegen/valaccodebasemodule.vala |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ee82e49..956fd79 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5732,21 +5732,20 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		function.modifiers = CCodeModifiers.STATIC;
 		function.add_parameter (new CCodeParameter ("self", st.get_cname () + "*"));
 
+		push_context (new EmitContext ());
 		push_function (function);
 
+		var this_value = load_this_parameter (st);
 		foreach (Field f in st.get_fields ()) {
 			if (f.binding == MemberBinding.INSTANCE) {
 				if (requires_destroy (f.variable_type)) {
-					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)"));
-
-					ccode.add_expression (destroy_field (f, this_access.target_value));
+					ccode.add_expression (destroy_field (f, this_value));
 				}
 			}
 		}
 
 		pop_function ();
+		pop_context ();
 
 		cfile.add_function_declaration (function);
 		cfile.add_function (function);



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