From a084412f0698d5f54d586f707930e141c88b0673 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 20 Dec 2018 12:06:23 +0300 Subject: set symbol index as const --- crates/ra_analysis/src/imp.rs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 4ef2129c3..c4291885a 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -74,7 +74,7 @@ impl AnalysisHostImpl { self.db .query_mut(LibrarySymbolsQuery) .set_constant(library.root_id, Arc::new(library.symbol_index)); - self.apply_root_change_constant(library.root_id, library.root_change); + self.apply_root_change(library.root_id, library.root_change); } self.db .query_mut(ra_db::LibraryRootsQuery) @@ -115,34 +115,6 @@ impl AnalysisHostImpl { .set(root_id, Arc::new(source_root)); } - fn apply_root_change_constant(&mut self, root_id: SourceRootId, root_change: RootChange) { - let mut source_root = SourceRoot::clone(&self.db.source_root(root_id)); - for add_file in root_change.added { - self.db - .query_mut(ra_db::FileTextQuery) - .set_constant(add_file.file_id, add_file.text); - self.db - .query_mut(ra_db::FileRelativePathQuery) - .set_constant(add_file.file_id, add_file.path.clone()); - self.db - .query_mut(ra_db::FileSourceRootQuery) - .set_constant(add_file.file_id, root_id); - source_root.files.insert(add_file.path, add_file.file_id); - } - for remove_file in root_change.removed { - self.db - .query_mut(ra_db::FileTextQuery) - .set_constant(remove_file.file_id, Default::default()); - self.db - .query_mut(ra_db::FileRelativePathQuery) - .set_constant(remove_file.file_id, Default::default()); - source_root.files.remove(&remove_file.path); - } - self.db - .query_mut(ra_db::SourceRootQuery) - .set_constant(root_id, Arc::new(source_root)); - } - #[allow(unused)] /// Ideally, we should call this function from time to time to collect heavy /// syntax trees. However, if we actually do that, everything is recomputed -- cgit v1.2.3