vala r913 - in trunk: . gobject



Author: juergbi
Date: Sun Jan 27 12:23:33 2008
New Revision: 913
URL: http://svn.gnome.org/viewvc/vala?rev=913&view=rev

Log:
2008-01-27  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala: report error instead of warning when
	  trying to implicitly copy non-reference counted object


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Sun Jan 27 12:23:33 2008
@@ -1011,21 +1011,15 @@
 			string dup_function;
 			if (type.data_type.is_reference_counting ()) {
 				dup_function = type.data_type.get_ref_function ();
-			} else {
-				if (type.data_type != string_type.data_type) {
-					// duplicating non-reference counted structs may cause side-effects (and performance issues)
-					Report.warning (type.source_reference, "duplicating %s instance, use weak variable or explicitly invoke copy method".printf (type.data_type.name));
-				}
+			} else if (type.data_type == string_type.data_type) {
 				dup_function = type.data_type.get_dup_function ();
-				if (dup_function == null) {
-					Report.error (type.data_type.source_reference, "The type `%s` doesn't contain a copy function".printf (type.data_type.get_full_name ()));
-				}
+			} else {
+				// duplicating non-reference counted structs may cause side-effects (and performance issues)
+				Report.error (type.source_reference, "duplicating %s instance, use weak variable or explicitly invoke copy method".printf (type.data_type.name));
+				return null;
 			}
 
-			if (null != dup_function)
-				return new CCodeIdentifier (dup_function);
-
-			return null;
+			return new CCodeIdentifier (dup_function);
 		} else if (type.type_parameter != null && current_type_symbol is Class) {
 			string func_name = "%s_dup_func".printf (type.type_parameter.name.down ());
 			return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), func_name);



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