]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Drop MemberAccess creation in struct destroy function
authorLuca Bruno <lucabru@src.gnome.org>
Wed, 16 Mar 2011 10:35:16 +0000 (11:35 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 6 Apr 2011 12:21:03 +0000 (14:21 +0200)
codegen/valaccodebasemodule.vala

index 9d9c3f9e7e69a49943242ee844263327d8b3052b..bed29d4fd6d45615f3f9311fba66c95caafa2056 100644 (file)
@@ -5740,21 +5740,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);