From: Luca Bruno Date: Wed, 16 Mar 2011 10:35:16 +0000 (+0100) Subject: codegen: Drop MemberAccess creation in struct destroy function X-Git-Tag: 0.13.0~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09d93591bd20bae9ba05ee52fff1705f87a861e4;p=thirdparty%2Fvala.git codegen: Drop MemberAccess creation in struct destroy function --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 9d9c3f9e7..bed29d4fd 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -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);