From 85290bc1342560d5560f0b2151cff1c0c6dac155 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Dec 2018 12:20:54 +0300 Subject: switch analysis to vfs --- crates/ra_db/src/input.rs | 22 +++++++--------------- crates/ra_db/src/lib.rs | 2 +- crates/ra_db/src/mock.rs | 7 +------ 3 files changed, 9 insertions(+), 22 deletions(-) (limited to 'crates/ra_db/src') 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 @@ use std::sync::Arc; -use rustc_hash::{FxHashSet, FxHashMap}; +use rustc_hash::{FxHashMap}; use relative_path::RelativePathBuf; use ra_syntax::SmolStr; use salsa; +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub struct SourceRootId(pub u32); + +pub const WORKSPACE: SourceRootId = SourceRootId(0); + #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct FileId(pub u32); @@ -93,14 +98,6 @@ salsa::query_group! { type FileSourceRootQuery; storage input; } - fn source_root_files(id: SourceRootId) -> Arc> { - type SourceRootFilesQuery; - storage input; - } - fn source_root_file_by_path(id: SourceRootId, path: RelativePathBuf) -> Option { - type SourceRootFileByPathQuery; - storage input; - } fn source_root(id: SourceRootId) -> Arc { type SourceRootQuery; storage input; @@ -116,12 +113,7 @@ salsa::query_group! { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct SourceRootId(pub u32); - #[derive(Default, Clone, Debug, PartialEq, Eq)] pub struct SourceRoot { - pub files: FxHashSet, + pub files: FxHashMap, } - -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::{ input::{ FilesDatabase, FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, WORKSPACE, FileTextQuery, FileSourceRootQuery, SourceRootQuery, LibrariesQuery, CrateGraphQuery, - FileRelativePathQuery, SourceRootFilesQuery, SourceRootFileByPathQuery, + FileRelativePathQuery }, loc2id::{LocationIntener, NumericId}, }; 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 @@ use rustc_hash::FxHashSet; use relative_path::{RelativePath, RelativePathBuf}; -use crate::{FileId, FileResolver, SourceRoot}; +use crate::{FileId, FileResolver}; #[derive(Default, Debug, Clone)] pub struct FileMap(Vec<(FileId, RelativePathBuf)>); @@ -13,11 +13,6 @@ impl FileMap { file_id } - pub fn into_source_root(self) -> SourceRoot { - let files = self.files(); - SourceRoot { files } - } - pub fn files(&self) -> FxHashSet { self.iter().map(|(id, _)| id).collect() } -- cgit v1.2.3