use Ident in ItemFn

This commit is contained in:
Andy Russell 2019-01-03 14:28:20 -05:00
parent b92552d557
commit 3dfe36d094
No known key found for this signature in database
GPG Key ID: BE2221033EDBC374
2 changed files with 9 additions and 9 deletions

View File

@ -42,13 +42,13 @@ use std::cmp;
#[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]),
}
@ -472,7 +472,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
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,

View File

@ -15,7 +15,7 @@ use hir as ast;
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
@ -98,7 +98,7 @@ impl<'a> Code<'a> {
/// 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,
@ -200,7 +200,7 @@ impl<'a> FnLikeNode<'a> {
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)
@ -228,7 +228,7 @@ impl<'a> FnLikeNode<'a> {
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,