diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 15:56:38 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 15:56:38 +0000 |
commit | 566c8e321e89e5ff8996daa615cc47aea0012881 (patch) | |
tree | 58c2f4741b9305e840d41eb35eb8f4e7d5761fe2 /crates/ra_hir/src/nameres | |
parent | cefc5cbb4a95d2a473ea656efe603bef979b5c49 (diff) |
migrate enums to new id
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/lower.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs index b0c4aa819..435804e2d 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; | |||
10 | use crate::{ | 10 | use crate::{ |
11 | SourceItemId, Path, ModuleSource, HirDatabase, Name, SourceFileItems, | 11 | SourceItemId, Path, ModuleSource, HirDatabase, Name, SourceFileItems, |
12 | HirFileId, MacroCallLoc, AsName, PerNs, DefKind, DefLoc, Function, | 12 | HirFileId, MacroCallLoc, AsName, PerNs, DefKind, DefLoc, Function, |
13 | ModuleDef, Module, Struct, | 13 | ModuleDef, Module, Struct, Enum, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 16 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
@@ -155,7 +155,14 @@ impl LoweredModule { | |||
155 | } | 155 | } |
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | ast::ModuleItemKind::EnumDef(it) => it.name(), | 158 | ast::ModuleItemKind::EnumDef(it) => { |
159 | if let Some(name) = it.name() { | ||
160 | let e = Enum::from_ast(db, module, file_id, it); | ||
161 | let e: ModuleDef = e.into(); | ||
162 | self.declarations.insert(name.as_name(), PerNs::types(e)); | ||
163 | } | ||
164 | return; | ||
165 | } | ||
159 | ast::ModuleItemKind::FnDef(it) => { | 166 | ast::ModuleItemKind::FnDef(it) => { |
160 | if let Some(name) = it.name() { | 167 | if let Some(name) = it.name() { |
161 | let func = Function::from_ast(db, module, file_id, it); | 168 | let func = Function::from_ast(db, module, file_id, it); |
@@ -233,8 +240,8 @@ impl DefKind { | |||
233 | fn for_syntax_kind(kind: SyntaxKind) -> PerNs<DefKind> { | 240 | fn for_syntax_kind(kind: SyntaxKind) -> PerNs<DefKind> { |
234 | match kind { | 241 | match kind { |
235 | SyntaxKind::FN_DEF => unreachable!(), | 242 | SyntaxKind::FN_DEF => unreachable!(), |
236 | SyntaxKind::STRUCT_DEF => PerNs::both(DefKind::Struct, DefKind::StructCtor), | 243 | SyntaxKind::STRUCT_DEF => unreachable!(), |
237 | SyntaxKind::ENUM_DEF => PerNs::types(DefKind::Enum), | 244 | SyntaxKind::ENUM_DEF => unreachable!(), |
238 | SyntaxKind::TRAIT_DEF => PerNs::types(DefKind::Trait), | 245 | SyntaxKind::TRAIT_DEF => PerNs::types(DefKind::Trait), |
239 | SyntaxKind::TYPE_DEF => PerNs::types(DefKind::Type), | 246 | SyntaxKind::TYPE_DEF => PerNs::types(DefKind::Type), |
240 | SyntaxKind::CONST_DEF => PerNs::values(DefKind::Const), | 247 | SyntaxKind::CONST_DEF => PerNs::values(DefKind::Const), |