diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-23 16:50:36 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-23 16:50:36 +0000 |
commit | 335d64b1c25fc789c556abd51a72455d9f9ac5ad (patch) | |
tree | 393cb0a63eba938a3f3bb1ffa7150697b7e071ba /crates/ra_hir/src/nameres.rs | |
parent | 118e11e50b5f39aca88e2ed342e5d355d4f32c00 (diff) | |
parent | 59f830d3e8999691f5e3140cf45494fe7cc46ac4 (diff) |
Merge #613
613: assign DefIds when lowering r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 72791ed49..1d163edf7 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -21,7 +21,6 @@ use crate::nameres::lower::*; | |||
21 | use std::sync::Arc; | 21 | use std::sync::Arc; |
22 | 22 | ||
23 | use rustc_hash::{FxHashMap, FxHashSet}; | 23 | use rustc_hash::{FxHashMap, FxHashSet}; |
24 | use ra_syntax::SyntaxKind::*; | ||
25 | use ra_db::SourceRootId; | 24 | use ra_db::SourceRootId; |
26 | 25 | ||
27 | use crate::{ | 26 | use crate::{ |
@@ -235,27 +234,12 @@ where | |||
235 | } | 234 | } |
236 | } | 235 | } |
237 | // Populate explicitly declared items, except modules | 236 | // Populate explicitly declared items, except modules |
238 | for item in input.items.iter() { | 237 | for (name, &def_id) in input.declarations.iter() { |
239 | if item.kind == MODULE { | ||
240 | continue; | ||
241 | } | ||
242 | // depending on the item kind, the location can define something in | ||
243 | // the values namespace, the types namespace, or both | ||
244 | let kind = DefKind::for_syntax_kind(item.kind); | ||
245 | let def_id = kind.map(|k| { | ||
246 | let def_loc = DefLoc { | ||
247 | kind: k, | ||
248 | source_root_id: self.source_root, | ||
249 | module_id, | ||
250 | source_item_id: item.id, | ||
251 | }; | ||
252 | def_loc.id(self.db) | ||
253 | }); | ||
254 | let resolution = Resolution { | 238 | let resolution = Resolution { |
255 | def_id, | 239 | def_id, |
256 | import: None, | 240 | import: None, |
257 | }; | 241 | }; |
258 | module_items.items.insert(item.name.clone(), resolution); | 242 | module_items.items.insert(name.clone(), resolution); |
259 | } | 243 | } |
260 | 244 | ||
261 | // Populate modules | 245 | // Populate modules |