diff options
author | Aleksey Kladov <[email protected]> | 2018-12-19 09:20:54 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-20 09:15:38 +0000 |
commit | 85290bc1342560d5560f0b2151cff1c0c6dac155 (patch) | |
tree | e7817987dc9dba9485659b8c2585e3c6315496c9 /crates/ra_db/src | |
parent | 815a0e577821a3876aa4c79c13200607acadcd2f (diff) |
switch analysis to vfs
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r-- | crates/ra_db/src/input.rs | 22 | ||||
-rw-r--r-- | crates/ra_db/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_db/src/mock.rs | 7 |
3 files changed, 9 insertions, 22 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 65b674da9..51daa8e86 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -1,10 +1,15 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use rustc_hash::{FxHashSet, FxHashMap}; | 3 | use rustc_hash::{FxHashMap}; |
4 | use relative_path::RelativePathBuf; | 4 | use relative_path::RelativePathBuf; |
5 | use ra_syntax::SmolStr; | 5 | use ra_syntax::SmolStr; |
6 | use salsa; | 6 | use salsa; |
7 | 7 | ||
8 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
9 | pub struct SourceRootId(pub u32); | ||
10 | |||
11 | pub const WORKSPACE: SourceRootId = SourceRootId(0); | ||
12 | |||
8 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 13 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
9 | pub struct FileId(pub u32); | 14 | pub struct FileId(pub u32); |
10 | 15 | ||
@@ -93,14 +98,6 @@ salsa::query_group! { | |||
93 | type FileSourceRootQuery; | 98 | type FileSourceRootQuery; |
94 | storage input; | 99 | storage input; |
95 | } | 100 | } |
96 | fn source_root_files(id: SourceRootId) -> Arc<FxHashSet<FileId>> { | ||
97 | type SourceRootFilesQuery; | ||
98 | storage input; | ||
99 | } | ||
100 | fn source_root_file_by_path(id: SourceRootId, path: RelativePathBuf) -> Option<FileId> { | ||
101 | type SourceRootFileByPathQuery; | ||
102 | storage input; | ||
103 | } | ||
104 | fn source_root(id: SourceRootId) -> Arc<SourceRoot> { | 101 | fn source_root(id: SourceRootId) -> Arc<SourceRoot> { |
105 | type SourceRootQuery; | 102 | type SourceRootQuery; |
106 | storage input; | 103 | storage input; |
@@ -116,12 +113,7 @@ salsa::query_group! { | |||
116 | } | 113 | } |
117 | } | 114 | } |
118 | 115 | ||
119 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
120 | pub struct SourceRootId(pub u32); | ||
121 | |||
122 | #[derive(Default, Clone, Debug, PartialEq, Eq)] | 116 | #[derive(Default, Clone, Debug, PartialEq, Eq)] |
123 | pub struct SourceRoot { | 117 | pub struct SourceRoot { |
124 | pub files: FxHashSet<FileId>, | 118 | pub files: FxHashMap<RelativePathBuf, FileId>, |
125 | } | 119 | } |
126 | |||
127 | pub const WORKSPACE: SourceRootId = SourceRootId(0); | ||
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 783b7a799..d1db281e6 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -28,7 +28,7 @@ pub use crate::{ | |||
28 | input::{ | 28 | input::{ |
29 | FilesDatabase, FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, WORKSPACE, | 29 | FilesDatabase, FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, WORKSPACE, |
30 | FileTextQuery, FileSourceRootQuery, SourceRootQuery, LibrariesQuery, CrateGraphQuery, | 30 | FileTextQuery, FileSourceRootQuery, SourceRootQuery, LibrariesQuery, CrateGraphQuery, |
31 | FileRelativePathQuery, SourceRootFilesQuery, SourceRootFileByPathQuery, | 31 | FileRelativePathQuery |
32 | }, | 32 | }, |
33 | loc2id::{LocationIntener, NumericId}, | 33 | loc2id::{LocationIntener, NumericId}, |
34 | }; | 34 | }; |
diff --git a/crates/ra_db/src/mock.rs b/crates/ra_db/src/mock.rs index 14d9e79b5..efe987bdd 100644 --- a/crates/ra_db/src/mock.rs +++ b/crates/ra_db/src/mock.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use rustc_hash::FxHashSet; | 1 | use rustc_hash::FxHashSet; |
2 | use relative_path::{RelativePath, RelativePathBuf}; | 2 | use relative_path::{RelativePath, RelativePathBuf}; |
3 | 3 | ||
4 | use crate::{FileId, FileResolver, SourceRoot}; | 4 | use crate::{FileId, FileResolver}; |
5 | 5 | ||
6 | #[derive(Default, Debug, Clone)] | 6 | #[derive(Default, Debug, Clone)] |
7 | pub struct FileMap(Vec<(FileId, RelativePathBuf)>); | 7 | pub struct FileMap(Vec<(FileId, RelativePathBuf)>); |
@@ -13,11 +13,6 @@ impl FileMap { | |||
13 | file_id | 13 | file_id |
14 | } | 14 | } |
15 | 15 | ||
16 | pub fn into_source_root(self) -> SourceRoot { | ||
17 | let files = self.files(); | ||
18 | SourceRoot { files } | ||
19 | } | ||
20 | |||
21 | pub fn files(&self) -> FxHashSet<FileId> { | 16 | pub fn files(&self) -> FxHashSet<FileId> { |
22 | self.iter().map(|(id, _)| id).collect() | 17 | self.iter().map(|(id, _)| id).collect() |
23 | } | 18 | } |