vala r1080 - in trunk: . gobject tests
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1080 - in trunk: . gobject tests
- Date: Sat, 1 Mar 2008 16:39:14 +0000 (GMT)
Author: juergbi
Date: Sat Mar 1 16:39:13 2008
New Revision: 1080
URL: http://svn.gnome.org/viewvc/vala?rev=1080&view=rev
Log:
2008-03-01 Juerg Billeter <j bitron ch>
* gobject/valaccodegenerator.vala: fix using interface methods as
delegates, fixes bug 518109
* tests/delegates.vala: test interface methods as delegates
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/tests/delegates.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Sat Mar 1 16:39:13 2008
@@ -3146,7 +3146,15 @@
} 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;
}
Modified: trunk/tests/delegates.vala
==============================================================================
--- trunk/tests/delegates.vala (original)
+++ trunk/tests/delegates.vala Sat Mar 1 16:39:13 2008
@@ -6,7 +6,11 @@
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 () {
}
@@ -40,6 +44,15 @@
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");
@@ -64,6 +77,8 @@
test_function_pointers ();
+ test_delegates_interface_method ();
+
return 0;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]