Extend ast_map to know about method declarations in traits.

This commit is contained in:
Michael Sullivan
2012-08-02 15:52:25 -07:00
parent 97452c0ca1
commit 2fe299d1a5
7 changed files with 48 additions and 11 deletions

View File

@@ -2111,6 +2111,9 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
}
ast_map::node_ctor(nm, _, ct, _, pt) { (pt, nm, ct.span) }
ast_map::node_dtor(_, dtor, _, pt) {(pt, @~"drop", dtor.span)}
ast_map::node_trait_method(*) {
ccx.tcx.sess.bug(~"Can't monomorphize a trait method")
}
ast_map::node_expr(*) {
ccx.tcx.sess.bug(~"Can't monomorphize an expr")
}
@@ -2207,6 +2210,9 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
ast_map::node_expr(*) {
ccx.tcx.sess.bug(~"Can't monomorphize an expr")
}
ast_map::node_trait_method(*) {
ccx.tcx.sess.bug(~"Can't monomorphize a trait method")
}
ast_map::node_export(*) {
ccx.tcx.sess.bug(~"Can't monomorphize an export")
}
@@ -2418,7 +2424,7 @@ fn trans_local_var(cx: block, def: ast::def) -> local_var_result {
return {val: slf, kind: lv_owned};
}
_ {
cx.sess().unimpl(fmt!{"unsupported def type in trans_local_def: %?",
cx.sess().unimpl(fmt!{"unsupported def type in trans_local_var: %?",
def});
}
}

View File

@@ -185,6 +185,8 @@ fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
@vec::map(*vts, |d| resolve_vtable_in_fn_ctxt(fcx, d))
}
// Apply the typaram substitutions in the fn_ctxt to a vtable. This should
// eliminate any vtable_params.
fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, vt: typeck::vtable_origin)
-> typeck::vtable_origin {
alt vt {

View File

@@ -2759,6 +2759,10 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
ast_map::node_method(method, _, path) {
vec::append_one(*path, ast_map::path_name(method.ident))
}
ast_map::node_trait_method(trait_method, _, path) {
let method = ast_util::trait_method_to_ty_method(*trait_method);
vec::append_one(*path, ast_map::path_name(method.ident))
}
ast_map::node_variant(variant, _, path) {
vec::append_one(vec::init(*path),