518dc52f85
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
26 lines
423 B
Rust
26 lines
423 B
Rust
use std;
|
|
|
|
fn main() {
|
|
|
|
obj a() {
|
|
fn foo() -> int { ret 2; }
|
|
fn bar() -> int { ret self.foo(); }
|
|
}
|
|
|
|
let my_a = a();
|
|
|
|
let my_b =
|
|
obj () {
|
|
fn baz() -> int { ret self.foo(); }
|
|
with
|
|
my_a
|
|
};
|
|
|
|
assert (my_a.foo() == 2);
|
|
assert (my_a.bar() == 2);
|
|
assert (my_b.foo() == 2);
|
|
assert (my_b.baz() == 2);
|
|
assert (my_b.bar() == 2);
|
|
|
|
}
|