diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-21 14:08:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-21 14:08:10 +0000 |
commit | df45f28fedab9b0620ea038849ec8e93c3b4ab26 (patch) | |
tree | 7025977c0333378cd209dc47c1d160c7cdef206a /crates/ra_hir/src/code_model.rs | |
parent | a1f4c988e47b7160b11070d18f50657b6fb9014c (diff) | |
parent | 973b5cf7e20842711d59a810b268796b26241382 (diff) |
Merge #2632
2632: Revert "Merge #2629" r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 18 |
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 | }; |
18 | use hir_expand::{ | 18 | use 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 { | 232 | pub 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)] |
236 | pub struct StructField { | 238 | pub struct StructField { |