diff options
Diffstat (limited to 'crates/ra_analysis/src/hir/function/mod.rs')
-rw-r--r-- | crates/ra_analysis/src/hir/function/mod.rs | 20 |
1 files changed, 10 insertions, 10 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 | ||