diff options
Diffstat (limited to 'crates/ra_analysis/src/hir')
-rw-r--r-- | crates/ra_analysis/src/hir/function/mod.rs | 20 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/mod.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/module/nameres.rs | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_analysis/src/hir/function/mod.rs b/crates/ra_analysis/src/hir/function/mod.rs index d171b6a8d..9ca8f4e7c 100644 --- a/crates/ra_analysis/src/hir/function/mod.rs +++ b/crates/ra_analysis/src/hir/function/mod.rs | |||
@@ -25,43 +25,43 @@ impl FnId { | |||
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | pub(crate) struct FunctionDescriptor { | 28 | pub(crate) struct Function { |
29 | fn_id: FnId, | 29 | fn_id: FnId, |
30 | } | 30 | } |
31 | 31 | ||
32 | impl FunctionDescriptor { | 32 | impl Function { |
33 | pub(crate) fn guess_from_source( | 33 | pub(crate) fn guess_from_source( |
34 | db: &impl HirDatabase, | 34 | db: &impl HirDatabase, |
35 | file_id: FileId, | 35 | file_id: FileId, |
36 | fn_def: ast::FnDef, | 36 | fn_def: ast::FnDef, |
37 | ) -> FunctionDescriptor { | 37 | ) -> Function { |
38 | let fn_id = FnId::get(db, file_id, fn_def); | 38 | let fn_id = FnId::get(db, file_id, fn_def); |
39 | FunctionDescriptor { fn_id } | 39 | Function { fn_id } |
40 | } | 40 | } |
41 | 41 | ||
42 | pub(crate) fn guess_for_name_ref( | 42 | pub(crate) fn guess_for_name_ref( |
43 | db: &impl HirDatabase, | 43 | db: &impl HirDatabase, |
44 | file_id: FileId, | 44 | file_id: FileId, |
45 | name_ref: ast::NameRef, | 45 | name_ref: ast::NameRef, |
46 | ) -> Option<FunctionDescriptor> { | 46 | ) -> Option<Function> { |
47 | FunctionDescriptor::guess_for_node(db, file_id, name_ref.syntax()) | 47 | Function::guess_for_node(db, file_id, name_ref.syntax()) |
48 | } | 48 | } |
49 | 49 | ||
50 | pub(crate) fn guess_for_bind_pat( | 50 | pub(crate) fn guess_for_bind_pat( |
51 | db: &impl HirDatabase, | 51 | db: &impl HirDatabase, |
52 | file_id: FileId, | 52 | file_id: FileId, |
53 | bind_pat: ast::BindPat, | 53 | bind_pat: ast::BindPat, |
54 | ) -> Option<FunctionDescriptor> { | 54 | ) -> Option<Function> { |
55 | FunctionDescriptor::guess_for_node(db, file_id, bind_pat.syntax()) | 55 | Function::guess_for_node(db, file_id, bind_pat.syntax()) |
56 | } | 56 | } |
57 | 57 | ||
58 | fn guess_for_node( | 58 | fn guess_for_node( |
59 | db: &impl HirDatabase, | 59 | db: &impl HirDatabase, |
60 | file_id: FileId, | 60 | file_id: FileId, |
61 | node: SyntaxNodeRef, | 61 | node: SyntaxNodeRef, |
62 | ) -> Option<FunctionDescriptor> { | 62 | ) -> Option<Function> { |
63 | let fn_def = node.ancestors().find_map(ast::FnDef::cast)?; | 63 | let fn_def = node.ancestors().find_map(ast::FnDef::cast)?; |
64 | let res = FunctionDescriptor::guess_from_source(db, file_id, fn_def); | 64 | let res = Function::guess_from_source(db, file_id, fn_def); |
65 | Some(res) | 65 | Some(res) |
66 | } | 66 | } |
67 | 67 | ||
diff --git a/crates/ra_analysis/src/hir/mod.rs b/crates/ra_analysis/src/hir/mod.rs index 1de8fadcf..863ffd919 100644 --- a/crates/ra_analysis/src/hir/mod.rs +++ b/crates/ra_analysis/src/hir/mod.rs | |||
@@ -20,7 +20,7 @@ use crate::{ | |||
20 | pub(crate) use self::{ | 20 | pub(crate) use self::{ |
21 | path::{Path, PathKind}, | 21 | path::{Path, PathKind}, |
22 | module::{Module, ModuleId, Problem, nameres::FileItemId}, | 22 | module::{Module, ModuleId, Problem, nameres::FileItemId}, |
23 | function::{FunctionDescriptor, FnScopes}, | 23 | function::{Function, FnScopes}, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | pub use self::function::FnSignatureInfo; | 26 | pub use self::function::FnSignatureInfo; |
diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index db5d6d9c0..2ff5e0537 100644 --- a/crates/ra_analysis/src/hir/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs | |||
@@ -371,7 +371,7 @@ mod tests { | |||
371 | use crate::{ | 371 | use crate::{ |
372 | AnalysisChange, | 372 | AnalysisChange, |
373 | mock_analysis::{MockAnalysis, analysis_and_position}, | 373 | mock_analysis::{MockAnalysis, analysis_and_position}, |
374 | hir::{HirDatabase, module::ModuleDescriptor}, | 374 | hir::{self, HirDatabase}, |
375 | input::FilesDatabase, | 375 | input::FilesDatabase, |
376 | }; | 376 | }; |
377 | use super::*; | 377 | use super::*; |
@@ -380,7 +380,7 @@ mod tests { | |||
380 | let (analysis, pos) = analysis_and_position(fixture); | 380 | let (analysis, pos) = analysis_and_position(fixture); |
381 | let db = analysis.imp.db; | 381 | let db = analysis.imp.db; |
382 | let source_root = db.file_source_root(pos.file_id); | 382 | let source_root = db.file_source_root(pos.file_id); |
383 | let descr = ModuleDescriptor::guess_from_position(&*db, pos) | 383 | let descr = hir::Module::guess_from_position(&*db, pos) |
384 | .unwrap() | 384 | .unwrap() |
385 | .unwrap(); | 385 | .unwrap(); |
386 | let module_id = descr.module_id; | 386 | let module_id = descr.module_id; |