From: Jürg Billeter Date: Mon, 22 Mar 2010 18:57:47 +0000 (+0100) Subject: Fix declaration of free function for compact classes X-Git-Tag: 0.8.0~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a74afd2ab33f7dbf980a4d72c5b5cbdda70c6131;p=thirdparty%2Fvala.git Fix declaration of free function for compact classes Fixes bug 605495. --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 401e82c63..bda333228 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -158,6 +158,17 @@ internal class Vala.GTypeModule : GErrorModule { } decl_space.add_type_member_declaration (function); + } else if (!is_gtypeinstance) { + if (cl.base_class == null) { + var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void"); + if (cl.access == SymbolAccessibility.PRIVATE) { + function.modifiers = CCodeModifiers.STATIC; + } + + function.add_parameter (new CCodeFormalParameter ("self", cl.get_cname () + "*")); + + decl_space.add_type_member_declaration (function); + } } if (is_gtypeinstance) { @@ -479,17 +490,6 @@ internal class Vala.GTypeModule : GErrorModule { if (cl.has_private_fields) { Report.error (cl.source_reference, "Private fields not supported in compact classes"); } - - if (cl.base_class == null) { - var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void"); - if (cl.access == SymbolAccessibility.PRIVATE) { - function.modifiers = CCodeModifiers.STATIC; - } - - function.add_parameter (new CCodeFormalParameter ("self", cl.get_cname () + "*")); - - decl_space.add_type_member_declaration (function); - } } }