rustc: Parse, serialize, and deserialize trait inheritance

This commit is contained in:
Patrick Walton
2012-08-03 15:02:01 -07:00
parent a805a1fb37
commit b65dd9d090
13 changed files with 69 additions and 21 deletions

View File

@@ -231,7 +231,15 @@ fn map_item(i: @item, cx: ctx, v: vt) {
// only need to handle methods
do vec::iter(ms) |m| { map_method(d_id, p, m, cx); }
}
item_trait(tps, methods) {
item_trait(tps, traits, methods) {
// Map trait refs to their parent classes. This is
// so we can find the self_ty
for traits.each |p| {
cx.map.insert(p.ref_id, node_item(i, item_path));
// This is so we can look up the right things when
// encoding/decoding
cx.map.insert(p.impl_id, node_item(i, item_path));
}
for methods.each |tm| {
let id = ast_util::trait_method_to_ty_method(tm).id;
let d_id = ast_util::local_def(i.id);