fix late bound methods and signals, fixes bug 476953
authorJuerg Billeter <j@bitron.ch>
Fri, 14 Sep 2007 20:19:28 +0000 (20:19 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 14 Sep 2007 20:19:28 +0000 (20:19 +0000)
2007-09-14  Juerg Billeter  <j@bitron.ch>

* gobject/valacodegeneratorinvocationexpression.vala,
  gobject/valacodegeneratorsignal.vala: fix late bound methods and
  signals, fixes bug 476953

svn path=/trunk/; revision=603

ChangeLog
gobject/valacodegeneratorinvocationexpression.vala
gobject/valacodegeneratorsignal.vala

index b9bead3..c1b7ed1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-14  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valacodegeneratorinvocationexpression.vala,
+         gobject/valacodegeneratorsignal.vala: fix late bound methods and
+         signals, fixes bug 476953
+
 2007-09-13  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valacodegeneratormethod.vala: generate C code comment for
index cc8ce06..77e309e 100644 (file)
@@ -83,9 +83,12 @@ public class Vala.CodeGenerator {
                                instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance);
                        }
 
-                       var instance_target_type = new TypeReference ();
-                       instance_target_type.data_type = (DataType) base_method.parent_symbol;
-                       instance = get_implicit_cast_expression (instance, instance_expression_type, instance_target_type);
+                       // parent_symbol may be null for late bound methods
+                       if (base_method.parent_symbol != null) {
+                               var instance_target_type = new TypeReference ();
+                               instance_target_type.data_type = (DataType) base_method.parent_symbol;
+                               instance = get_implicit_cast_expression (instance, instance_expression_type, instance_target_type);
+                       }
 
                        if (!m.instance_last) {
                                ccall.add_argument (instance);
index 9c320f9..f446f94 100644 (file)
@@ -105,11 +105,14 @@ 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;
+               // parent_symbol may be null for late bound signals
+               if (sig.parent_symbol != null) {
+                       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);