diff options
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 9596488d3..3d0a881c2 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -4,7 +4,7 @@ use std::{ | |||
4 | sync::Arc, | 4 | sync::Arc, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_db::{LocationIntener, FileId}; | 7 | use ra_db::{LocationInterner, FileId}; |
8 | use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast}; | 8 | use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast}; |
9 | use ra_arena::{Arena, RawId, ArenaId, impl_arena_id}; | 9 | use ra_arena::{Arena, RawId, ArenaId, impl_arena_id}; |
10 | 10 | ||
@@ -15,14 +15,14 @@ use crate::{ | |||
15 | 15 | ||
16 | #[derive(Debug, Default)] | 16 | #[derive(Debug, Default)] |
17 | pub struct HirInterner { | 17 | pub struct HirInterner { |
18 | macros: LocationIntener<MacroCallLoc, MacroCallId>, | 18 | macros: LocationInterner<MacroCallLoc, MacroCallId>, |
19 | fns: LocationIntener<ItemLoc<ast::FnDef>, FunctionId>, | 19 | fns: LocationInterner<ItemLoc<ast::FnDef>, FunctionId>, |
20 | structs: LocationIntener<ItemLoc<ast::StructDef>, StructId>, | 20 | structs: LocationInterner<ItemLoc<ast::StructDef>, StructId>, |
21 | enums: LocationIntener<ItemLoc<ast::EnumDef>, EnumId>, | 21 | enums: LocationInterner<ItemLoc<ast::EnumDef>, EnumId>, |
22 | consts: LocationIntener<ItemLoc<ast::ConstDef>, ConstId>, | 22 | consts: LocationInterner<ItemLoc<ast::ConstDef>, ConstId>, |
23 | statics: LocationIntener<ItemLoc<ast::StaticDef>, StaticId>, | 23 | statics: LocationInterner<ItemLoc<ast::StaticDef>, StaticId>, |
24 | traits: LocationIntener<ItemLoc<ast::TraitDef>, TraitId>, | 24 | traits: LocationInterner<ItemLoc<ast::TraitDef>, TraitId>, |
25 | types: LocationIntener<ItemLoc<ast::TypeAliasDef>, TypeId>, | 25 | types: LocationInterner<ItemLoc<ast::TypeAliasDef>, TypeId>, |
26 | } | 26 | } |
27 | 27 | ||
28 | impl HirInterner { | 28 | impl HirInterner { |
@@ -204,7 +204,7 @@ impl<'a, DB: PersistentHirDatabase> LocationCtx<&'a DB> { | |||
204 | } | 204 | } |
205 | 205 | ||
206 | pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { | 206 | pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { |
207 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<N>, Self>; | 207 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<N>, Self>; |
208 | fn from_ast(ctx: LocationCtx<&impl PersistentHirDatabase>, ast: &N) -> Self { | 208 | fn from_ast(ctx: LocationCtx<&impl PersistentHirDatabase>, ast: &N) -> Self { |
209 | let items = ctx.db.file_items(ctx.file_id); | 209 | let items = ctx.db.file_items(ctx.file_id); |
210 | let item_id = items.id_of(ctx.file_id, ast.syntax()); | 210 | let item_id = items.id_of(ctx.file_id, ast.syntax()); |
@@ -238,7 +238,7 @@ pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { | |||
238 | pub struct FunctionId(RawId); | 238 | pub struct FunctionId(RawId); |
239 | impl_arena_id!(FunctionId); | 239 | impl_arena_id!(FunctionId); |
240 | impl AstItemDef<ast::FnDef> for FunctionId { | 240 | impl AstItemDef<ast::FnDef> for FunctionId { |
241 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::FnDef>, Self> { | 241 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::FnDef>, Self> { |
242 | &interner.fns | 242 | &interner.fns |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -247,7 +247,7 @@ impl AstItemDef<ast::FnDef> for FunctionId { | |||
247 | pub struct StructId(RawId); | 247 | pub struct StructId(RawId); |
248 | impl_arena_id!(StructId); | 248 | impl_arena_id!(StructId); |
249 | impl AstItemDef<ast::StructDef> for StructId { | 249 | impl AstItemDef<ast::StructDef> for StructId { |
250 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::StructDef>, Self> { | 250 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::StructDef>, Self> { |
251 | &interner.structs | 251 | &interner.structs |
252 | } | 252 | } |
253 | } | 253 | } |
@@ -256,7 +256,7 @@ impl AstItemDef<ast::StructDef> for StructId { | |||
256 | pub struct EnumId(RawId); | 256 | pub struct EnumId(RawId); |
257 | impl_arena_id!(EnumId); | 257 | impl_arena_id!(EnumId); |
258 | impl AstItemDef<ast::EnumDef> for EnumId { | 258 | impl AstItemDef<ast::EnumDef> for EnumId { |
259 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::EnumDef>, Self> { | 259 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::EnumDef>, Self> { |
260 | &interner.enums | 260 | &interner.enums |
261 | } | 261 | } |
262 | } | 262 | } |
@@ -265,7 +265,7 @@ impl AstItemDef<ast::EnumDef> for EnumId { | |||
265 | pub struct ConstId(RawId); | 265 | pub struct ConstId(RawId); |
266 | impl_arena_id!(ConstId); | 266 | impl_arena_id!(ConstId); |
267 | impl AstItemDef<ast::ConstDef> for ConstId { | 267 | impl AstItemDef<ast::ConstDef> for ConstId { |
268 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::ConstDef>, Self> { | 268 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::ConstDef>, Self> { |
269 | &interner.consts | 269 | &interner.consts |
270 | } | 270 | } |
271 | } | 271 | } |
@@ -274,7 +274,7 @@ impl AstItemDef<ast::ConstDef> for ConstId { | |||
274 | pub struct StaticId(RawId); | 274 | pub struct StaticId(RawId); |
275 | impl_arena_id!(StaticId); | 275 | impl_arena_id!(StaticId); |
276 | impl AstItemDef<ast::StaticDef> for StaticId { | 276 | impl AstItemDef<ast::StaticDef> for StaticId { |
277 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::StaticDef>, Self> { | 277 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::StaticDef>, Self> { |
278 | &interner.statics | 278 | &interner.statics |
279 | } | 279 | } |
280 | } | 280 | } |
@@ -283,7 +283,7 @@ impl AstItemDef<ast::StaticDef> for StaticId { | |||
283 | pub struct TraitId(RawId); | 283 | pub struct TraitId(RawId); |
284 | impl_arena_id!(TraitId); | 284 | impl_arena_id!(TraitId); |
285 | impl AstItemDef<ast::TraitDef> for TraitId { | 285 | impl AstItemDef<ast::TraitDef> for TraitId { |
286 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TraitDef>, Self> { | 286 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::TraitDef>, Self> { |
287 | &interner.traits | 287 | &interner.traits |
288 | } | 288 | } |
289 | } | 289 | } |
@@ -292,7 +292,7 @@ impl AstItemDef<ast::TraitDef> for TraitId { | |||
292 | pub struct TypeId(RawId); | 292 | pub struct TypeId(RawId); |
293 | impl_arena_id!(TypeId); | 293 | impl_arena_id!(TypeId); |
294 | impl AstItemDef<ast::TypeAliasDef> for TypeId { | 294 | impl AstItemDef<ast::TypeAliasDef> for TypeId { |
295 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeAliasDef>, Self> { | 295 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::TypeAliasDef>, Self> { |
296 | &interner.types | 296 | &interner.types |
297 | } | 297 | } |
298 | } | 298 | } |