]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
report error instead of warning when trying to implicitly copy
authorJuerg Billeter <j@bitron.ch>
Sun, 27 Jan 2008 12:23:33 +0000 (12:23 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 27 Jan 2008 12:23:33 +0000 (12:23 +0000)
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

svn path=/trunk/; revision=913

ChangeLog
gobject/valaccodegenerator.vala

index 97c3b660dc60bba7d162774e1168c16065337715..e9136ce32562f008701ad70fde919dc7cba55a72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-27  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodegenerator.vala: report error instead of warning when
+         trying to implicitly copy non-reference counted object
+
 2008-01-27  Raffaele Sandrini  <raffaele@sandrini.ch>
 
        * gobject/valaccodegeneratorsignal.vala: fix regression introduced
index 291327286944725a1ebfedcf0ae17c6ac3dc342c..36cace5c3d39c04e21f0e2c58c4c04f620c06c28 100644 (file)
@@ -1011,21 +1011,15 @@ public class Vala.CCodeGenerator : CodeGenerator {
                        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);