aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ids.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r--crates/ra_hir/src/ids.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 0aa687a08..db0107e53 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -3,7 +3,7 @@ use ra_syntax::{TreePtr, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast};
3use ra_arena::{Arena, RawId, impl_arena_id}; 3use ra_arena::{Arena, RawId, impl_arena_id};
4 4
5use crate::{ 5use crate::{
6 HirDatabase, PerNs, Def, Function, Struct, Enum, ImplBlock, Crate, 6 HirDatabase, PerNs, Def, Function, Struct, Enum, EnumVariant, ImplBlock, Crate,
7 module_tree::ModuleId, 7 module_tree::ModuleId,
8}; 8};
9 9
@@ -145,6 +145,7 @@ pub(crate) enum DefKind {
145 Function, 145 Function,
146 Struct, 146 Struct,
147 Enum, 147 Enum,
148 EnumVariant,
148 Item, 149 Item,
149 150
150 StructCtor, 151 StructCtor,
@@ -170,10 +171,8 @@ impl DefId {
170 let struct_def = Struct::new(self); 171 let struct_def = Struct::new(self);
171 Def::Struct(struct_def) 172 Def::Struct(struct_def)
172 } 173 }
173 DefKind::Enum => { 174 DefKind::Enum => Def::Enum(Enum::new(self)),
174 let enum_def = Enum::new(self); 175 DefKind::EnumVariant => Def::EnumVariant(EnumVariant::new(self)),
175 Def::Enum(enum_def)
176 }
177 DefKind::StructCtor => Def::Item, 176 DefKind::StructCtor => Def::Item,
178 DefKind::Item => Def::Item, 177 DefKind::Item => Def::Item,
179 }; 178 };
@@ -258,7 +257,9 @@ impl SourceFileItems {
258 // change parent's id. This means that, say, adding a new function to a 257 // change parent's id. This means that, say, adding a new function to a
259 // trait does not chage ids of top-level items, which helps caching. 258 // trait does not chage ids of top-level items, which helps caching.
260 bfs(source_file.syntax(), |it| { 259 bfs(source_file.syntax(), |it| {
261 if let Some(module_item) = ast::ModuleItem::cast(it) { 260 if let Some(enum_variant) = ast::EnumVariant::cast(it) {
261 self.alloc(enum_variant.syntax().to_owned());
262 } else if let Some(module_item) = ast::ModuleItem::cast(it) {
262 self.alloc(module_item.syntax().to_owned()); 263 self.alloc(module_item.syntax().to_owned());
263 } else if let Some(macro_call) = ast::MacroCall::cast(it) { 264 } else if let Some(macro_call) = ast::MacroCall::cast(it) {
264 self.alloc(macro_call.syntax().to_owned()); 265 self.alloc(macro_call.syntax().to_owned());