aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/mock.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/mock.rs')
-rw-r--r--crates/ra_hir/src/mock.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index a2507c9b5..89b18194a 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -6,7 +6,7 @@ use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, Sou
6use relative_path::RelativePathBuf; 6use relative_path::RelativePathBuf;
7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; 7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
8 8
9use crate::{db, DefId, DefLoc}; 9use crate::{db, DefId, DefLoc, MacroCallId, MacroCallLoc};
10 10
11pub const WORKSPACE: SourceRootId = SourceRootId(0); 11pub const WORKSPACE: SourceRootId = SourceRootId(0);
12 12
@@ -95,6 +95,7 @@ impl MockDatabase {
95#[derive(Debug, Default)] 95#[derive(Debug, Default)]
96struct IdMaps { 96struct IdMaps {
97 defs: LocationIntener<DefLoc, DefId>, 97 defs: LocationIntener<DefLoc, DefId>,
98 macros: LocationIntener<MacroCallLoc, MacroCallId>,
98} 99}
99 100
100impl salsa::Database for MockDatabase { 101impl salsa::Database for MockDatabase {
@@ -144,6 +145,11 @@ impl AsRef<LocationIntener<DefLoc, DefId>> for MockDatabase {
144 &self.id_maps.defs 145 &self.id_maps.defs
145 } 146 }
146} 147}
148impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>> for MockDatabase {
149 fn as_ref(&self) -> &LocationIntener<MacroCallLoc, MacroCallId> {
150 &self.id_maps.macros
151 }
152}
147 153
148impl MockDatabase { 154impl MockDatabase {
149 pub(crate) fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<MockDatabase>> { 155 pub(crate) fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<MockDatabase>> {
@@ -183,6 +189,8 @@ salsa::database_storage! {
183 fn file_lines() for ra_db::FileLinesQuery; 189 fn file_lines() for ra_db::FileLinesQuery;
184 } 190 }
185 impl db::HirDatabase { 191 impl db::HirDatabase {
192 fn hir_source_file() for db::HirSourceFileQuery;
193 fn expand_macro_invocation() for db::ExpandMacroCallQuery;
186 fn module_tree() for db::ModuleTreeQuery; 194 fn module_tree() for db::ModuleTreeQuery;
187 fn fn_scopes() for db::FnScopesQuery; 195 fn fn_scopes() for db::FnScopesQuery;
188 fn file_items() for db::SourceFileItemsQuery; 196 fn file_items() for db::SourceFileItemsQuery;