// except according to those terms.
use hir::def_id::DefId;
-use util::nodemap::NodeMap;
+use util::nodemap::{NodeMap, DefIdMap};
use syntax::ast;
use syntax::ext::base::MacroKind;
use syntax_pos::Span;
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum CtorKind {
- // Constructor function automatically created by a tuple struct/variant.
+ /// Constructor function automatically created by a tuple struct/variant.
Fn,
- // Constructor constant automatically created by a unit struct/variant.
+ /// Constructor constant automatically created by a unit struct/variant.
Const,
- // Unusable name in value namespace created by a struct variant.
+ /// Unusable name in value namespace created by a struct variant.
Fictive,
}
VariantCtor(DefId, CtorKind),
Method(DefId),
AssociatedConst(DefId),
- Local(DefId),
- Upvar(DefId, // def id of closed over local
+
+ Local(ast::NodeId),
+ Upvar(ast::NodeId, // node id of closed over local
usize, // index in the freevars list of the closure
ast::NodeId), // expr node that creates the closure
Label(ast::NodeId),
}
}
-// Definition mapping
+/// Definition mapping
pub type DefMap = NodeMap<PathResolution>;
-// This is the replacement export map. It maps a module to all of the exports
-// within.
-pub type ExportMap = NodeMap<Vec<Export>>;
+
+/// This is the replacement export map. It maps a module to all of the exports
+/// within.
+pub type ExportMap = DefIdMap<Vec<Export>>;
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
pub struct Export {
- pub ident: ast::Ident, // The name of the target.
- pub def: Def, // The definition of the target.
- pub span: Span, // The span of the target definition.
+ /// The name of the target.
+ pub ident: ast::Ident,
+ /// The definition of the target.
+ pub def: Def,
+ /// The span of the target definition.
+ pub span: Span,
}
impl CtorKind {
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) | Def::TyAlias(id) |
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
- Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id, ..) |
+ Def::AssociatedConst(id) | Def::Macro(id, ..) |
Def::GlobalAsm(id) => {
id
}
+ Def::Local(..) |
+ Def::Upvar(..) |
Def::Label(..) |
Def::PrimTy(..) |
Def::SelfTy(..) |
}
}
+ /// A human readable kind name
pub fn kind_name(&self) -> &'static str {
match *self {
Def::Fn(..) => "function",