aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-21 18:40:20 +0000
committerAleksey Kladov <[email protected]>2019-12-21 18:44:08 +0000
commite903f58d29662b5509fb20c74d7c4131271bfbf0 (patch)
treef816fedc3ce4c9de6db4ae83a5403897d8807b04 /crates/ra_hir
parentf874d6c475356b1dd40acd9c362c786dc76f7e28 (diff)
More profiling
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/from_source.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index ebd9ee2a8..6314be8d4 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -7,6 +7,7 @@ use hir_def::{
7 StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId, 7 StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId,
8}; 8};
9use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; 9use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind};
10use ra_db::FileId;
10use ra_prof::profile; 11use ra_prof::profile;
11use ra_syntax::{ 12use ra_syntax::{
12 ast::{self, AstNode, NameOwner}, 13 ast::{self, AstNode, NameOwner},
@@ -206,10 +207,14 @@ impl Module {
206 }; 207 };
207 208
208 let original_file = src.file_id.original_file(db); 209 let original_file = src.file_id.original_file(db);
210 Module::from_file(db, original_file)
211 }
209 212
210 let (krate, local_id) = db.relevant_crates(original_file).iter().find_map(|&crate_id| { 213 fn from_file(db: &impl DefDatabase, file: FileId) -> Option<Self> {
214 let _p = profile("Module::from_file");
215 let (krate, local_id) = db.relevant_crates(file).iter().find_map(|&crate_id| {
211 let crate_def_map = db.crate_def_map(crate_id); 216 let crate_def_map = db.crate_def_map(crate_id);
212 let local_id = crate_def_map.modules_for_file(original_file).next()?; 217 let local_id = crate_def_map.modules_for_file(file).next()?;
213 Some((crate_id, local_id)) 218 Some((crate_id, local_id))
214 })?; 219 })?;
215 Some(Module { id: ModuleId { krate, local_id } }) 220 Some(Module { id: ModuleId { krate, local_id } })