[vala/wip/attributes: 11/12] codegen: Add get_ccode_ref_function_void



commit 85291117f3bcb8e055bac59abe7504c75b69c451
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jun 26 16:39:59 2011 +0200

    codegen: Add get_ccode_ref_function_void

 codegen/valaccodebasemodule.vala |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index a88dc11..312eac1 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3712,8 +3712,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 	bool is_ref_function_void (DataType type) {
 		var cl = type.data_type as Class;
-		if (cl != null && cl.ref_function_void) {
-			return true;
+		if (cl != null) {
+			return get_ccode_ref_function_void (cl);
 		} else {
 			return false;
 		}
@@ -5626,6 +5626,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return get_ccode_attribute(sym).ref_function;
 	}
 
+	public static bool get_ccode_ref_function_void (Class cl) {
+		return get_ccode_attribute(sym).ref_function_void;
+	}
+
 	public static string get_ccode_unref_function (ObjectTypeSymbol sym) {
 		return get_ccode_attribute(sym).unref_function;
 	}
@@ -6057,6 +6061,20 @@ public class Vala.CCodeAttribute : AttributeCache {
 		}
 	}
 
+	public bool ref_function_void {
+		get {
+			if (_ref_function_void == null) {
+				var cl = (Class) sym;
+				if (cl.base_class != null) {
+					_ref_function_void = CCodeBaseModule.get_ccode_ref_function_void (cl.base_class);
+				} else {
+					_ref_function_void = false;
+				}
+			}
+			return _ref_function_void;
+		}
+	}
+
 	public string unref_function {
 		get {
 			if (_unref_function == null) {
@@ -6074,6 +6092,7 @@ public class Vala.CCodeAttribute : AttributeCache {
 	private string _lower_case_prefix;
 	private string _lower_case_suffix;
 	private string _ref_function;
+	private bool? _ref_function_void;
 	private string _unref_function;
 
 	public CCodeAttribute (CodeNode node) {
@@ -6099,6 +6118,9 @@ public class Vala.CCodeAttribute : AttributeCache {
 			}
 			_lower_case_suffix = attr.get_string ("lower_case_csuffix");
 			_ref_function = attr.get_string ("ref_function");
+			if (attr.has_argument ("ref_function_void")) {
+				_ref_function_void = attr.get_bool ("ref_function_void");
+			}
 			_unref_function = attr.get_string ("unref_function");
 		}
 	}



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