Add FunctionSignature::from_hir
This commit is contained in:
@@ -5,6 +5,7 @@ use std::fmt::{self, Display};
|
||||
use join_to_string::join;
|
||||
use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner, TypeParamsOwner};
|
||||
use std::convert::From;
|
||||
use hir::Docs;
|
||||
|
||||
/// Contains information about a function signature
|
||||
#[derive(Debug)]
|
||||
@@ -30,6 +31,12 @@ impl FunctionSignature {
|
||||
self.doc = doc;
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self {
|
||||
let doc = function.docs(db);
|
||||
let (_, ast_node) = function.source(db);
|
||||
FunctionSignature::from(&*ast_node).with_doc_opt(doc)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'_ ast::FnDef> for FunctionSignature {
|
||||
|
||||
Reference in New Issue
Block a user