rustc: middle: move Export and ExportMap from resolve to def.
This commit is contained in:
parent
10a862d4f4
commit
d9504d4a47
6 changed files with 26 additions and 26 deletions
|
@ -21,10 +21,10 @@ use metadata::common::*;
|
|||
use metadata::cstore;
|
||||
use metadata::decoder;
|
||||
use metadata::tyencode;
|
||||
use middle::def;
|
||||
use middle::ty::{lookup_item_type};
|
||||
use middle::ty::{mod, Ty};
|
||||
use middle::stability;
|
||||
use middle;
|
||||
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
|
||||
|
||||
use serialize::Encodable;
|
||||
|
@ -66,7 +66,7 @@ pub type EncodeInlinedItem<'a> = |ecx: &EncodeContext,
|
|||
pub struct EncodeParams<'a, 'tcx: 'a> {
|
||||
pub diag: &'a SpanHandler,
|
||||
pub tcx: &'a ty::ctxt<'tcx>,
|
||||
pub reexports: &'a middle::resolve::ExportMap,
|
||||
pub reexports: &'a def::ExportMap,
|
||||
pub item_symbols: &'a RefCell<NodeMap<String>>,
|
||||
pub link_meta: &'a LinkMeta,
|
||||
pub cstore: &'a cstore::CStore,
|
||||
|
@ -77,7 +77,7 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
|
|||
pub struct EncodeContext<'a, 'tcx: 'a> {
|
||||
pub diag: &'a SpanHandler,
|
||||
pub tcx: &'a ty::ctxt<'tcx>,
|
||||
pub reexports: &'a middle::resolve::ExportMap,
|
||||
pub reexports: &'a def::ExportMap,
|
||||
pub item_symbols: &'a RefCell<NodeMap<String>>,
|
||||
pub link_meta: &'a LinkMeta,
|
||||
pub cstore: &'a cstore::CStore,
|
||||
|
@ -379,7 +379,7 @@ fn encode_path<PI: Iterator<PathElem>>(rbml_w: &mut Encoder, path: PI) {
|
|||
}
|
||||
|
||||
fn encode_reexported_static_method(rbml_w: &mut Encoder,
|
||||
exp: &middle::resolve::Export,
|
||||
exp: &def::Export,
|
||||
method_def_id: DefId,
|
||||
method_name: ast::Name) {
|
||||
debug!("(encode reexported static method) {}::{}",
|
||||
|
@ -398,7 +398,7 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
|
|||
|
||||
fn encode_reexported_static_base_methods(ecx: &EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
exp: &middle::resolve::Export)
|
||||
exp: &def::Export)
|
||||
-> bool {
|
||||
let impl_items = ecx.tcx.impl_items.borrow();
|
||||
match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) {
|
||||
|
@ -428,7 +428,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
|
|||
|
||||
fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
exp: &middle::resolve::Export)
|
||||
exp: &def::Export)
|
||||
-> bool {
|
||||
match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
|
||||
Some(trait_items) => {
|
||||
|
@ -449,7 +449,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
|
|||
fn encode_reexported_static_methods(ecx: &EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
mod_path: PathElems,
|
||||
exp: &middle::resolve::Export) {
|
||||
exp: &def::Export) {
|
||||
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
|
||||
let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
|
||||
let (mut a, mut b) = (path, mod_path.clone());
|
||||
|
|
|
@ -61,6 +61,15 @@ pub enum Def {
|
|||
|
||||
// Definition mapping
|
||||
pub type DefMap = RefCell<NodeMap<Def>>;
|
||||
// This is the replacement export map. It maps a module to all of the exports
|
||||
// within.
|
||||
pub type ExportMap = NodeMap<Vec<Export>>;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Export {
|
||||
pub name: ast::Name, // The name of the target.
|
||||
pub def_id: ast::DefId, // The definition of the target.
|
||||
}
|
||||
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub enum MethodProvenance {
|
||||
|
|
|
@ -29,7 +29,7 @@ use syntax::codemap::Span;
|
|||
use syntax::parse::token;
|
||||
use syntax::visit::{mod, Visitor};
|
||||
|
||||
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap);
|
||||
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a def::ExportMap);
|
||||
|
||||
/// A set of AST nodes exported by the crate.
|
||||
pub type ExportedItems = NodeSet;
|
||||
|
@ -136,7 +136,7 @@ impl<'v> Visitor<'v> for ParentVisitor {
|
|||
|
||||
struct EmbargoVisitor<'a, 'tcx: 'a> {
|
||||
tcx: &'a ty::ctxt<'tcx>,
|
||||
export_map: &'a resolve::ExportMap,
|
||||
export_map: &'a def::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
|
||||
|
@ -1520,7 +1520,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: &ty::ctxt,
|
||||
export_map: &resolve::ExportMap,
|
||||
export_map: &def::ExportMap,
|
||||
external_exports: resolve::ExternalExports,
|
||||
last_private_map: resolve::LastPrivateMap)
|
||||
-> (ExportedItems, PublicItems) {
|
||||
|
|
|
@ -93,15 +93,6 @@ struct BindingInfo {
|
|||
// Map from the name in a pattern to its binding mode.
|
||||
type BindingMap = HashMap<Name, BindingInfo>;
|
||||
|
||||
// This is the replacement export map. It maps a module to all of the exports
|
||||
// within.
|
||||
pub type ExportMap = NodeMap<Vec<Export>>;
|
||||
|
||||
pub struct Export {
|
||||
pub name: Name, // The name of the target.
|
||||
pub def_id: DefId, // The definition of the target.
|
||||
}
|
||||
|
||||
// This set contains all exported definitions from external crates. The set does
|
||||
// not contain any entries from local crates.
|
||||
pub type ExternalExports = DefIdSet;
|
||||
|
|
|
@ -46,7 +46,7 @@ use lint;
|
|||
use metadata::csearch;
|
||||
use middle;
|
||||
use middle::const_eval;
|
||||
use middle::def::{mod, DefMap};
|
||||
use middle::def::{mod, DefMap, ExportMap};
|
||||
use middle::dependency_format;
|
||||
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem};
|
||||
use middle::lang_items::{FnOnceTraitLangItem, TyDescStructLangItem};
|
||||
|
@ -98,7 +98,7 @@ pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
|
|||
/// 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 export_map: middle::resolve::ExportMap,
|
||||
pub export_map: ExportMap,
|
||||
pub exported_items: middle::privacy::ExportedItems,
|
||||
pub public_items: middle::privacy::PublicItems,
|
||||
pub ty_cx: ty::ctxt<'tcx>,
|
||||
|
|
|
@ -13,7 +13,7 @@ use llvm::{ContextRef, ModuleRef, ValueRef, BuilderRef};
|
|||
use llvm::{TargetData};
|
||||
use llvm::mk_target_data;
|
||||
use metadata::common::LinkMeta;
|
||||
use middle::resolve;
|
||||
use middle::def::ExportMap;
|
||||
use middle::traits;
|
||||
use trans::adt;
|
||||
use trans::base;
|
||||
|
@ -61,7 +61,7 @@ pub struct SharedCrateContext<'tcx> {
|
|||
metadata_llmod: ModuleRef,
|
||||
metadata_llcx: ContextRef,
|
||||
|
||||
export_map: resolve::ExportMap,
|
||||
export_map: ExportMap,
|
||||
reachable: NodeSet,
|
||||
item_symbols: RefCell<NodeMap<String>>,
|
||||
link_meta: LinkMeta,
|
||||
|
@ -238,7 +238,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
|
|||
pub fn new(crate_name: &str,
|
||||
local_count: uint,
|
||||
tcx: ty::ctxt<'tcx>,
|
||||
export_map: resolve::ExportMap,
|
||||
export_map: ExportMap,
|
||||
symbol_hasher: Sha256,
|
||||
link_meta: LinkMeta,
|
||||
reachable: NodeSet)
|
||||
|
@ -329,7 +329,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
|
|||
self.metadata_llcx
|
||||
}
|
||||
|
||||
pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
|
||||
pub fn export_map<'a>(&'a self) -> &'a ExportMap {
|
||||
&self.export_map
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
|
|||
&self.local.item_vals
|
||||
}
|
||||
|
||||
pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
|
||||
pub fn export_map<'a>(&'a self) -> &'a ExportMap {
|
||||
&self.shared.export_map
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue