aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-21 17:45:46 +0000
committerAleksey Kladov <[email protected]>2019-12-21 17:46:21 +0000
commitd4b135f38c8c0050768c50e62043ddca5f09079a (patch)
tree5684bfee4f4614d503ed84ad3c540440c232b4bf /crates/ra_hir/src/source_binder.rs
parent6d8a2ec3dd350541d7c0e5aa08795a42c4dbd8f8 (diff)
Optimize and profile
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index b60a6b87e..85b378483 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -26,6 +26,7 @@ use hir_ty::{
26 method_resolution::{self, implements_trait}, 26 method_resolution::{self, implements_trait},
27 Canonical, InEnvironment, InferenceResult, TraitEnvironment, Ty, 27 Canonical, InEnvironment, InferenceResult, TraitEnvironment, Ty,
28}; 28};
29use ra_prof::profile;
29use ra_syntax::{ 30use ra_syntax::{
30 ast::{self, AstNode}, 31 ast::{self, AstNode},
31 match_ast, AstPtr, 32 match_ast, AstPtr,
@@ -83,6 +84,7 @@ fn def_with_body_from_child_node(
83 db: &impl HirDatabase, 84 db: &impl HirDatabase,
84 child: InFile<&SyntaxNode>, 85 child: InFile<&SyntaxNode>,
85) -> Option<DefWithBody> { 86) -> Option<DefWithBody> {
87 let _p = profile("def_with_body_from_child_node");
86 child.cloned().ancestors_with_macros(db).find_map(|node| { 88 child.cloned().ancestors_with_macros(db).find_map(|node| {
87 let n = &node.value; 89 let n = &node.value;
88 match_ast! { 90 match_ast! {
@@ -169,6 +171,7 @@ impl SourceAnalyzer {
169 node: InFile<&SyntaxNode>, 171 node: InFile<&SyntaxNode>,
170 offset: Option<TextUnit>, 172 offset: Option<TextUnit>,
171 ) -> SourceAnalyzer { 173 ) -> SourceAnalyzer {
174 let _p = profile("SourceAnalyzer::new");
172 let def_with_body = def_with_body_from_child_node(db, node); 175 let def_with_body = def_with_body_from_child_node(db, node);
173 if let Some(def) = def_with_body { 176 if let Some(def) = def_with_body {
174 let (_body, source_map) = db.body_with_source_map(def.into()); 177 let (_body, source_map) = db.body_with_source_map(def.into());