]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Drop MemberAccess creation for field finalization
authorLuca Bruno <lucabru@src.gnome.org>
Sun, 6 Mar 2011 17:21:48 +0000 (18:21 +0100)
committerJürg Billeter <j@bitron.ch>
Thu, 10 Mar 2011 18:30:49 +0000 (19:30 +0100)
codegen/valaccodebasemodule.vala

index 3cffed3e4117ec0c1cde8711db434e64f405a849..5a22f44558c13b3bb51f40d52d242c3ac7f2ae6d 100644 (file)
@@ -995,19 +995,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        
                        if (requires_destroy (f.variable_type) && instance_finalize_context != null) {
                                push_context (instance_finalize_context);
-
-                               var this_access = new MemberAccess.simple ("this");
-                               this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
-
-                               var field_st = f.parent_symbol as Struct;
-                               if (field_st != null && !field_st.is_simple_type ()) {
-                                       set_cvalue (this_access, new CCodeIdentifier ("(*self)"));
-                               } else {
-                                       set_cvalue (this_access, new CCodeIdentifier ("self"));
-                               }
-
-                               ccode.add_expression (destroy_field (f, this_access.target_value));
-
+                               ccode.add_expression (destroy_field (f, load_this_parameter ((TypeSymbol) f.parent_symbol)));
                                pop_context ();
                        }
                } else if (f.binding == MemberBinding.CLASS)  {