mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Add FunctionSignature::from_hir
This commit is contained in:
parent
2fe075f56e
commit
dfaebd76ab
2 changed files with 11 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue