Skip to content

Commit

Permalink
use Ident in ItemFn
Browse files Browse the repository at this point in the history
  • Loading branch information
euclio committed Jan 6, 2019
1 parent b92552d commit 3dfe36d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/librustc/hir/intravisit.rs
Expand Up @@ -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]),
}

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/hir/map/blocks.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3dfe36d

Please sign in to comment.