From 7207eef716c0970df1b3523f8f4bb685518f8f73 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 27 Nov 2018 23:48:24 +0300 Subject: rename FnDescriptior -> FnSignatureInfo --- crates/ra_analysis/src/hir/function/mod.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/ra_analysis/src/hir/function') 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 { pub(crate) fn scope(&self, db: &impl HirDatabase) -> Arc { db.fn_scopes(self.fn_id) } + + pub(crate) fn signature_info(&self, db: &impl HirDatabase) -> Option { + let syntax = db.fn_syntax(self.fn_id); + FnSignatureInfo::new(syntax.borrowed()) + } } #[derive(Debug, Clone)] -pub struct FnDescriptor { +pub struct FnSignatureInfo { pub name: String, pub label: String, pub ret_type: Option, @@ -53,8 +58,8 @@ pub struct FnDescriptor { pub doc: Option, } -impl FnDescriptor { - pub fn new(node: ast::FnDef) -> Option { +impl FnSignatureInfo { + fn new(node: ast::FnDef) -> Option { let name = node.name()?.text().to_string(); let mut doc = None; @@ -73,7 +78,7 @@ impl FnDescriptor { node.syntax().text().to_string() }; - if let Some((comment_range, docs)) = FnDescriptor::extract_doc_comments(node) { + if let Some((comment_range, docs)) = FnSignatureInfo::extract_doc_comments(node) { let comment_range = comment_range .checked_sub(node.syntax().range().start()) .unwrap(); @@ -105,10 +110,10 @@ impl FnDescriptor { } } - let params = FnDescriptor::param_list(node); + let params = FnSignatureInfo::param_list(node); let ret_type = node.ret_type().map(|r| r.syntax().text().to_string()); - Some(FnDescriptor { + Some(FnSignatureInfo { name, ret_type, params, -- cgit v1.2.3