aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/ids.rs34
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
7use ra_db::{LocationIntener, FileId}; 7use ra_db::{LocationInterner, FileId};
8use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast}; 8use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast};
9use ra_arena::{Arena, RawId, ArenaId, impl_arena_id}; 9use 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)]
17pub struct HirInterner { 17pub 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
28impl HirInterner { 28impl HirInterner {
@@ -204,7 +204,7 @@ impl<'a, DB: PersistentHirDatabase> LocationCtx<&'a DB> {
204} 204}
205 205
206pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { 206pub(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 {
238pub struct FunctionId(RawId); 238pub struct FunctionId(RawId);
239impl_arena_id!(FunctionId); 239impl_arena_id!(FunctionId);
240impl AstItemDef<ast::FnDef> for FunctionId { 240impl 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 {
247pub struct StructId(RawId); 247pub struct StructId(RawId);
248impl_arena_id!(StructId); 248impl_arena_id!(StructId);
249impl AstItemDef<ast::StructDef> for StructId { 249impl 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 {
256pub struct EnumId(RawId); 256pub struct EnumId(RawId);
257impl_arena_id!(EnumId); 257impl_arena_id!(EnumId);
258impl AstItemDef<ast::EnumDef> for EnumId { 258impl 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 {
265pub struct ConstId(RawId); 265pub struct ConstId(RawId);
266impl_arena_id!(ConstId); 266impl_arena_id!(ConstId);
267impl AstItemDef<ast::ConstDef> for ConstId { 267impl 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 {
274pub struct StaticId(RawId); 274pub struct StaticId(RawId);
275impl_arena_id!(StaticId); 275impl_arena_id!(StaticId);
276impl AstItemDef<ast::StaticDef> for StaticId { 276impl 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 {
283pub struct TraitId(RawId); 283pub struct TraitId(RawId);
284impl_arena_id!(TraitId); 284impl_arena_id!(TraitId);
285impl AstItemDef<ast::TraitDef> for TraitId { 285impl 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 {
292pub struct TypeId(RawId); 292pub struct TypeId(RawId);
293impl_arena_id!(TypeId); 293impl_arena_id!(TypeId);
294impl AstItemDef<ast::TypeAliasDef> for TypeId { 294impl 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}