From 60a607d33f1c50acd0a4218da32abe35b2941e38 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 17:54:18 +0300 Subject: new struct id --- crates/ra_hir/src/nameres/lower.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/nameres') diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs index 1f8adc7eb..b0c4aa819 100644 --- a/crates/ra_hir/src/nameres/lower.rs +++ b/crates/ra_hir/src/nameres/lower.rs @@ -10,7 +10,7 @@ use rustc_hash::FxHashMap; use crate::{ SourceItemId, Path, ModuleSource, HirDatabase, Name, SourceFileItems, HirFileId, MacroCallLoc, AsName, PerNs, DefKind, DefLoc, Function, - ModuleDef, Module, + ModuleDef, Module, Struct, }; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -147,7 +147,14 @@ impl LoweredModule { item: &ast::ModuleItem, ) { let name = match item.kind() { - ast::ModuleItemKind::StructDef(it) => it.name(), + ast::ModuleItemKind::StructDef(it) => { + if let Some(name) = it.name() { + let s = Struct::from_ast(db, module, file_id, it); + let s: ModuleDef = s.into(); + self.declarations.insert(name.as_name(), PerNs::both(s, s)); + } + return; + } ast::ModuleItemKind::EnumDef(it) => it.name(), ast::ModuleItemKind::FnDef(it) => { if let Some(name) = it.name() { -- cgit v1.2.3