]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix declaration of free function for compact classes
authorJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 18:57:47 +0000 (19:57 +0100)
committerJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 18:57:47 +0000 (19:57 +0100)
Fixes bug 605495.

codegen/valagtypemodule.vala

index 401e82c631be7b77e6e03a7aa470518c7cd7d2a1..bda333228cc786526f7ab8ff732ac910a442317a 100644 (file)
@@ -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);
-                       }
                }
        }