aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/imp.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-20 14:16:33 +0000
committerAleksey Kladov <[email protected]>2018-11-20 14:16:33 +0000
commita300fb68e25ea0cbf2cfba38968a40674cd4c805 (patch)
treeebb54c49dd65bb4fc47810dfb36ff33da57a9686 /crates/ra_analysis/src/imp.rs
parent0dd26a2f5b7dab38ee0813e314e2bde269dd5883 (diff)
Make most of modules impl private
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r--crates/ra_analysis/src/imp.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 1bbf0cb6d..61296215c 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -21,7 +21,7 @@ use crate::{
21 db::{self, FileSyntaxQuery, SyntaxDatabase}, 21 db::{self, FileSyntaxQuery, SyntaxDatabase},
22 descriptors::{ 22 descriptors::{
23 function::{FnDescriptor, FnId}, 23 function::{FnDescriptor, FnId},
24 module::{ModuleDescriptor, ModuleSource, ModuleTree, Problem}, 24 module::{ModuleDescriptor, Problem},
25 DeclarationDescriptor, DescriptorDatabase, 25 DeclarationDescriptor, DescriptorDatabase,
26 }, 26 },
27 input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, 27 input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE},
@@ -216,10 +216,6 @@ impl AnalysisImpl {
216 .sweep(salsa::SweepStrategy::default().discard_values()); 216 .sweep(salsa::SweepStrategy::default().discard_values());
217 Ok(query.search(&buf)) 217 Ok(query.search(&buf))
218 } 218 }
219 fn module_tree(&self, file_id: FileId) -> Cancelable<Arc<ModuleTree>> {
220 let source_root = self.db.file_source_root(file_id);
221 self.db.module_tree(source_root)
222 }
223 /// This return `Vec`: a module may be inclucded from several places. 219 /// This return `Vec`: a module may be inclucded from several places.
224 /// We don't handle this case yet though, so the Vec has length at most one. 220 /// We don't handle this case yet though, so the Vec has length at most one.
225 pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<(FileId, FileSymbol)>> { 221 pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<(FileId, FileSymbol)>> {
@@ -354,7 +350,6 @@ impl AnalysisImpl {
354 } 350 }
355 351
356 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 352 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
357 let module_tree = self.module_tree(file_id)?;
358 let syntax = self.db.file_syntax(file_id); 353 let syntax = self.db.file_syntax(file_id);
359 354
360 let mut res = ra_editor::diagnostics(&syntax) 355 let mut res = ra_editor::diagnostics(&syntax)
@@ -365,8 +360,8 @@ impl AnalysisImpl {
365 fix: None, 360 fix: None,
366 }) 361 })
367 .collect::<Vec<_>>(); 362 .collect::<Vec<_>>();
368 if let Some(m) = module_tree.any_module_for_source(ModuleSource::SourceFile(file_id)) { 363 if let Some(m) = ModuleDescriptor::guess_from_file_id(&*self.db, file_id)? {
369 for (name_node, problem) in m.problems(&module_tree, &*self.db) { 364 for (name_node, problem) in m.problems(&*self.db) {
370 let diag = match problem { 365 let diag = match problem {
371 Problem::UnresolvedModule { candidate } => { 366 Problem::UnresolvedModule { candidate } => {
372 let create_file = FileSystemEdit::CreateFile { 367 let create_file = FileSystemEdit::CreateFile {