]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Report error when using reference counting for interfaces without class
authorJürg Billeter <j@bitron.ch>
Mon, 16 Jun 2008 20:56:20 +0000 (20:56 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 16 Jun 2008 20:56:20 +0000 (20:56 +0000)
2008-06-16  Jürg Billeter  <j@bitron.ch>

* gobject/valaccodegenerator.vala:

Report error when using reference counting for interfaces without
class prerequisite

svn path=/trunk/; revision=1600

ChangeLog
gobject/valaccodegenerator.vala

index 8812b46a436c515c295fb9f0e28c2d2d1d47fc36..8dd45952687b83f423b789f974182cd2f2903ffc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-16  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodegenerator.vala:
+
+       Report error when using reference counting for interfaces without
+       class prerequisite
+
 2008-06-16  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodememberaccessbinding.vala:
index 683eaaf214029c708249154503288593a1dc6d7f..91890ef41d8bd18957a275df3537d050eeaa0f73 100644 (file)
@@ -1284,6 +1284,10 @@ public class Vala.CCodeGenerator : CodeGenerator {
                        string dup_function;
                        if (type.data_type.is_reference_counting ()) {
                                dup_function = type.data_type.get_ref_function ();
+                               if (type.data_type is Interface && dup_function == null) {
+                                       Report.error (source_reference, "missing class prerequisite for interface `%s'".printf (type.data_type.get_full_name ()));
+                                       return null;
+                               }
                        } else if (cl != null && cl.is_immutable) {
                                // allow duplicates of immutable instances as for example strings
                                dup_function = type.data_type.get_dup_function ();
@@ -1379,6 +1383,10 @@ public class Vala.CCodeGenerator : CodeGenerator {
                        if (type is ReferenceType) {
                                if (type.data_type.is_reference_counting ()) {
                                        unref_function = type.data_type.get_unref_function ();
+                                       if (type.data_type is Interface && unref_function == null) {
+                                               Report.error (type.source_reference, "missing class prerequisite for interface `%s'".printf (type.data_type.get_full_name ()));
+                                               return null;
+                                       }
                                } else {
                                        unref_function = type.data_type.get_free_function ();
                                }