aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-01 15:19:15 +0000
committerAleksey Kladov <[email protected]>2019-01-01 19:15:35 +0000
commit832bae8e28768759ba3dc75cf6a10fb333741d8e (patch)
tree36c86a339d500c4e4c2e43d9c737813a182168d0 /crates/ra_hir/src
parent882a86240f42068038586431e7e5de5de247720c (diff)
fix tests
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/db.rs2
-rw-r--r--crates/ra_hir/src/mock.rs9
2 files changed, 9 insertions, 2 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 95d8da200..289bec507 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -8,7 +8,7 @@ use crate::{
8 SourceFileItems, SourceItemId, 8 SourceFileItems, SourceItemId,
9 query_definitions, 9 query_definitions,
10 FnScopes, 10 FnScopes,
11 macros::{MacroCallLoc, MacroCallId, MacroInput, MacroDef, MacroExpansion}, 11 macros::{MacroCallLoc, MacroCallId, MacroExpansion},
12 module::{ModuleId, ModuleTree, ModuleSource, 12 module::{ModuleId, ModuleTree, ModuleSource,
13 nameres::{ItemMap, InputModuleItems}}, 13 nameres::{ItemMap, InputModuleItems}},
14 ty::{InferenceResult, Ty}, 14 ty::{InferenceResult, Ty},
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index a2507c9b5..78f638ce4 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,7 @@ 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 expand_macro_invocation() for db::ExpandMacroCallQuery;
186 fn module_tree() for db::ModuleTreeQuery; 193 fn module_tree() for db::ModuleTreeQuery;
187 fn fn_scopes() for db::FnScopesQuery; 194 fn fn_scopes() for db::FnScopesQuery;
188 fn file_items() for db::SourceFileItemsQuery; 195 fn file_items() for db::SourceFileItemsQuery;