diff options
author | Aleksey Kladov <[email protected]> | 2018-10-31 21:15:11 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-01 10:41:58 +0000 |
commit | 223fd2979c277cf402e4876d0e9a69257702f731 (patch) | |
tree | cf0dfb8abd3082f3a787a834184bb89b4d07f389 /crates/ra_analysis/src/imp.rs | |
parent | d685a9b564fe524865cda5713c527aaeb1ca6b1d (diff) |
Introduce ModuleSource
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 0744ea9c8..c1269025c 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -20,7 +20,7 @@ use crate::{ | |||
20 | db::{self, FileSyntaxQuery, SyntaxDatabase}, | 20 | db::{self, FileSyntaxQuery, SyntaxDatabase}, |
21 | descriptors::{ | 21 | descriptors::{ |
22 | function::{FnDescriptor, FnId}, | 22 | function::{FnDescriptor, FnId}, |
23 | module::{ModuleTree, Problem}, | 23 | module::{ModuleSource, ModuleTree, Problem}, |
24 | DeclarationDescriptor, DescriptorDatabase, | 24 | DeclarationDescriptor, DescriptorDatabase, |
25 | }, | 25 | }, |
26 | input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, | 26 | input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, |
@@ -222,7 +222,7 @@ impl AnalysisImpl { | |||
222 | .into_iter() | 222 | .into_iter() |
223 | .filter_map(|module_id| { | 223 | .filter_map(|module_id| { |
224 | let link = module_id.parent_link(&module_tree)?; | 224 | let link = module_id.parent_link(&module_tree)?; |
225 | let file_id = link.owner(&module_tree).file_id(&module_tree); | 225 | let ModuleSource::File(file_id) = link.owner(&module_tree).source(&module_tree); |
226 | let syntax = self.db.file_syntax(file_id); | 226 | let syntax = self.db.file_syntax(file_id); |
227 | let decl = link.bind_source(&module_tree, syntax.ast()); | 227 | let decl = link.bind_source(&module_tree, syntax.ast()); |
228 | 228 | ||
@@ -243,7 +243,9 @@ impl AnalysisImpl { | |||
243 | .modules_for_file(file_id) | 243 | .modules_for_file(file_id) |
244 | .into_iter() | 244 | .into_iter() |
245 | .map(|it| it.root(&module_tree)) | 245 | .map(|it| it.root(&module_tree)) |
246 | .map(|it| it.file_id(&module_tree)) | 246 | .map(|it| match it.source(&module_tree) { |
247 | ModuleSource::File(file_id) => file_id, | ||
248 | }) | ||
247 | .filter_map(|it| crate_graph.crate_id_for_crate_root(it)) | 249 | .filter_map(|it| crate_graph.crate_id_for_crate_root(it)) |
248 | .collect(); | 250 | .collect(); |
249 | 251 | ||
@@ -533,7 +535,9 @@ impl AnalysisImpl { | |||
533 | }; | 535 | }; |
534 | module_id | 536 | module_id |
535 | .child(module_tree, name.as_str()) | 537 | .child(module_tree, name.as_str()) |
536 | .map(|it| it.file_id(module_tree)) | 538 | .map(|it| match it.source(&module_tree) { |
539 | ModuleSource::File(file_id) => file_id, | ||
540 | }) | ||
537 | .into_iter() | 541 | .into_iter() |
538 | .collect() | 542 | .collect() |
539 | } | 543 | } |