[vala/wip/attributes: 25/100] codegen: Add get_ccode_has_copy_function



commit 156681e6f1cbf350b847649a99b6fef1ba147701
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Jun 28 15:10:27 2011 +0200

    codegen: Add get_ccode_has_copy_function

 codegen/valaccodebasemodule.vala |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8ee55e7..e3bcee3 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2507,7 +2507,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			var st = value_type.data_type as Struct;
 			if (st != null && st.is_disposable ()) {
-				if (!st.has_copy_function) {
+				if (!get_ccode_has_copy_function (st)) {
 					generate_struct_copy_function (st);
 				}
 
@@ -3746,7 +3746,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			copy_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr));
 			copy_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
 
-			if (!st.has_copy_function) {
+			if (!get_ccode_has_copy_function (st)) {
 				generate_struct_copy_function (st);
 			}
 
@@ -5682,6 +5682,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return get_ccode_attribute(sym).default_value;
 	}
 
+	public static bool get_ccode_has_copy_function (Struct st) {
+		var a = st.get_attribute ("CCode");
+		return a != null && a.get_bool ("has_copy_function");
+		if (a != null && a.has_argument ("has_copy_function")) {
+			return a.get_bool ("has_copy_function");
+		}
+		return true;
+	}
+
 	public override void visit_class (Class cl) {
 	}
 



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