mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-28 23:53:55 +00:00
Extract various dependencies from metadata::decoder to metadata::csearch
This commit is contained in:
parent
7ae711fc03
commit
9ebb60d38b
@ -4,11 +4,15 @@ import middle::ty;
|
||||
import std::io;
|
||||
|
||||
fn get_symbol(session::session sess, ast::def_id def) -> str {
|
||||
decoder::get_symbol(sess, def)
|
||||
auto cnum = def._0;
|
||||
auto node_id = def._1;
|
||||
auto cstore = sess.get_cstore();
|
||||
auto cdata = cstore::get_crate_data(cstore, cnum).data;
|
||||
ret decoder::get_symbol(cdata, node_id);
|
||||
}
|
||||
|
||||
fn get_tag_variants(ty::ctxt ctx, ast::def_id def) -> ty::variant_info[] {
|
||||
decoder::get_tag_variants(ctx, def)
|
||||
fn get_tag_variants(ty::ctxt tcx, ast::def_id def) -> ty::variant_info[] {
|
||||
decoder::get_tag_variants(tcx, def)
|
||||
}
|
||||
|
||||
fn get_type(ty::ctxt tcx, ast::def_id def) -> ty::ty_param_count_and_ty {
|
||||
@ -16,12 +20,18 @@ fn get_type(ty::ctxt tcx, ast::def_id def) -> ty::ty_param_count_and_ty {
|
||||
}
|
||||
|
||||
fn get_type_param_count(ty::ctxt tcx, &ast::def_id def) -> uint {
|
||||
decoder::get_type_param_count(tcx, def)
|
||||
auto cnum = def._0;
|
||||
auto node_id = def._1;
|
||||
auto cstore = tcx.sess.get_cstore();
|
||||
auto cdata = cstore::get_crate_data(cstore, cnum).data;
|
||||
ret decoder::get_type_param_count(cdata, node_id);
|
||||
}
|
||||
|
||||
fn lookup_defs(session::session sess, ast::crate_num cnum,
|
||||
vec[ast::ident] path) -> vec[ast::def] {
|
||||
decoder::lookup_defs(sess, cnum, path)
|
||||
auto cstore = sess.get_cstore();
|
||||
auto cdata = cstore::get_crate_data(cstore, cnum).data;
|
||||
ret decoder::lookup_defs(cdata, cnum, path);
|
||||
}
|
||||
|
||||
fn get_crate_attributes(&vec[u8] data) -> ast::attribute[] {
|
||||
|
@ -138,9 +138,8 @@ fn resolve_path(vec[ast::ident] path, vec[u8] data) -> vec[ast::def_id] {
|
||||
}
|
||||
|
||||
// Crate metadata queries
|
||||
fn lookup_defs(session::session sess, ast::crate_num cnum,
|
||||
fn lookup_defs(&vec[u8] data, 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));
|
||||
}
|
||||
|
||||
@ -187,17 +186,12 @@ fn get_type(ty::ctxt tcx, ast::def_id def) -> ty::ty_param_count_and_ty {
|
||||
ret tup(tp_count, t);
|
||||
}
|
||||
|
||||
fn get_type_param_count(ty::ctxt tcx, &ast::def_id def) -> uint {
|
||||
auto data = cstore::get_crate_data(tcx.sess.get_cstore(),
|
||||
def._0).data;
|
||||
ret item_ty_param_count(lookup_item(def._1, data));
|
||||
fn get_type_param_count(&vec[u8] data, ast::node_id id) -> uint {
|
||||
ret item_ty_param_count(lookup_item(id, data));
|
||||
}
|
||||
|
||||
fn get_symbol(session::session sess, ast::def_id def) -> str {
|
||||
auto external_crate_id = def._0;
|
||||
auto data = cstore::get_crate_data(sess.get_cstore(),
|
||||
external_crate_id).data;
|
||||
ret item_symbol(lookup_item(def._1, data));
|
||||
fn get_symbol(&vec[u8] data, ast::node_id id) -> str {
|
||||
ret item_symbol(lookup_item(id, data));
|
||||
}
|
||||
|
||||
fn get_tag_variants(ty::ctxt tcx, ast::def_id def) -> ty::variant_info[] {
|
||||
|
Loading…
Reference in New Issue
Block a user