Parse iface items and interface references in impl items.

The (temporary) syntax is

    iface seq<T> {
        fn len() -> uint;
        fn iter(f: block(T));
    }

    // The 'blah<T>' can be left of to default the name of the
    // impl to seq<T>. The 'of seq<T>' can be left off when
    // not implementing a named interface.
    impl blah<T> of seq<T> for [T] {
        fn len() -> uint { vec::len(self) }
        fn iter(f: block(T)) { for x in self { f(x); } }
    }
This commit is contained in:
Marijn Haverbeke 2011-12-20 16:33:55 +01:00
parent 9292744959
commit 057617c665
12 changed files with 209 additions and 139 deletions

View file

@ -490,7 +490,9 @@ tag item_ {
item_obj(_obj, [ty_param], /* constructor id */node_id);
item_res(fn_decl /* dtor */, [ty_param], blk,
node_id /* dtor id */, node_id /* ctor id */);
item_impl([ty_param], @ty /* self */, [@method]);
item_iface([ty_param], [ty_method]);
item_impl([ty_param], option::t<@ty> /* iface */,
@ty /* self */, [@method]);
}
type native_item =