librustc: De-@mut
the export map
This commit is contained in:
parent
c5f07cfc1a
commit
f73dee17fc
@ -272,8 +272,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
|
||||
method_map, ty_cx));
|
||||
|
||||
let maps = (external_exports, last_private_map);
|
||||
let exported_items =
|
||||
time(time_passes, "privacy checking", maps, |(a, b)|
|
||||
let exported_items = time(time_passes, "privacy checking", maps, |(a, b)|
|
||||
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2,
|
||||
a, b, crate));
|
||||
|
||||
|
@ -556,7 +556,8 @@ fn encode_reexports(ecx: &EncodeContext,
|
||||
id: NodeId,
|
||||
path: &[ast_map::path_elt]) {
|
||||
debug!("(encoding info for module) encoding reexports for {}", id);
|
||||
match ecx.reexports2.find(&id) {
|
||||
let reexports2 = ecx.reexports2.borrow();
|
||||
match reexports2.get().find(&id) {
|
||||
Some(ref exports) => {
|
||||
debug!("(encoding info for module) found reexports for {}", id);
|
||||
for exp in exports.iter() {
|
||||
|
@ -293,8 +293,9 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> {
|
||||
// This code is here instead of in visit_item so that the
|
||||
// crate module gets processed as well.
|
||||
if self.prev_exported {
|
||||
assert!(self.exp_map2.contains_key(&id), "wut {:?}", id);
|
||||
for export in self.exp_map2.get(&id).iter() {
|
||||
let exp_map2 = self.exp_map2.borrow();
|
||||
assert!(exp_map2.get().contains_key(&id), "wut {:?}", id);
|
||||
for export in exp_map2.get().get(&id).iter() {
|
||||
if is_local(export.def_id) && export.reexport {
|
||||
self.reexports.insert(export.def_id.node);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ use syntax::opt_vec::OptVec;
|
||||
use syntax::visit;
|
||||
use syntax::visit::Visitor;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::uint;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::util;
|
||||
@ -50,7 +50,7 @@ pub type TraitMap = HashMap<NodeId,@mut ~[DefId]>;
|
||||
|
||||
// This is the replacement export map. It maps a module to all of the exports
|
||||
// within.
|
||||
pub type ExportMap2 = @mut HashMap<NodeId, ~[Export2]>;
|
||||
pub type ExportMap2 = @RefCell<HashMap<NodeId, ~[Export2]>>;
|
||||
|
||||
pub struct Export2 {
|
||||
name: @str, // The name of the target.
|
||||
@ -808,7 +808,7 @@ fn Resolver(session: Session,
|
||||
namespaces: ~[ TypeNS, ValueNS ],
|
||||
|
||||
def_map: @mut HashMap::new(),
|
||||
export_map2: @mut HashMap::new(),
|
||||
export_map2: @RefCell::new(HashMap::new()),
|
||||
trait_map: HashMap::new(),
|
||||
used_imports: HashSet::new(),
|
||||
external_exports: HashSet::new(),
|
||||
@ -3249,7 +3249,8 @@ impl Resolver {
|
||||
self.add_exports_for_module(&mut exports2, module_);
|
||||
match module_.def_id.get() {
|
||||
Some(def_id) => {
|
||||
self.export_map2.insert(def_id.node, exports2);
|
||||
let mut export_map2 = self.export_map2.borrow_mut();
|
||||
export_map2.get().insert(def_id.node, exports2);
|
||||
debug!("(computing exports) writing exports for {} (some)",
|
||||
def_id.node);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user