2011-05-17 18:14:39 -05:00
|
|
|
|
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
fn main() {
|
|
|
|
obj foo() {
|
|
|
|
fn m1() -> str { ret "foo.m1"; }
|
|
|
|
fn m2() -> str { ret self.m1(); }
|
|
|
|
fn m3() -> str {
|
2011-07-27 07:19:39 -05:00
|
|
|
let s1: str = self.m2();
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (s1 == "foo.m1");
|
|
|
|
obj bar() {
|
|
|
|
fn m1() -> str { ret "bar.m1"; }
|
|
|
|
fn m2() -> str { ret self.m1(); }
|
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
let b = bar();
|
|
|
|
let s3: str = b.m2();
|
|
|
|
let s4: str = self.m2();
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (s4 == "foo.m1");
|
|
|
|
ret s3;
|
|
|
|
}
|
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
let a = foo();
|
|
|
|
let s1: str = a.m1();
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (s1 == "foo.m1");
|
2011-07-27 07:19:39 -05:00
|
|
|
let s2: str = a.m2();
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (s2 == "foo.m1");
|
2011-07-27 07:19:39 -05:00
|
|
|
let s3: str = a.m3();
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (s3 == "bar.m1");
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|