aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r--crates/ra_hir/src/code_model.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index e6768ea0b..fca3a2950 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -12,8 +12,8 @@ use hir_def::{
12 resolver::HasResolver, 12 resolver::HasResolver,
13 type_ref::{Mutability, TypeRef}, 13 type_ref::{Mutability, TypeRef},
14 AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, 14 AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId,
15 LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, 15 LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId,
16 TypeParamId, UnionId, 16 TraitId, TypeAliasId, TypeParamId, UnionId,
17}; 17};
18use hir_expand::{ 18use hir_expand::{
19 diagnostics::DiagnosticSink, 19 diagnostics::DiagnosticSink,
@@ -180,11 +180,13 @@ impl Module {
180 } 180 }
181 181
182 /// Returns a `ModuleScope`: a set of items, visible in this module. 182 /// Returns a `ModuleScope`: a set of items, visible in this module.
183 pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef)> { 183 pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef, Option<Import>)> {
184 db.crate_def_map(self.id.krate)[self.id.local_id] 184 db.crate_def_map(self.id.krate)[self.id.local_id]
185 .scope 185 .scope
186 .entries() 186 .entries()
187 .map(|(name, res)| (name.clone(), res.def.into())) 187 .map(|(name, res)| {
188 (name.clone(), res.def.into(), res.import.map(|id| Import { parent: self, id }))
189 })
188 .collect() 190 .collect()
189 } 191 }
190 192
@@ -227,10 +229,10 @@ impl Module {
227 } 229 }
228} 230}
229 231
230// pub struct Import { 232pub struct Import {
231// pub(crate) parent: Module, 233 pub(crate) parent: Module,
232// pub(crate) id: LocalImportId, 234 pub(crate) id: LocalImportId,
233// } 235}
234 236
235#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 237#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
236pub struct StructField { 238pub struct StructField {