diff options
author | Aleksey Kladov <[email protected]> | 2019-12-21 18:40:20 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-21 18:44:08 +0000 |
commit | e903f58d29662b5509fb20c74d7c4131271bfbf0 (patch) | |
tree | f816fedc3ce4c9de6db4ae83a5403897d8807b04 /crates/ra_hir/src | |
parent | f874d6c475356b1dd40acd9c362c786dc76f7e28 (diff) |
More profiling
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 9 |
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 | }; |
9 | use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; | 9 | use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; |
10 | use ra_db::FileId; | ||
10 | use ra_prof::profile; | 11 | use ra_prof::profile; |
11 | use ra_syntax::{ | 12 | use 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 } }) |