Remove imports from hir

This commit is contained in:
Aleksey Kladov 2019-12-21 15:17:10 +01:00
parent 973b5cf7e2
commit 4e0168ec14
8 changed files with 22 additions and 45 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,11 +227,6 @@ impl Module {
}
}
pub struct Import {
pub(crate) parent: Module,
pub(crate) id: LocalImportId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct StructField {
pub(crate) parent: VariantDef,