rustc: Remove a user of tag_paths.

This commit breaks the item-printing functionality. It will return in a faster
form.
This commit is contained in:
Patrick Walton 2012-08-17 14:54:28 -07:00
parent eb834fdb81
commit 75d3e3c755
2 changed files with 11 additions and 31 deletions

View File

@ -96,7 +96,7 @@ fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> @~str {
fn set_crate_data(cstore: cstore, cnum: ast::crate_num,
data: crate_metadata) {
p(cstore).metas.insert(cnum, data);
do vec::iter(decoder::get_crate_module_paths(data.data)) |dp| {
do vec::iter(decoder::get_crate_module_paths(data)) |dp| {
let (did, path) = dp;
let d = {crate: cnum, node: did.node};
p(cstore).mod_path_map.insert(d, @path);

View File

@ -919,37 +919,18 @@ fn get_crate_vers(data: @~[u8]) -> @~str {
};
}
fn list_crate_items(bytes: @~[u8], md: ebml::doc, out: io::Writer) {
out.write_str(~"=Items=\n");
let items = ebml::get_doc(md, tag_items);
do iter_crate_items(bytes) |tag, path, did| {
// Don't print out any metadata info about intrinsics
if tag != tag_paths_foreign_path {
out.write_str(fmt!{"%s (%s)\n", path,
describe_def(items, did)});
}
fn iter_crate_items(cdata: cmd, proc: fn(~str, ast::def_id)) {
for each_path(cdata) |path_entry| {
match path_entry.def_like {
dl_impl(*) | dl_field => {}
dl_def(def) => {
proc(path_entry.path_string, ast_util::def_id_of_def(def))
}
}
}
out.write_str(~"\n");
}
fn iter_crate_items(bytes: @~[u8], proc: fn(uint, ~str, ast::def_id)) {
let md = ebml::doc(bytes);
let paths = ebml::get_doc(md, tag_paths);
let index = ebml::get_doc(paths, tag_index);
let bs = ebml::get_doc(index, tag_index_buckets);
for ebml::tagged_docs(bs, tag_index_buckets_bucket) |bucket| {
let et = tag_index_buckets_bucket_elt;
for ebml::tagged_docs(bucket, et) |elt| {
let data = read_path(elt);
let {tag:t, doc:def} = ebml::doc_at(bytes, data.pos);
let did_doc = ebml::get_doc(def, tag_def_id);
let did = ebml::with_doc_data(did_doc, |d| parse_def_id(d));
proc(t, data.path, did);
};
};
}
fn get_crate_module_paths(bytes: @~[u8]) -> ~[(ast::def_id, ~str)] {
fn get_crate_module_paths(cdata: cmd) -> ~[(ast::def_id, ~str)] {
fn mod_of_path(p: ~str) -> ~str {
str::connect(vec::init(str::split_str(p, ~"::")), ~"::")
}
@ -958,7 +939,7 @@ fn get_crate_module_paths(bytes: @~[u8]) -> ~[(ast::def_id, ~str)] {
// fowarded path due to renamed import or reexport
let mut res = ~[];
let mods = map::str_hash();
do iter_crate_items(bytes) |_tag, path, did| {
do iter_crate_items(cdata) |path, did| {
let m = mod_of_path(path);
if str::is_not_empty(m) {
// if m has a sub-item, it must be a module
@ -980,7 +961,6 @@ fn list_crate_metadata(bytes: @~[u8], out: io::Writer) {
let md = ebml::doc(bytes);
list_crate_attributes(md, hash, out);
list_crate_deps(bytes, out);
list_crate_items(bytes, md, out);
}
// Translates a def_id from an external crate to a def_id for the current