report an error when trying to define a signal in a type not deriving from
authorJuerg Billeter <j@bitron.ch>
Sat, 8 Sep 2007 08:42:33 +0000 (08:42 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 8 Sep 2007 08:42:33 +0000 (08:42 +0000)
2007-09-08  Juerg Billeter  <j@bitron.ch>

* gobject/valacodegeneratorsignal.vala: report an error when trying to
  define a signal in a type not deriving from GLib.Object

svn path=/trunk/; revision=590

ChangeLog
gobject/valacodegeneratorsignal.vala

index 26d8f01..51abe04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-08  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valacodegeneratorsignal.vala: report an error when trying to
+         define a signal in a type not deriving from GLib.Object
+
 2007-09-07  Jürg Billeter  <j@bitron.ch>
 
        * doc/vala/default.css, doc/vala/xhtml.xsl: support notes
index ca393bf..9c320f9 100644 (file)
@@ -105,6 +105,13 @@ public class Vala.CodeGenerator {
        }
        
        public override void visit_signal (Signal! sig) {
+               var dt = sig.parent_symbol as DataType;
+               if (!dt.is_subtype_of (gobject_type)) {
+                       sig.error = true;
+                       Report.error (sig.source_reference, "Only classes and interfaces deriving from GLib.Object support signals. `%s' does not derive from GLib.Object.".printf (dt.get_full_name ()));
+                       return;
+               }
+
                sig.accept_children (this);
 
                string signature;