aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/lower.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs
index 6f003bd66..1f8adc7eb 100644
--- a/crates/ra_hir/src/nameres/lower.rs
+++ b/crates/ra_hir/src/nameres/lower.rs
@@ -9,7 +9,7 @@ use rustc_hash::FxHashMap;
9 9
10use crate::{ 10use crate::{
11 SourceItemId, Path, ModuleSource, HirDatabase, Name, SourceFileItems, 11 SourceItemId, Path, ModuleSource, HirDatabase, Name, SourceFileItems,
12 HirFileId, MacroCallLoc, AsName, PerNs, DefKind, DefLoc, 12 HirFileId, MacroCallLoc, AsName, PerNs, DefKind, DefLoc, Function,
13 ModuleDef, Module, 13 ModuleDef, Module,
14}; 14};
15 15
@@ -149,7 +149,14 @@ impl LoweredModule {
149 let name = match item.kind() { 149 let name = match item.kind() {
150 ast::ModuleItemKind::StructDef(it) => it.name(), 150 ast::ModuleItemKind::StructDef(it) => it.name(),
151 ast::ModuleItemKind::EnumDef(it) => it.name(), 151 ast::ModuleItemKind::EnumDef(it) => it.name(),
152 ast::ModuleItemKind::FnDef(it) => it.name(), 152 ast::ModuleItemKind::FnDef(it) => {
153 if let Some(name) = it.name() {
154 let func = Function::from_ast(db, module, file_id, it);
155 self.declarations
156 .insert(name.as_name(), PerNs::values(func.into()));
157 }
158 return;
159 }
153 ast::ModuleItemKind::TraitDef(it) => it.name(), 160 ast::ModuleItemKind::TraitDef(it) => it.name(),
154 ast::ModuleItemKind::TypeDef(it) => it.name(), 161 ast::ModuleItemKind::TypeDef(it) => it.name(),
155 ast::ModuleItemKind::ImplBlock(_) => { 162 ast::ModuleItemKind::ImplBlock(_) => {
@@ -218,7 +225,7 @@ fn assign_def_id(
218impl DefKind { 225impl DefKind {
219 fn for_syntax_kind(kind: SyntaxKind) -> PerNs<DefKind> { 226 fn for_syntax_kind(kind: SyntaxKind) -> PerNs<DefKind> {
220 match kind { 227 match kind {
221 SyntaxKind::FN_DEF => PerNs::values(DefKind::Function), 228 SyntaxKind::FN_DEF => unreachable!(),
222 SyntaxKind::STRUCT_DEF => PerNs::both(DefKind::Struct, DefKind::StructCtor), 229 SyntaxKind::STRUCT_DEF => PerNs::both(DefKind::Struct, DefKind::StructCtor),
223 SyntaxKind::ENUM_DEF => PerNs::types(DefKind::Enum), 230 SyntaxKind::ENUM_DEF => PerNs::types(DefKind::Enum),
224 SyntaxKind::TRAIT_DEF => PerNs::types(DefKind::Trait), 231 SyntaxKind::TRAIT_DEF => PerNs::types(DefKind::Trait),