pub struct EncodeParams<'a, 'tcx: 'a> {
pub diag: &'a SpanHandler,
pub tcx: &'a ty::ctxt<'tcx>,
- pub reexports2: &'a middle::resolve::ExportMap2,
+ pub reexports: &'a middle::resolve::ExportMap,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
pub struct EncodeContext<'a, 'tcx: 'a> {
pub diag: &'a SpanHandler,
pub tcx: &'a ty::ctxt<'tcx>,
- pub reexports2: &'a middle::resolve::ExportMap2,
+ pub reexports: &'a middle::resolve::ExportMap,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
}
fn encode_reexported_static_method(rbml_w: &mut Encoder,
- exp: &middle::resolve::Export2,
+ exp: &middle::resolve::Export,
method_def_id: DefId,
method_name: ast::Name) {
debug!("(encode reexported static method) {}::{}",
fn encode_reexported_static_base_methods(ecx: &EncodeContext,
rbml_w: &mut Encoder,
- exp: &middle::resolve::Export2)
+ exp: &middle::resolve::Export)
-> bool {
let impl_items = ecx.tcx.impl_items.borrow();
match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) {
fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
rbml_w: &mut Encoder,
- exp: &middle::resolve::Export2)
+ exp: &middle::resolve::Export)
-> bool {
match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
Some(trait_items) => {
fn encode_reexported_static_methods(ecx: &EncodeContext,
rbml_w: &mut Encoder,
mod_path: PathElems,
- exp: &middle::resolve::Export2) {
+ exp: &middle::resolve::Export) {
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
let original_name = token::get_ident(item.ident);
id: NodeId,
path: PathElems) {
debug!("(encoding info for module) encoding reexports for {}", id);
- match ecx.reexports2.get(&id) {
+ match ecx.reexports.get(&id) {
Some(ref exports) => {
debug!("(encoding info for module) found reexports for {}", id);
for exp in exports.iter() {
item_symbols,
diag,
tcx,
- reexports2,
+ reexports,
cstore,
encode_inlined_item,
link_meta,
let ecx = EncodeContext {
diag: diag,
tcx: tcx,
- reexports2: reexports2,
+ reexports: reexports,
item_symbols: item_symbols,
link_meta: link_meta,
cstore: cstore,
use syntax::parse::token;
use syntax::visit::{mod, Visitor};
-type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
+type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap);
/// A set of AST nodes exported by the crate.
pub type ExportedItems = NodeSet;
struct EmbargoVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
- exp_map2: &'a resolve::ExportMap2,
+ export_map: &'a resolve::ExportMap,
// This flag is an indicator of whether the previous item in the
// hierarchical chain was exported or not. This is the indicator of whether
// 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[id].iter() {
+ assert!(self.export_map.contains_key(&id), "wut {}", id);
+ for export in self.export_map[id].iter() {
if is_local(export.def_id) {
self.reexports.insert(export.def_id.node);
}
}
pub fn check_crate(tcx: &ty::ctxt,
- exp_map2: &resolve::ExportMap2,
+ export_map: &resolve::ExportMap,
external_exports: resolve::ExternalExports,
last_private_map: resolve::LastPrivateMap)
-> (ExportedItems, PublicItems) {
exported_items: NodeSet::new(),
public_items: NodeSet::new(),
reexports: NodeSet::new(),
- exp_map2: exp_map2,
+ export_map: export_map,
prev_exported: true,
prev_public: true,
};
type BindingMap = HashMap<Name, BindingInfo>;
// Trait method resolution
-pub type TraitMap = NodeMap<Vec<DefId> >;
+pub type TraitMap = NodeMap<Vec<DefId>>;
// This is the replacement export map. It maps a module to all of the exports
// within.
-pub type ExportMap2 = NodeMap<Vec<Export2>>;
+pub type ExportMap = NodeMap<Vec<Export>>;
-pub struct Export2 {
+pub struct Export {
pub name: String, // The name of the target.
pub def_id: DefId, // The definition of the target.
}
freevars: RefCell<FreevarMap>,
freevars_seen: RefCell<NodeMap<NodeSet>>,
capture_mode_map: CaptureModeMap,
- export_map2: ExportMap2,
+ export_map: ExportMap,
trait_map: TraitMap,
external_exports: ExternalExports,
last_private: LastPrivateMap,
freevars: RefCell::new(NodeMap::new()),
freevars_seen: RefCell::new(NodeMap::new()),
capture_mode_map: NodeMap::new(),
- export_map2: NodeMap::new(),
+ export_map: NodeMap::new(),
trait_map: NodeMap::new(),
used_imports: HashSet::new(),
used_crates: HashSet::new(),
}
fn record_exports_for_module(&mut self, module_: &Module) {
- let mut exports2 = Vec::new();
+ let mut exports = Vec::new();
- self.add_exports_for_module(&mut exports2, module_);
+ self.add_exports_for_module(&mut exports, module_);
match module_.def_id.get() {
Some(def_id) => {
- self.export_map2.insert(def_id.node, exports2);
+ self.export_map.insert(def_id.node, exports);
debug!("(computing exports) writing exports for {} (some)",
def_id.node);
}
}
fn add_exports_of_namebindings(&mut self,
- exports2: &mut Vec<Export2> ,
+ exports: &mut Vec<Export>,
name: Name,
namebindings: &NameBindings,
ns: Namespace) {
let name = token::get_name(name);
debug!("(computing exports) YES: export '{}' => {}",
name, d.def_id());
- exports2.push(Export2 {
+ exports.push(Export {
name: name.get().to_string(),
def_id: d.def_id()
});
}
fn add_exports_for_module(&mut self,
- exports2: &mut Vec<Export2> ,
+ exports: &mut Vec<Export>,
module_: &Module) {
for (name, importresolution) in module_.import_resolutions.borrow().iter() {
if !importresolution.is_public {
Some(target) => {
debug!("(computing exports) maybe export '{}'",
token::get_name(*name));
- self.add_exports_of_namebindings(exports2,
+ self.add_exports_of_namebindings(exports,
*name,
&*target.bindings,
ns)
pub def_map: DefMap,
pub freevars: RefCell<FreevarMap>,
pub capture_mode_map: RefCell<CaptureModeMap>,
- pub exp_map2: ExportMap2,
+ pub export_map: ExportMap,
pub trait_map: TraitMap,
pub external_exports: ExternalExports,
pub last_private_map: LastPrivateMap,
def_map: resolver.def_map,
freevars: resolver.freevars,
capture_mode_map: RefCell::new(resolver.capture_mode_map),
- exp_map2: resolver.export_map2,
+ export_map: resolver.export_map,
trait_map: resolver.trait_map,
external_exports: resolver.external_exports,
last_private_map: resolver.last_private,
/// The complete set of all analyses described in this module. This is
/// produced by the driver and fed to trans and later passes.
pub struct CrateAnalysis<'tcx> {
- pub exp_map2: middle::resolve::ExportMap2,
+ pub export_map: middle::resolve::ExportMap,
pub exported_items: middle::privacy::ExportedItems,
pub public_items: middle::privacy::PublicItems,
pub ty_cx: ty::ctxt<'tcx>,
def_map,
freevars,
capture_mode_map,
- exp_map2,
+ export_map,
trait_map,
external_exports,
last_private_map
let maps = (external_exports, last_private_map);
let (exported_items, public_items) =
time(time_passes, "privacy checking", maps, |(a, b)|
- middle::privacy::check_crate(&ty_cx, &exp_map2, a, b));
+ middle::privacy::check_crate(&ty_cx, &export_map, a, b));
time(time_passes, "intrinsic checking", (), |_|
middle::intrinsicck::check_crate(&ty_cx));
lint::check_crate(&ty_cx, &exported_items));
ty::CrateAnalysis {
- exp_map2: exp_map2,
+ export_map: export_map,
ty_cx: ty_cx,
exported_items: exported_items,
public_items: public_items,
encoder::EncodeParams {
diag: cx.sess().diagnostic(),
tcx: cx.tcx(),
- reexports2: cx.exp_map2(),
+ reexports: cx.export_map(),
item_symbols: cx.item_symbols(),
link_meta: cx.link_meta(),
cstore: &cx.sess().cstore,
pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
-> (ty::ctxt<'tcx>, CrateTranslation) {
- let ty::CrateAnalysis { ty_cx: tcx, exp_map2, reachable, name, .. } = analysis;
+ let ty::CrateAnalysis { ty_cx: tcx, export_map, reachable, name, .. } = analysis;
let krate = tcx.map.krate();
// Before we touch LLVM, make sure that multithreading is enabled.
let shared_ccx = SharedCrateContext::new(link_meta.crate_name.as_slice(),
codegen_units,
tcx,
- exp_map2,
+ export_map,
Sha256::new(),
link_meta.clone(),
reachable);
metadata_llmod: ModuleRef,
metadata_llcx: ContextRef,
- exp_map2: resolve::ExportMap2,
+ export_map: resolve::ExportMap,
reachable: NodeSet,
item_symbols: RefCell<NodeMap<String>>,
link_meta: LinkMeta,
pub fn new(crate_name: &str,
local_count: uint,
tcx: ty::ctxt<'tcx>,
- emap2: resolve::ExportMap2,
+ export_map: resolve::ExportMap,
symbol_hasher: Sha256,
link_meta: LinkMeta,
reachable: NodeSet)
local_ccxs: Vec::with_capacity(local_count),
metadata_llmod: metadata_llmod,
metadata_llcx: metadata_llcx,
- exp_map2: emap2,
+ export_map: export_map,
reachable: reachable,
item_symbols: RefCell::new(NodeMap::new()),
link_meta: link_meta,
self.metadata_llcx
}
- pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
- &self.exp_map2
+ pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
+ &self.export_map
}
pub fn reachable<'a>(&'a self) -> &'a NodeSet {
&self.local.item_vals
}
- pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
- &self.shared.exp_map2
+ pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
+ &self.shared.export_map
}
pub fn reachable<'a>(&'a self) -> &'a NodeSet {