aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres/lower.rs')
-rw-r--r--crates/ra_hir/src/nameres/lower.rs31
1 files changed, 10 insertions, 21 deletions
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs
index 7e6e48ae0..7e9a3de2b 100644
--- a/crates/ra_hir/src/nameres/lower.rs
+++ b/crates/ra_hir/src/nameres/lower.rs
@@ -82,13 +82,9 @@ impl LoweredModule {
82 let mut source_map = ImportSourceMap::default(); 82 let mut source_map = ImportSourceMap::default();
83 let mut res = LoweredModule::default(); 83 let mut res = LoweredModule::default();
84 match source { 84 match source {
85 ModuleSource::SourceFile(it) => res.fill( 85 ModuleSource::SourceFile(it) => {
86 &mut source_map, 86 res.fill(&mut source_map, db, module, file_id, &mut it.items_with_macros())
87 db, 87 }
88 module,
89 file_id,
90 &mut it.items_with_macros(),
91 ),
92 ModuleSource::Module(it) => { 88 ModuleSource::Module(it) => {
93 if let Some(item_list) = it.item_list() { 89 if let Some(item_list) = it.item_list() {
94 res.fill( 90 res.fill(
@@ -121,10 +117,8 @@ impl LoweredModule {
121 } 117 }
122 ast::ItemOrMacro::Macro(macro_call) => { 118 ast::ItemOrMacro::Macro(macro_call) => {
123 let item_id = file_items.id_of_unchecked(macro_call.syntax()); 119 let item_id = file_items.id_of_unchecked(macro_call.syntax());
124 let loc = MacroCallLoc { 120 let loc =
125 module, 121 MacroCallLoc { module, source_item_id: SourceItemId { file_id, item_id } };
126 source_item_id: SourceItemId { file_id, item_id },
127 };
128 let id = loc.id(db); 122 let id = loc.id(db);
129 let file_id = HirFileId::from(id); 123 let file_id = HirFileId::from(id);
130 //FIXME: expand recursively 124 //FIXME: expand recursively
@@ -163,22 +157,19 @@ impl LoweredModule {
163 ast::ModuleItemKind::FnDef(it) => { 157 ast::ModuleItemKind::FnDef(it) => {
164 if let Some(name) = it.name() { 158 if let Some(name) = it.name() {
165 let func = Function { id: ctx.to_def(it) }; 159 let func = Function { id: ctx.to_def(it) };
166 self.declarations 160 self.declarations.insert(name.as_name(), PerNs::values(func.into()));
167 .insert(name.as_name(), PerNs::values(func.into()));
168 } 161 }
169 } 162 }
170 ast::ModuleItemKind::TraitDef(it) => { 163 ast::ModuleItemKind::TraitDef(it) => {
171 if let Some(name) = it.name() { 164 if let Some(name) = it.name() {
172 let t = Trait { id: ctx.to_def(it) }; 165 let t = Trait { id: ctx.to_def(it) };
173 self.declarations 166 self.declarations.insert(name.as_name(), PerNs::types(t.into()));
174 .insert(name.as_name(), PerNs::types(t.into()));
175 } 167 }
176 } 168 }
177 ast::ModuleItemKind::TypeDef(it) => { 169 ast::ModuleItemKind::TypeDef(it) => {
178 if let Some(name) = it.name() { 170 if let Some(name) = it.name() {
179 let t = Type { id: ctx.to_def(it) }; 171 let t = Type { id: ctx.to_def(it) };
180 self.declarations 172 self.declarations.insert(name.as_name(), PerNs::types(t.into()));
181 .insert(name.as_name(), PerNs::types(t.into()));
182 } 173 }
183 } 174 }
184 ast::ModuleItemKind::ImplBlock(_) => { 175 ast::ModuleItemKind::ImplBlock(_) => {
@@ -207,15 +198,13 @@ impl LoweredModule {
207 ast::ModuleItemKind::ConstDef(it) => { 198 ast::ModuleItemKind::ConstDef(it) => {
208 if let Some(name) = it.name() { 199 if let Some(name) = it.name() {
209 let c = Const { id: ctx.to_def(it) }; 200 let c = Const { id: ctx.to_def(it) };
210 self.declarations 201 self.declarations.insert(name.as_name(), PerNs::values(c.into()));
211 .insert(name.as_name(), PerNs::values(c.into()));
212 } 202 }
213 } 203 }
214 ast::ModuleItemKind::StaticDef(it) => { 204 ast::ModuleItemKind::StaticDef(it) => {
215 if let Some(name) = it.name() { 205 if let Some(name) = it.name() {
216 let s = Static { id: ctx.to_def(it) }; 206 let s = Static { id: ctx.to_def(it) };
217 self.declarations 207 self.declarations.insert(name.as_name(), PerNs::values(s.into()));
218 .insert(name.as_name(), PerNs::values(s.into()));
219 } 208 }
220 } 209 }
221 ast::ModuleItemKind::Module(_) => { 210 ast::ModuleItemKind::Module(_) => {