[vala/wip/attributes: 26/121] codegen: Add get_ccode_has_destroy_function



commit a14743211198be0d4f2581a08a14e469ca5767be
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Jun 28 15:11:12 2011 +0200

    codegen: Add get_ccode_has_destroy_function

 codegen/valaccodebasemodule.vala |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index e3bcee3..2d5d015 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2594,7 +2594,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		} else {
 			var st = type.data_type as Struct;
 			if (st != null && st.is_disposable ()) {
-				if (!st.has_destroy_function) {
+				if (!get_ccode_has_destroy_function (st)) {
 					generate_struct_destroy_function (st);
 				}
 
@@ -2696,7 +2696,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 					}
 				} else {
 					var st = (Struct) type.data_type;
-					if (!st.has_destroy_function) {
+					if (!get_ccode_has_destroy_function (st)) {
 						generate_struct_destroy_function (st);
 					}
 					unref_function = st.get_destroy_function ();
@@ -5691,6 +5691,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return true;
 	}
 
+	public static bool get_ccode_has_destroy_function (Struct st) {
+		var a = st.get_attribute ("CCode");
+		if (a != null && a.has_argument ("has_destroy_function")) {
+			return a.get_bool ("has_destroy_function");
+		}
+		return true;
+	}
+
 	public override void visit_class (Class cl) {
 	}
 



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