librustc: De-@mut
cstore::CStore
This commit is contained in:
parent
79d97ca4aa
commit
43aee50798
@ -854,7 +854,7 @@ pub fn build_session_(sopts: @session::options,
|
||||
let target_cfg = build_target_config(sopts, demitter);
|
||||
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
|
||||
cm);
|
||||
let cstore = @mut CStore::new(token::get_ident_interner());
|
||||
let cstore = @CStore::new(token::get_ident_interner());
|
||||
let filesearch = filesearch::mk_filesearch(
|
||||
&sopts.maybe_sysroot,
|
||||
sopts.target_triple,
|
||||
|
@ -201,7 +201,7 @@ pub enum OutputStyle {
|
||||
pub struct Session_ {
|
||||
targ_cfg: @config,
|
||||
opts: @options,
|
||||
cstore: @mut metadata::cstore::CStore,
|
||||
cstore: @metadata::cstore::CStore,
|
||||
parse_sess: @mut ParseSess,
|
||||
codemap: @codemap::CodeMap,
|
||||
// For a library crate, this is always none
|
||||
|
@ -30,19 +30,19 @@ pub struct StaticMethodInfo {
|
||||
vis: ast::visibility,
|
||||
}
|
||||
|
||||
pub fn get_symbol(cstore: @mut cstore::CStore, def: ast::DefId) -> ~str {
|
||||
pub fn get_symbol(cstore: @cstore::CStore, def: ast::DefId) -> ~str {
|
||||
let cdata = cstore.get_crate_data(def.crate).data();
|
||||
return decoder::get_symbol(cdata, def.node);
|
||||
}
|
||||
|
||||
pub fn get_type_param_count(cstore: @mut cstore::CStore, def: ast::DefId)
|
||||
pub fn get_type_param_count(cstore: @cstore::CStore, def: ast::DefId)
|
||||
-> uint {
|
||||
let cdata = cstore.get_crate_data(def.crate).data();
|
||||
return decoder::get_type_param_count(cdata, def.node);
|
||||
}
|
||||
|
||||
/// Iterates over all the language items in the given crate.
|
||||
pub fn each_lang_item(cstore: @mut cstore::CStore,
|
||||
pub fn each_lang_item(cstore: @cstore::CStore,
|
||||
cnum: ast::CrateNum,
|
||||
f: |ast::NodeId, uint| -> bool)
|
||||
-> bool {
|
||||
@ -51,7 +51,7 @@ pub fn each_lang_item(cstore: @mut cstore::CStore,
|
||||
}
|
||||
|
||||
/// Iterates over each child of the given item.
|
||||
pub fn each_child_of_item(cstore: @mut cstore::CStore,
|
||||
pub fn each_child_of_item(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId,
|
||||
callback: |decoder::DefLike,
|
||||
ast::Ident,
|
||||
@ -68,7 +68,7 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore,
|
||||
}
|
||||
|
||||
/// Iterates over each top-level crate item.
|
||||
pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore,
|
||||
pub fn each_top_level_item_of_crate(cstore: @cstore::CStore,
|
||||
cnum: ast::CrateNum,
|
||||
callback: |decoder::DefLike,
|
||||
ast::Ident,
|
||||
@ -131,7 +131,7 @@ pub fn get_method(tcx: ty::ctxt, def: ast::DefId) -> ty::Method {
|
||||
decoder::get_method(tcx.cstore.intr, cdata, def.node, tcx)
|
||||
}
|
||||
|
||||
pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
|
||||
pub fn get_method_name_and_explicit_self(cstore: @cstore::CStore,
|
||||
def: ast::DefId)
|
||||
-> (ast::Ident, ast::explicit_self_)
|
||||
{
|
||||
@ -139,13 +139,13 @@ pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
|
||||
decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node)
|
||||
}
|
||||
|
||||
pub fn get_trait_method_def_ids(cstore: @mut cstore::CStore,
|
||||
pub fn get_trait_method_def_ids(cstore: @cstore::CStore,
|
||||
def: ast::DefId) -> ~[ast::DefId] {
|
||||
let cdata = cstore.get_crate_data(def.crate);
|
||||
decoder::get_trait_method_def_ids(cdata, def.node)
|
||||
}
|
||||
|
||||
pub fn get_item_variances(cstore: @mut cstore::CStore,
|
||||
pub fn get_item_variances(cstore: @cstore::CStore,
|
||||
def: ast::DefId) -> ty::ItemVariances {
|
||||
let cdata = cstore.get_crate_data(def.crate);
|
||||
decoder::get_item_variances(cdata, def.node)
|
||||
@ -165,27 +165,27 @@ pub fn get_supertraits(tcx: ty::ctxt, def: ast::DefId) -> ~[@ty::TraitRef] {
|
||||
decoder::get_supertraits(cdata, def.node, tcx)
|
||||
}
|
||||
|
||||
pub fn get_type_name_if_impl(cstore: @mut cstore::CStore, def: ast::DefId)
|
||||
pub fn get_type_name_if_impl(cstore: @cstore::CStore, def: ast::DefId)
|
||||
-> Option<ast::Ident> {
|
||||
let cdata = cstore.get_crate_data(def.crate);
|
||||
decoder::get_type_name_if_impl(cdata, def.node)
|
||||
}
|
||||
|
||||
pub fn get_static_methods_if_impl(cstore: @mut cstore::CStore,
|
||||
pub fn get_static_methods_if_impl(cstore: @cstore::CStore,
|
||||
def: ast::DefId)
|
||||
-> Option<~[StaticMethodInfo]> {
|
||||
let cdata = cstore.get_crate_data(def.crate);
|
||||
decoder::get_static_methods_if_impl(cstore.intr, cdata, def.node)
|
||||
}
|
||||
|
||||
pub fn get_item_attrs(cstore: @mut cstore::CStore,
|
||||
pub fn get_item_attrs(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId,
|
||||
f: |~[@ast::MetaItem]|) {
|
||||
let cdata = cstore.get_crate_data(def_id.crate);
|
||||
decoder::get_item_attrs(cdata, def_id.node, f)
|
||||
}
|
||||
|
||||
pub fn get_struct_fields(cstore: @mut cstore::CStore,
|
||||
pub fn get_struct_fields(cstore: @cstore::CStore,
|
||||
def: ast::DefId)
|
||||
-> ~[ty::field_ty] {
|
||||
let cdata = cstore.get_crate_data(def.crate);
|
||||
@ -247,7 +247,7 @@ pub fn get_impl_vtables(tcx: ty::ctxt,
|
||||
decoder::get_impl_vtables(cdata, def.node, tcx)
|
||||
}
|
||||
|
||||
pub fn get_impl_method(cstore: @mut cstore::CStore,
|
||||
pub fn get_impl_method(cstore: @cstore::CStore,
|
||||
def: ast::DefId,
|
||||
mname: ast::Ident)
|
||||
-> Option<ast::DefId> {
|
||||
@ -255,35 +255,35 @@ pub fn get_impl_method(cstore: @mut cstore::CStore,
|
||||
decoder::get_impl_method(cstore.intr, cdata, def.node, mname)
|
||||
}
|
||||
|
||||
pub fn get_item_visibility(cstore: @mut cstore::CStore,
|
||||
pub fn get_item_visibility(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId)
|
||||
-> ast::visibility {
|
||||
let cdata = cstore.get_crate_data(def_id.crate);
|
||||
decoder::get_item_visibility(cdata, def_id.node)
|
||||
}
|
||||
|
||||
pub fn get_native_libraries(cstore: @mut cstore::CStore,
|
||||
pub fn get_native_libraries(cstore: @cstore::CStore,
|
||||
crate_num: ast::CrateNum)
|
||||
-> ~[(cstore::NativeLibaryKind, ~str)] {
|
||||
let cdata = cstore.get_crate_data(crate_num);
|
||||
decoder::get_native_libraries(cdata)
|
||||
}
|
||||
|
||||
pub fn each_impl(cstore: @mut cstore::CStore,
|
||||
pub fn each_impl(cstore: @cstore::CStore,
|
||||
crate_num: ast::CrateNum,
|
||||
callback: |ast::DefId|) {
|
||||
let cdata = cstore.get_crate_data(crate_num);
|
||||
decoder::each_impl(cdata, callback)
|
||||
}
|
||||
|
||||
pub fn each_implementation_for_type(cstore: @mut cstore::CStore,
|
||||
pub fn each_implementation_for_type(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId,
|
||||
callback: |ast::DefId|) {
|
||||
let cdata = cstore.get_crate_data(def_id.crate);
|
||||
decoder::each_implementation_for_type(cdata, def_id.node, callback)
|
||||
}
|
||||
|
||||
pub fn each_implementation_for_trait(cstore: @mut cstore::CStore,
|
||||
pub fn each_implementation_for_trait(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId,
|
||||
callback: |ast::DefId|) {
|
||||
let cdata = cstore.get_crate_data(def_id.crate);
|
||||
@ -293,7 +293,7 @@ pub fn each_implementation_for_trait(cstore: @mut cstore::CStore,
|
||||
/// If the given def ID describes a method belonging to a trait (either a
|
||||
/// default method or an implementation of a trait method), returns the ID of
|
||||
/// the trait that the method belongs to. Otherwise, returns `None`.
|
||||
pub fn get_trait_of_method(cstore: @mut cstore::CStore,
|
||||
pub fn get_trait_of_method(cstore: @cstore::CStore,
|
||||
def_id: ast::DefId,
|
||||
tcx: ty::ctxt)
|
||||
-> Option<ast::DefId> {
|
||||
|
@ -99,7 +99,7 @@ impl CStore {
|
||||
decoder::get_crate_vers(cdata.data())
|
||||
}
|
||||
|
||||
pub fn set_crate_data(&mut self, cnum: ast::CrateNum, data: @crate_metadata) {
|
||||
pub fn set_crate_data(&self, cnum: ast::CrateNum, data: @crate_metadata) {
|
||||
let mut metas = self.metas.borrow_mut();
|
||||
metas.get().insert(cnum, data);
|
||||
}
|
||||
@ -116,7 +116,7 @@ impl CStore {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_used_crate_source(&mut self, src: CrateSource) {
|
||||
pub fn add_used_crate_source(&self, src: CrateSource) {
|
||||
let mut used_crate_sources = self.used_crate_sources.borrow_mut();
|
||||
if !used_crate_sources.get().contains(&src) {
|
||||
used_crate_sources.get().push(src);
|
||||
@ -135,7 +135,8 @@ impl CStore {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn add_used_library(&mut self, lib: ~str, kind: NativeLibaryKind) -> bool {
|
||||
pub fn add_used_library(&self, lib: ~str, kind: NativeLibaryKind)
|
||||
-> bool {
|
||||
assert!(!lib.is_empty());
|
||||
let mut used_libraries = self.used_libraries.borrow_mut();
|
||||
if used_libraries.get().iter().any(|&(ref x, _)| x == &lib) {
|
||||
@ -150,7 +151,7 @@ impl CStore {
|
||||
&self.used_libraries
|
||||
}
|
||||
|
||||
pub fn add_used_link_args(&mut self, args: &str) {
|
||||
pub fn add_used_link_args(&self, args: &str) {
|
||||
let mut used_link_args = self.used_link_args.borrow_mut();
|
||||
for s in args.split(' ') {
|
||||
used_link_args.get().push(s.to_owned());
|
||||
@ -161,7 +162,7 @@ impl CStore {
|
||||
&self.used_link_args
|
||||
}
|
||||
|
||||
pub fn add_extern_mod_stmt_cnum(&mut self,
|
||||
pub fn add_extern_mod_stmt_cnum(&self,
|
||||
emod_id: ast::NodeId,
|
||||
cnum: ast::CrateNum) {
|
||||
let mut extern_mod_crate_map = self.extern_mod_crate_map.borrow_mut();
|
||||
|
@ -63,7 +63,7 @@ pub struct EncodeParams<'a> {
|
||||
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
|
||||
non_inlineable_statics: &'a RefCell<HashSet<ast::NodeId>>,
|
||||
link_meta: &'a LinkMeta,
|
||||
cstore: @mut cstore::CStore,
|
||||
cstore: @cstore::CStore,
|
||||
encode_inlined_item: encode_inlined_item<'a>,
|
||||
reachable: @mut HashSet<ast::NodeId>,
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ struct ctxt_ {
|
||||
diag: @mut syntax::diagnostic::span_handler,
|
||||
interner: RefCell<HashMap<intern_key, ~t_box_>>,
|
||||
next_id: @mut uint,
|
||||
cstore: @mut metadata::cstore::CStore,
|
||||
cstore: @metadata::cstore::CStore,
|
||||
sess: session::Session,
|
||||
def_map: resolve::DefMap,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user