diff options
author | Aleksey Kladov <[email protected]> | 2018-11-27 20:48:24 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-27 20:48:24 +0000 |
commit | 7207eef716c0970df1b3523f8f4bb685518f8f73 (patch) | |
tree | 201c6357999f54a7ba5c9cbbc1ad9af31c8eb7c1 /crates/ra_analysis/src/hir/function | |
parent | 67de38ec7d5c235dec209fe859d6bf6b0dbe497a (diff) |
rename FnDescriptior -> FnSignatureInfo
Diffstat (limited to 'crates/ra_analysis/src/hir/function')
-rw-r--r-- | crates/ra_analysis/src/hir/function/mod.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/hir/function/mod.rs b/crates/ra_analysis/src/hir/function/mod.rs index 8161a604f..5e44a88a7 100644 --- a/crates/ra_analysis/src/hir/function/mod.rs +++ b/crates/ra_analysis/src/hir/function/mod.rs | |||
@@ -42,10 +42,15 @@ impl FunctionDescriptor { | |||
42 | pub(crate) fn scope(&self, db: &impl HirDatabase) -> Arc<FnScopes> { | 42 | pub(crate) fn scope(&self, db: &impl HirDatabase) -> Arc<FnScopes> { |
43 | db.fn_scopes(self.fn_id) | 43 | db.fn_scopes(self.fn_id) |
44 | } | 44 | } |
45 | |||
46 | pub(crate) fn signature_info(&self, db: &impl HirDatabase) -> Option<FnSignatureInfo> { | ||
47 | let syntax = db.fn_syntax(self.fn_id); | ||
48 | FnSignatureInfo::new(syntax.borrowed()) | ||
49 | } | ||
45 | } | 50 | } |
46 | 51 | ||
47 | #[derive(Debug, Clone)] | 52 | #[derive(Debug, Clone)] |
48 | pub struct FnDescriptor { | 53 | pub struct FnSignatureInfo { |
49 | pub name: String, | 54 | pub name: String, |
50 | pub label: String, | 55 | pub label: String, |
51 | pub ret_type: Option<String>, | 56 | pub ret_type: Option<String>, |
@@ -53,8 +58,8 @@ pub struct FnDescriptor { | |||
53 | pub doc: Option<String>, | 58 | pub doc: Option<String>, |
54 | } | 59 | } |
55 | 60 | ||
56 | impl FnDescriptor { | 61 | impl FnSignatureInfo { |
57 | pub fn new(node: ast::FnDef) -> Option<Self> { | 62 | fn new(node: ast::FnDef) -> Option<Self> { |
58 | let name = node.name()?.text().to_string(); | 63 | let name = node.name()?.text().to_string(); |
59 | 64 | ||
60 | let mut doc = None; | 65 | let mut doc = None; |
@@ -73,7 +78,7 @@ impl FnDescriptor { | |||
73 | node.syntax().text().to_string() | 78 | node.syntax().text().to_string() |
74 | }; | 79 | }; |
75 | 80 | ||
76 | if let Some((comment_range, docs)) = FnDescriptor::extract_doc_comments(node) { | 81 | if let Some((comment_range, docs)) = FnSignatureInfo::extract_doc_comments(node) { |
77 | let comment_range = comment_range | 82 | let comment_range = comment_range |
78 | .checked_sub(node.syntax().range().start()) | 83 | .checked_sub(node.syntax().range().start()) |
79 | .unwrap(); | 84 | .unwrap(); |
@@ -105,10 +110,10 @@ impl FnDescriptor { | |||
105 | } | 110 | } |
106 | } | 111 | } |
107 | 112 | ||
108 | let params = FnDescriptor::param_list(node); | 113 | let params = FnSignatureInfo::param_list(node); |
109 | let ret_type = node.ret_type().map(|r| r.syntax().text().to_string()); | 114 | let ret_type = node.ret_type().map(|r| r.syntax().text().to_string()); |
110 | 115 | ||
111 | Some(FnDescriptor { | 116 | Some(FnSignatureInfo { |
112 | name, | 117 | name, |
113 | ret_type, | 118 | ret_type, |
114 | params, | 119 | params, |