aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/Cargo.toml1
-rw-r--r--crates/ra_hir/src/from_source.rs4
-rw-r--r--crates/ra_hir/src/source_binder.rs3
3 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index 6ca9cc2e7..7dc31ad3c 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -14,6 +14,7 @@ either = "1.5"
14 14
15ra_syntax = { path = "../ra_syntax" } 15ra_syntax = { path = "../ra_syntax" }
16ra_db = { path = "../ra_db" } 16ra_db = { path = "../ra_db" }
17ra_prof = { path = "../ra_prof" }
17hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } 18hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
18hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } 19hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
19hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } 20hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 42ca55fe7..ebd9ee2a8 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_prof::profile;
10use ra_syntax::{ 11use ra_syntax::{
11 ast::{self, AstNode, NameOwner}, 12 ast::{self, AstNode, NameOwner},
12 match_ast, SyntaxNode, 13 match_ast, SyntaxNode,
@@ -169,6 +170,7 @@ impl TypeParam {
169 170
170impl Module { 171impl Module {
171 pub fn from_declaration(db: &impl DefDatabase, src: InFile<ast::Module>) -> Option<Self> { 172 pub fn from_declaration(db: &impl DefDatabase, src: InFile<ast::Module>) -> Option<Self> {
173 let _p = profile("Module::from_declaration");
172 let parent_declaration = src.value.syntax().ancestors().skip(1).find_map(ast::Module::cast); 174 let parent_declaration = src.value.syntax().ancestors().skip(1).find_map(ast::Module::cast);
173 175
174 let parent_module = match parent_declaration { 176 let parent_module = match parent_declaration {
@@ -191,6 +193,7 @@ impl Module {
191 } 193 }
192 194
193 pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> { 195 pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> {
196 let _p = profile("Module::from_definition");
194 match src.value { 197 match src.value {
195 ModuleSource::Module(ref module) => { 198 ModuleSource::Module(ref module) => {
196 assert!(!module.has_semi()); 199 assert!(!module.has_semi());
@@ -214,6 +217,7 @@ impl Module {
214} 217}
215 218
216fn analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> DynMap { 219fn analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> DynMap {
220 let _p = profile("analyze_container");
217 return child_by_source(db, src).unwrap_or_default(); 221 return child_by_source(db, src).unwrap_or_default();
218 222
219 fn child_by_source(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> { 223 fn child_by_source(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> {
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());