2008-03-01 Jürg Billeter <j@bitron.ch>
+ * gobject/valaccodegenerator.vala: fix using interface methods as
+ delegates, fixes bug 518109
+
+ * tests/delegates.vala: test interface methods as delegates
+
+2008-03-01 Jürg Billeter <j@bitron.ch>
+
* gobject/valaccodegenerator.vala,
gobject/valaccodegeneratorclass.vala: don't register private
properties with GObject property system, fixes bug 519201
} else if (target_type is DelegateType && expression_type is MethodType) {
var dt = (DelegateType) target_type;
var mt = (MethodType) expression_type;
- return new CCodeIdentifier (generate_delegate_wrapper (mt.method_symbol, dt.delegate_symbol));
+
+ var method = mt.method_symbol;
+ if (method.base_interface_method != null) {
+ method = method.base_interface_method;
+ } else if (method.base_method != null) {
+ method = method.base_method;
+ }
+
+ return new CCodeIdentifier (generate_delegate_wrapper (method, dt.delegate_symbol));
} else {
return cexpr;
}
public delegate void Maman.InstanceCallback (int i);
-class Maman.Bar : Object {
+interface Maman.Foo : Object {
+ public abstract void foo_method (int i);
+}
+
+class Maman.Bar : Object, Foo {
public Bar () {
}
stdout.printf (" 3\n");
}
+ public void foo_method (int i) {
+ }
+
+ static void test_delegates_interface_method () {
+ // http://bugzilla.gnome.org/show_bug.cgi?id=518109
+ var bar = new Bar ();
+ call_instance_delegate (bar.foo_method);
+ }
+
static int main (string[] args) {
stdout.printf ("Delegate Test: 1");
test_function_pointers ();
+ test_delegates_interface_method ();
+
return 0;
}
}