[vala/wip/attributes: 13/100] codegen: Add get_ccode_ref_function_void



commit d9696a48ffee47fdc3f7a8ae5146268634ef171b
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 7f0ff02..825a451 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(cl).ref_function_void;
+	}
+
 	public static string get_ccode_unref_function (ObjectTypeSymbol sym) {
 		return get_ccode_attribute(sym).unref_function;
 	}
@@ -6056,6 +6060,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) {
@@ -6073,6 +6091,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) {
@@ -6098,6 +6117,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]