2011-04-07 13:49:27 -07:00
|
|
|
fn main() {
|
|
|
|
|
|
|
|
obj foo() {
|
2011-05-05 20:17:44 +02:00
|
|
|
fn m1(int i) -> int {
|
2011-04-07 13:49:27 -07:00
|
|
|
i += 1;
|
|
|
|
ret i;
|
|
|
|
}
|
2011-05-05 20:17:44 +02:00
|
|
|
fn m2(int i) -> int {
|
2011-04-07 13:49:27 -07:00
|
|
|
ret self.m1(i);
|
|
|
|
}
|
2011-05-05 20:17:44 +02:00
|
|
|
fn m3(int i) -> int {
|
2011-04-07 13:49:27 -07:00
|
|
|
i += 1;
|
|
|
|
ret self.m1(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto a = foo();
|
|
|
|
let int i = 0;
|
|
|
|
|
|
|
|
i = a.m1(i);
|
2011-05-02 17:47:24 -07:00
|
|
|
assert (i == 1);
|
2011-04-07 13:49:27 -07:00
|
|
|
i = a.m2(i);
|
2011-05-02 17:47:24 -07:00
|
|
|
assert (i == 2);
|
2011-04-07 13:49:27 -07:00
|
|
|
i = a.m3(i);
|
2011-05-02 17:47:24 -07:00
|
|
|
assert (i == 4);
|
2011-04-07 13:49:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|