[vala/wip/attributes: 26/27] codegen: Add get_ccode_has_copy_function



commit 68e876925633ef9a5a9fcc7fb6b4e83d54418ab9
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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8abfeae..fe0e0a7 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);
 				}
 
@@ -3739,7 +3739,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);
 			}
 
@@ -5675,6 +5675,11 @@ 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");
+	}
+
 	public override void visit_class (Class cl) {
 	}
 



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