#[derive(Copy, Clone)]
pub enum FnKind<'a> {
- /// #[xxx] pub async/const/extern "Abi" fn foo()
- ItemFn(Name, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]),
+ /// `#[xxx] pub async/const/extern "Abi" fn foo()`
+ ItemFn(Ident, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]),
- /// fn foo(&self)
+ /// `fn foo(&self)`
Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a [Attribute]),
- /// |x, y| {}
+ /// `|x, y| {}`
Closure(&'a [Attribute]),
}
visitor.visit_nested_body(body);
}
ItemKind::Fn(ref declaration, header, ref generics, body_id) => {
- visitor.visit_fn(FnKind::ItemFn(item.ident.name,
+ visitor.visit_fn(FnKind::ItemFn(item.ident,
generics,
header,
&item.vis,
use hir::map;
use hir::{Expr, FnDecl, Node};
use hir::intravisit::FnKind;
-use syntax::ast::{Attribute, Ident, Name, NodeId};
+use syntax::ast::{Attribute, Ident, NodeId};
use syntax_pos::Span;
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
/// These are all the components one can extract from a fn item for
/// use when implementing FnLikeNode operations.
struct ItemFnParts<'a> {
- name: Name,
+ ident: Ident,
decl: &'a ast::FnDecl,
header: ast::FnHeader,
vis: &'a ast::Visibility,
pub fn kind(self) -> FnKind<'a> {
let item = |p: ItemFnParts<'a>| -> FnKind<'a> {
- FnKind::ItemFn(p.name, p.generics, p.header, p.vis, p.attrs)
+ FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs)
};
let closure = |c: ClosureParts<'a>| {
FnKind::Closure(c.attrs)
ast::ItemKind::Fn(ref decl, header, ref generics, block) =>
item_fn(ItemFnParts {
id: i.id,
- name: i.ident.name,
+ ident: i.ident,
decl: &decl,
body: block,
vis: &i.vis,