[vala] Fix declaration of free function for compact classes



commit a74afd2ab33f7dbf980a4d72c5b5cbdda70c6131
Author: Jürg Billeter <j bitron ch>
Date:   Mon Mar 22 19:57:47 2010 +0100

    Fix declaration of free function for compact classes
    
    Fixes bug 605495.

 codegen/valagtypemodule.vala |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 401e82c..bda3332 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);
-			}
 		}
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]