blob: 8be4aaed0d5077ddfc2bc484f0403c96079ff1d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
delegate string FooFunc (Foo foo, string s);
class Foo : Object {
public signal string test (string s);
}
class Bar : Object {
construct {
var foo = new Foo ();
FooFunc func = (f,s) => {
assert (s == "foo");
return s;
};
foo.test.connect (func);
assert (foo.test ("foo") == "foo");
foo.test.disconnect (func);
foo.test ("bar");
}
public void run () {
var foo = new Foo ();
FooFunc func = (f,s) => {
assert (s == "foo");
return s;
};
foo.test.connect (func);
assert (foo.test ("foo") == "foo");
foo.test.disconnect (func);
foo.test ("bar");
}
}
delegate string FazFunc (Faz faz, string s);
class Faz {
public signal string test (string s);
}
class Boo {
public Boo () {
var faz = new Faz ();
FazFunc func = (f,s) => {
assert (s == "faz");
return s;
};
faz.test.connect (func);
assert (faz.test ("faz") == "faz");
faz.test.disconnect (func);
faz.test ("boo");
}
public void run () {
var faz = new Faz ();
FazFunc func = (f,s) => {
assert (s == "faz");
return s;
};
faz.test.connect (func);
assert (faz.test ("faz") == "faz");
faz.test.disconnect (func);
faz.test ("boo");
}
}
void main () {
{
var bar = new Bar ();
bar.run ();
var foo = new Foo ();
FooFunc func = (f,s) => {
assert (s == "foo");
return s;
};
foo.test.connect (func);
assert (foo.test ("foo") == "foo");
foo.test.disconnect (func);
foo.test ("bar");
}
{
var boo = new Boo ();
boo.run ();
var faz = new Faz ();
FazFunc func = (f,s) => {
assert (s == "faz");
return s;
};
faz.test.connect (func);
assert (faz.test ("faz") == "faz");
faz.test.disconnect (func);
faz.test ("boo");
}
}
|