diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 12 | ||||
-rw-r--r-- | crates/ra_analysis/src/roots.rs | 7 |
2 files changed, 8 insertions, 11 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index fb711491b..0cf6db40d 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -94,12 +94,12 @@ impl AnalysisHostImpl { | |||
94 | } | 94 | } |
95 | } | 95 | } |
96 | pub fn change_files(&mut self, changes: &mut dyn Iterator<Item=(FileId, Option<String>)>) { | 96 | pub fn change_files(&mut self, changes: &mut dyn Iterator<Item=(FileId, Option<String>)>) { |
97 | let data = self.data_mut(); | 97 | self.data_mut() |
98 | data.root = Arc::new(data.root.apply_changes(changes, None)); | 98 | .root.apply_changes(changes, None); |
99 | } | 99 | } |
100 | pub fn set_file_resolver(&mut self, resolver: FileResolverImp) { | 100 | pub fn set_file_resolver(&mut self, resolver: FileResolverImp) { |
101 | let data = self.data_mut(); | 101 | self.data_mut() |
102 | data.root = Arc::new(data.root.apply_changes(&mut iter::empty(), Some(resolver))); | 102 | .root.apply_changes(&mut iter::empty(), Some(resolver)); |
103 | } | 103 | } |
104 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { | 104 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { |
105 | let mut visited = FxHashSet::default(); | 105 | let mut visited = FxHashSet::default(); |
@@ -141,7 +141,7 @@ impl Clone for AnalysisImpl { | |||
141 | impl AnalysisImpl { | 141 | impl AnalysisImpl { |
142 | fn root(&self, file_id: FileId) -> &SourceRoot { | 142 | fn root(&self, file_id: FileId) -> &SourceRoot { |
143 | if self.data.root.contains(file_id) { | 143 | if self.data.root.contains(file_id) { |
144 | return &*self.data.root; | 144 | return &self.data.root; |
145 | } | 145 | } |
146 | &**self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() | 146 | &**self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() |
147 | } | 147 | } |
@@ -405,7 +405,7 @@ impl AnalysisImpl { | |||
405 | #[derive(Default, Clone, Debug)] | 405 | #[derive(Default, Clone, Debug)] |
406 | struct WorldData { | 406 | struct WorldData { |
407 | crate_graph: CrateGraph, | 407 | crate_graph: CrateGraph, |
408 | root: Arc<WritableSourceRoot>, | 408 | root: WritableSourceRoot, |
409 | libs: Vec<Arc<ReadonlySourceRoot>>, | 409 | libs: Vec<Arc<ReadonlySourceRoot>>, |
410 | } | 410 | } |
411 | 411 | ||
diff --git a/crates/ra_analysis/src/roots.rs b/crates/ra_analysis/src/roots.rs index 766548c70..42833af36 100644 --- a/crates/ra_analysis/src/roots.rs +++ b/crates/ra_analysis/src/roots.rs | |||
@@ -35,10 +35,10 @@ pub(crate) struct WritableSourceRoot { | |||
35 | 35 | ||
36 | impl WritableSourceRoot { | 36 | impl WritableSourceRoot { |
37 | pub fn apply_changes( | 37 | pub fn apply_changes( |
38 | &self, | 38 | &mut self, |
39 | changes: &mut dyn Iterator<Item=(FileId, Option<String>)>, | 39 | changes: &mut dyn Iterator<Item=(FileId, Option<String>)>, |
40 | file_resolver: Option<FileResolverImp>, | 40 | file_resolver: Option<FileResolverImp>, |
41 | ) -> WritableSourceRoot { | 41 | ) { |
42 | let db = self.db.write(); | 42 | let db = self.db.write(); |
43 | let mut changed = FxHashSet::default(); | 43 | let mut changed = FxHashSet::default(); |
44 | let mut removed = FxHashSet::default(); | 44 | let mut removed = FxHashSet::default(); |
@@ -65,9 +65,6 @@ impl WritableSourceRoot { | |||
65 | let resolver = file_resolver.unwrap_or_else(|| file_set.resolver.clone()); | 65 | let resolver = file_resolver.unwrap_or_else(|| file_set.resolver.clone()); |
66 | db.query(db::FileSetQuery) | 66 | db.query(db::FileSetQuery) |
67 | .set((), Arc::new(db::FileSet { files, resolver })); | 67 | .set((), Arc::new(db::FileSet { files, resolver })); |
68 | // TODO: reconcile sasla's API with our needs | ||
69 | // https://github.com/salsa-rs/salsa/issues/12 | ||
70 | self.clone() | ||
71 | } | 68 | } |
72 | } | 69 | } |
73 | 70 | ||