diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index f5757f56bee..d9d48914c07 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -48,7 +48,7 @@ type env = @rec(session::session sess, @hashmap[str, int] crate_cache, vec[str] library_search_paths, - mutable int next_crate_num); + mutable ast::crate_num next_crate_num); fn visit_view_item(env e, &@ast::view_item i) { alt (i.node) { @@ -210,7 +210,7 @@ fn get_metadata_section(str filename) -> option::t[vec[u8]] { ret option::none[vec[u8]]; } -fn load_library_crate(&session::session sess, span span, int cnum, +fn load_library_crate(&session::session sess, span span, ast::crate_num cnum, &ast::ident ident, &(@ast::meta_item)[] metas, &vec[str] library_search_paths) { alt (find_library_crate(sess, ident, metas, library_search_paths)) { diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs index 80690a46263..1ddb378dab3 100644 --- a/src/comp/metadata/cstore.rs +++ b/src/comp/metadata/cstore.rs @@ -11,7 +11,7 @@ type crate_metadata = rec(str name, vec[u8] data); // Map from node_id's of local use statements to crate numbers type use_crate_map = map::hashmap[ast::node_id, ast::crate_num]; -type cstore = @rec(map::hashmap[int, crate_metadata] metas, +type cstore = @rec(map::hashmap[ast::crate_num, crate_metadata] metas, use_crate_map use_crate_map, mutable vec[str] used_crate_files, mutable vec[str] used_libraries, @@ -27,15 +27,15 @@ fn mk_cstore() -> cstore { mutable used_link_args = []); } -fn get_crate_data(&cstore cstore, int cnum) -> crate_metadata { +fn get_crate_data(&cstore cstore, ast::crate_num cnum) -> crate_metadata { ret cstore.metas.get(cnum); } -fn set_crate_data(&cstore cstore, int cnum, &crate_metadata data) { +fn set_crate_data(&cstore cstore, ast::crate_num cnum, &crate_metadata data) { cstore.metas.insert(cnum, data); } -fn have_crate_data(&cstore cstore, int cnum) -> bool { +fn have_crate_data(&cstore cstore, ast::crate_num cnum) -> bool { ret cstore.metas.contains_key(cnum); } @@ -72,7 +72,8 @@ fn get_used_link_args(&cstore cstore) -> vec[str] { ret cstore.used_link_args; } -fn add_use_stmt_cnum(&cstore cstore, ast::node_id use_id, int cnum) { +fn add_use_stmt_cnum(&cstore cstore, ast::node_id use_id, + ast::crate_num cnum) { cstore.use_crate_map.insert(use_id, cnum); } diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index 3e9d3a82cc7..91e97c8d835 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -82,8 +82,9 @@ fn variant_tag_id(&ebml::doc d) -> ast::def_id { ret parse_def_id(ebml::doc_data(tagdoc)); } -fn item_type(&ebml::doc item, int this_cnum, ty::ctxt tcx) -> ty::t { - fn parse_external_def_id(int this_cnum, str s) -> ast::def_id { +fn item_type(&ebml::doc item, ast::crate_num this_cnum, + ty::ctxt tcx) -> ty::t { + fn parse_external_def_id(ast::crate_num this_cnum, str s) -> ast::def_id { // FIXME: This is completely wrong when linking against a crate // that, in turn, links against another crate. We need a mapping // from crate ID to crate "meta" attributes as part of the crate @@ -107,7 +108,8 @@ fn item_ty_param_count(&ebml::doc item) -> uint { ret ty_param_count; } -fn tag_variant_ids(&ebml::doc item, int this_cnum) -> vec[ast::def_id] { +fn tag_variant_ids(&ebml::doc item, + ast::crate_num this_cnum) -> vec[ast::def_id] { let vec[ast::def_id] ids = []; auto v = tag_items_data_item_variant; for each (ebml::doc p in ebml::tagged_docs(item, v)) { @@ -136,15 +138,16 @@ fn resolve_path(vec[ast::ident] path, vec[u8] data) -> vec[ast::def_id] { } // Crate metadata queries -fn lookup_defs(session::session sess, int cnum, vec[ast::ident] path) -> - vec[ast::def] { +fn lookup_defs(session::session sess, ast::crate_num cnum, + vec[ast::ident] path) -> vec[ast::def] { auto data = cstore::get_crate_data(sess.get_cstore(), cnum).data; ret vec::map(bind lookup_def(cnum, data, _), resolve_path(path, data)); } // FIXME doesn't yet handle re-exported externals -fn lookup_def(int cnum, vec[u8] data, &ast::def_id did_) -> ast::def { +fn lookup_def(ast::crate_num cnum, vec[u8] data, + &ast::def_id did_) -> ast::def { auto item = lookup_item(did_._1, data); auto kind_ch = item_kind(item); auto did = tup(cnum, did_._1);