aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/hir/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/hir/mod.rs')
-rw-r--r--crates/ra_analysis/src/hir/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/hir/mod.rs b/crates/ra_analysis/src/hir/mod.rs
index 3d4a55ca4..aa416df20 100644
--- a/crates/ra_analysis/src/hir/mod.rs
+++ b/crates/ra_analysis/src/hir/mod.rs
@@ -51,19 +51,19 @@ impl DefId {
51 51
52/// Identifier of item within a specific file. This is stable over reparses, so 52/// Identifier of item within a specific file. This is stable over reparses, so
53/// it's OK to use it as a salsa key/value. 53/// it's OK to use it as a salsa key/value.
54pub(crate) type FileItemId = Id<SyntaxNode>; 54pub(crate) type SourceFileItemId = Id<SyntaxNode>;
55 55
56/// Maps item's `SyntaxNode`s to `FileItemId` and back. 56/// Maps item's `SyntaxNode`s to `SourceFileItemId` and back.
57#[derive(Debug, PartialEq, Eq, Default)] 57#[derive(Debug, PartialEq, Eq, Default)]
58pub(crate) struct FileItems { 58pub(crate) struct SourceFileItems {
59 arena: Arena<SyntaxNode>, 59 arena: Arena<SyntaxNode>,
60} 60}
61 61
62impl FileItems { 62impl SourceFileItems {
63 fn alloc(&mut self, item: SyntaxNode) -> FileItemId { 63 fn alloc(&mut self, item: SyntaxNode) -> SourceFileItemId {
64 self.arena.alloc(item) 64 self.arena.alloc(item)
65 } 65 }
66 fn id_of(&self, item: SyntaxNodeRef) -> FileItemId { 66 fn id_of(&self, item: SyntaxNodeRef) -> SourceFileItemId {
67 let (id, _item) = self 67 let (id, _item) = self
68 .arena 68 .arena
69 .iter() 69 .iter()
@@ -73,9 +73,9 @@ impl FileItems {
73 } 73 }
74} 74}
75 75
76impl Index<FileItemId> for FileItems { 76impl Index<SourceFileItemId> for SourceFileItems {
77 type Output = SyntaxNode; 77 type Output = SyntaxNode;
78 fn index(&self, idx: FileItemId) -> &SyntaxNode { 78 fn index(&self, idx: SourceFileItemId) -> &SyntaxNode {
79 &self.arena[idx] 79 &self.arena[idx]
80 } 80 }
81} 81}