Remove hir for imports

This commit is contained in:
Aleksey Kladov 2019-12-21 12:15:56 +01:00
parent 3ebf15c9b2
commit 67ba9072fa
5 changed files with 23 additions and 36 deletions

View file

@ -12,8 +12,8 @@ use hir_def::{
resolver::HasResolver,
type_ref::{Mutability, TypeRef},
AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId,
LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId,
TraitId, TypeAliasId, TypeParamId, UnionId,
LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId,
TypeParamId, UnionId,
};
use hir_expand::{
diagnostics::DiagnosticSink,
@ -180,13 +180,11 @@ impl Module {
}
/// Returns a `ModuleScope`: a set of items, visible in this module.
pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef, Option<Import>)> {
pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef)> {
db.crate_def_map(self.id.krate)[self.id.local_id]
.scope
.entries()
.map(|(name, res)| {
(name.clone(), res.def.into(), res.import.map(|id| Import { parent: self, id }))
})
.map(|(name, res)| (name.clone(), res.def.into()))
.collect()
}
@ -229,10 +227,10 @@ impl Module {
}
}
pub struct Import {
pub(crate) parent: Module,
pub(crate) id: LocalImportId,
}
// pub struct Import {
// pub(crate) parent: Module,
// pub(crate) id: LocalImportId,
// }
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct StructField {