summaryrefslogtreecommitdiff
path: root/tests/delegates
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-03-22 16:04:00 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-03-22 16:08:37 +0100
commitdb6f68f365a168f1fcc8f46e4f7674acd84e2266 (patch)
tree76be9d581ec04191ec0d9aefd321f5c08bbabeac /tests/delegates
parent46a1225768849c3d255c247e93b3e705f991baf7 (diff)
downloadvala-db6f68f365a168f1fcc8f46e4f7674acd84e2266.tar.gz
codegen: Fix delegate initializer for instance fields
Set delegate-target to "self" which is available in *_instance_init(). https://bugzilla.gnome.org/show_bug.cgi?id=683925
Diffstat (limited to 'tests/delegates')
-rw-r--r--tests/delegates/bug683925.vala24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/delegates/bug683925.vala b/tests/delegates/bug683925.vala
new file mode 100644
index 000000000..5c0ba3636
--- /dev/null
+++ b/tests/delegates/bug683925.vala
@@ -0,0 +1,24 @@
+delegate void FooFunc ();
+
+class Foo : Object {
+ bool check = false;
+
+ FooFunc func = default_func;
+
+ public Foo () {
+ }
+
+ void default_func () {
+ check = true;
+ }
+
+ public void run () {
+ func ();
+ assert (check);
+ }
+}
+
+void main(){
+ var foo = new Foo ();
+ foo.run ();
+}