diff options
-rw-r--r-- | crates/ra_analysis/src/db.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/db.rs | 8 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/mod.rs | 16 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/nameres.rs | 14 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/query_definitions.rs | 8 | ||||
-rw-r--r-- | crates/ra_analysis/src/loc2id.rs | 4 |
6 files changed, 26 insertions, 26 deletions
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index d7fffc188..97f170473 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs | |||
@@ -127,7 +127,7 @@ salsa::database_storage! { | |||
127 | impl hir::db::HirDatabase { | 127 | impl hir::db::HirDatabase { |
128 | fn module_tree() for hir::db::ModuleTreeQuery; | 128 | fn module_tree() for hir::db::ModuleTreeQuery; |
129 | fn fn_scopes() for hir::db::FnScopesQuery; | 129 | fn fn_scopes() for hir::db::FnScopesQuery; |
130 | fn _file_items() for hir::db::FileItemsQuery; | 130 | fn _file_items() for hir::db::SourceFileItemsQuery; |
131 | fn _file_item() for hir::db::FileItemQuery; | 131 | fn _file_item() for hir::db::FileItemQuery; |
132 | fn _input_module_items() for hir::db::InputModuleItemsQuery; | 132 | fn _input_module_items() for hir::db::InputModuleItemsQuery; |
133 | fn _item_map() for hir::db::ItemMapQuery; | 133 | fn _item_map() for hir::db::ItemMapQuery; |
diff --git a/crates/ra_analysis/src/hir/db.rs b/crates/ra_analysis/src/hir/db.rs index a226e8205..e74fcc8ad 100644 --- a/crates/ra_analysis/src/hir/db.rs +++ b/crates/ra_analysis/src/hir/db.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | use crate::{ | 8 | use crate::{ |
9 | FileId, | 9 | FileId, |
10 | db::SyntaxDatabase, | 10 | db::SyntaxDatabase, |
11 | hir::{FileItems, FileItemId}, | 11 | hir::{SourceFileItems, SourceFileItemId}, |
12 | hir::query_definitions, | 12 | hir::query_definitions, |
13 | hir::function::{FnId, FnScopes}, | 13 | hir::function::{FnId, FnScopes}, |
14 | hir::module::{ | 14 | hir::module::{ |
@@ -33,13 +33,13 @@ pub(crate) trait HirDatabase: SyntaxDatabase { | |||
33 | use fn query_definitions::fn_syntax; | 33 | use fn query_definitions::fn_syntax; |
34 | } | 34 | } |
35 | 35 | ||
36 | fn file_items(file_id: FileId) -> Arc<FileItems> { | 36 | fn file_items(file_id: FileId) -> Arc<SourceFileItems> { |
37 | type FileItemsQuery; | 37 | type SourceFileItemsQuery; |
38 | storage dependencies; | 38 | storage dependencies; |
39 | use fn query_definitions::file_items; | 39 | use fn query_definitions::file_items; |
40 | } | 40 | } |
41 | 41 | ||
42 | fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { | 42 | fn file_item(file_id: FileId, file_item_id: SourceFileItemId) -> SyntaxNode { |
43 | type FileItemQuery; | 43 | type FileItemQuery; |
44 | storage dependencies; | 44 | storage dependencies; |
45 | use fn query_definitions::file_item; | 45 | use fn query_definitions::file_item; |
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. |
54 | pub(crate) type FileItemId = Id<SyntaxNode>; | 54 | pub(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)] |
58 | pub(crate) struct FileItems { | 58 | pub(crate) struct SourceFileItems { |
59 | arena: Arena<SyntaxNode>, | 59 | arena: Arena<SyntaxNode>, |
60 | } | 60 | } |
61 | 61 | ||
62 | impl FileItems { | 62 | impl 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 | ||
76 | impl Index<FileItemId> for FileItems { | 76 | impl 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 | } |
diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index f7d8c8e8c..9dc54f6c0 100644 --- a/crates/ra_analysis/src/hir/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs | |||
@@ -30,7 +30,7 @@ use crate::{ | |||
30 | Cancelable, FileId, | 30 | Cancelable, FileId, |
31 | loc2id::{DefId, DefLoc}, | 31 | loc2id::{DefId, DefLoc}, |
32 | hir::{ | 32 | hir::{ |
33 | FileItemId, FileItems, | 33 | SourceFileItemId, SourceFileItems, |
34 | Path, PathKind, | 34 | Path, PathKind, |
35 | HirDatabase, | 35 | HirDatabase, |
36 | module::{ModuleId, ModuleTree}, | 36 | module::{ModuleId, ModuleTree}, |
@@ -73,7 +73,7 @@ pub(crate) struct InputModuleItems { | |||
73 | 73 | ||
74 | #[derive(Debug, PartialEq, Eq)] | 74 | #[derive(Debug, PartialEq, Eq)] |
75 | struct ModuleItem { | 75 | struct ModuleItem { |
76 | id: FileItemId, | 76 | id: SourceFileItemId, |
77 | name: SmolStr, | 77 | name: SmolStr, |
78 | kind: SyntaxKind, | 78 | kind: SyntaxKind, |
79 | vis: Vis, | 79 | vis: Vis, |
@@ -93,7 +93,7 @@ struct Import { | |||
93 | 93 | ||
94 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 94 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
95 | pub(crate) struct NamedImport { | 95 | pub(crate) struct NamedImport { |
96 | file_item_id: FileItemId, | 96 | file_item_id: SourceFileItemId, |
97 | relative_range: TextRange, | 97 | relative_range: TextRange, |
98 | } | 98 | } |
99 | 99 | ||
@@ -135,7 +135,7 @@ pub(crate) struct Resolution { | |||
135 | 135 | ||
136 | impl InputModuleItems { | 136 | impl InputModuleItems { |
137 | pub(in crate::hir) fn new<'a>( | 137 | pub(in crate::hir) fn new<'a>( |
138 | file_items: &FileItems, | 138 | file_items: &SourceFileItems, |
139 | items: impl Iterator<Item = ast::ModuleItem<'a>>, | 139 | items: impl Iterator<Item = ast::ModuleItem<'a>>, |
140 | ) -> InputModuleItems { | 140 | ) -> InputModuleItems { |
141 | let mut res = InputModuleItems::default(); | 141 | let mut res = InputModuleItems::default(); |
@@ -145,7 +145,7 @@ impl InputModuleItems { | |||
145 | res | 145 | res |
146 | } | 146 | } |
147 | 147 | ||
148 | fn add_item(&mut self, file_items: &FileItems, item: ast::ModuleItem) -> Option<()> { | 148 | fn add_item(&mut self, file_items: &SourceFileItems, item: ast::ModuleItem) -> Option<()> { |
149 | match item { | 149 | match item { |
150 | ast::ModuleItem::StructDef(it) => self.items.push(ModuleItem::new(file_items, it)?), | 150 | ast::ModuleItem::StructDef(it) => self.items.push(ModuleItem::new(file_items, it)?), |
151 | ast::ModuleItem::EnumDef(it) => self.items.push(ModuleItem::new(file_items, it)?), | 151 | ast::ModuleItem::EnumDef(it) => self.items.push(ModuleItem::new(file_items, it)?), |
@@ -166,7 +166,7 @@ impl InputModuleItems { | |||
166 | Some(()) | 166 | Some(()) |
167 | } | 167 | } |
168 | 168 | ||
169 | fn add_use_item(&mut self, file_items: &FileItems, item: ast::UseItem) { | 169 | fn add_use_item(&mut self, file_items: &SourceFileItems, item: ast::UseItem) { |
170 | let file_item_id = file_items.id_of(item.syntax()); | 170 | let file_item_id = file_items.id_of(item.syntax()); |
171 | let start_offset = item.syntax().range().start(); | 171 | let start_offset = item.syntax().range().start(); |
172 | Path::expand_use_item(item, |path, range| { | 172 | Path::expand_use_item(item, |path, range| { |
@@ -183,7 +183,7 @@ impl InputModuleItems { | |||
183 | } | 183 | } |
184 | 184 | ||
185 | impl ModuleItem { | 185 | impl ModuleItem { |
186 | fn new<'a>(file_items: &FileItems, item: impl ast::NameOwner<'a>) -> Option<ModuleItem> { | 186 | fn new<'a>(file_items: &SourceFileItems, item: impl ast::NameOwner<'a>) -> Option<ModuleItem> { |
187 | let name = item.name()?.text(); | 187 | let name = item.name()?.text(); |
188 | let kind = item.syntax().kind(); | 188 | let kind = item.syntax().kind(); |
189 | let vis = Vis::Other; | 189 | let vis = Vis::Other; |
diff --git a/crates/ra_analysis/src/hir/query_definitions.rs b/crates/ra_analysis/src/hir/query_definitions.rs index e6bfbc6cf..53926cf16 100644 --- a/crates/ra_analysis/src/hir/query_definitions.rs +++ b/crates/ra_analysis/src/hir/query_definitions.rs | |||
@@ -12,7 +12,7 @@ use ra_syntax::{ | |||
12 | use crate::{ | 12 | use crate::{ |
13 | FileId, Cancelable, | 13 | FileId, Cancelable, |
14 | hir::{ | 14 | hir::{ |
15 | FileItems, FileItemId, | 15 | SourceFileItems, SourceFileItemId, |
16 | db::HirDatabase, | 16 | db::HirDatabase, |
17 | function::{FnId, FnScopes}, | 17 | function::{FnId, FnScopes}, |
18 | module::{ | 18 | module::{ |
@@ -37,10 +37,10 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> { | |||
37 | Arc::new(res) | 37 | Arc::new(res) |
38 | } | 38 | } |
39 | 39 | ||
40 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<FileItems> { | 40 | pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { |
41 | let source_file = db.file_syntax(file_id); | 41 | let source_file = db.file_syntax(file_id); |
42 | let source_file = source_file.borrowed(); | 42 | let source_file = source_file.borrowed(); |
43 | let mut res = FileItems::default(); | 43 | let mut res = SourceFileItems::default(); |
44 | source_file | 44 | source_file |
45 | .syntax() | 45 | .syntax() |
46 | .descendants() | 46 | .descendants() |
@@ -55,7 +55,7 @@ pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<FileItem | |||
55 | pub(super) fn file_item( | 55 | pub(super) fn file_item( |
56 | db: &impl HirDatabase, | 56 | db: &impl HirDatabase, |
57 | file_id: FileId, | 57 | file_id: FileId, |
58 | file_item_id: FileItemId, | 58 | file_item_id: SourceFileItemId, |
59 | ) -> SyntaxNode { | 59 | ) -> SyntaxNode { |
60 | db.file_items(file_id)[file_item_id].clone() | 60 | db.file_items(file_id)[file_item_id].clone() |
61 | } | 61 | } |
diff --git a/crates/ra_analysis/src/loc2id.rs b/crates/ra_analysis/src/loc2id.rs index 8af7b642b..49af19c75 100644 --- a/crates/ra_analysis/src/loc2id.rs +++ b/crates/ra_analysis/src/loc2id.rs | |||
@@ -9,7 +9,7 @@ use rustc_hash::FxHashMap; | |||
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | FileId, | 11 | FileId, |
12 | hir::{FileItemId, ModuleId}, | 12 | hir::{SourceFileItemId, ModuleId}, |
13 | syntax_ptr::SyntaxPtr, | 13 | syntax_ptr::SyntaxPtr, |
14 | input::SourceRootId, | 14 | input::SourceRootId, |
15 | }; | 15 | }; |
@@ -104,7 +104,7 @@ pub(crate) enum DefLoc { | |||
104 | }, | 104 | }, |
105 | Item { | 105 | Item { |
106 | file_id: FileId, | 106 | file_id: FileId, |
107 | id: FileItemId, | 107 | id: SourceFileItemId, |
108 | }, | 108 | }, |
109 | } | 109 | } |
110 | 110 | ||