diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-02-25 22:05:07 +0200 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-05-21 11:47:30 -0400 |
| commit | af3795721cd9ffc591eeeb077df16d3658be150f (patch) | |
| tree | 045c56da8c0228dd3eed799475c86a0d8ff1dcc4 /src/libsyntax/ast_map | |
| parent | bc6318d2be4d9eb62af9170958fd48ef45e4a74e (diff) | |
| download | rust-af3795721cd9ffc591eeeb077df16d3658be150f.tar.gz rust-af3795721cd9ffc591eeeb077df16d3658be150f.zip | |
syntax: parse `const fn` for free functions and inherent methods.
Diffstat (limited to 'src/libsyntax/ast_map')
| -rw-r--r-- | src/libsyntax/ast_map/blocks.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/libsyntax/ast_map/blocks.rs b/src/libsyntax/ast_map/blocks.rs index 36a7f3a9381..8b2b2fbeca1 100644 --- a/src/libsyntax/ast_map/blocks.rs +++ b/src/libsyntax/ast_map/blocks.rs @@ -120,6 +120,7 @@ struct ItemFnParts<'a> { ident: ast::Ident, decl: &'a ast::FnDecl, unsafety: ast::Unsafety, + constness: ast::Constness, abi: abi::Abi, vis: ast::Visibility, generics: &'a ast::Generics, @@ -180,7 +181,7 @@ impl<'a> FnLikeNode<'a> { pub fn kind(self) -> visit::FnKind<'a> { let item = |p: ItemFnParts<'a>| -> visit::FnKind<'a> { - visit::FkItemFn(p.ident, p.generics, p.unsafety, p.abi, p.vis) + visit::FkItemFn(p.ident, p.generics, p.unsafety, p.abi, p.constness, p.vis) }; let closure = |_: ClosureParts| { visit::FkFnBlock @@ -204,10 +205,19 @@ impl<'a> FnLikeNode<'a> { { match self.node { ast_map::NodeItem(i) => match i.node { - ast::ItemFn(ref decl, unsafety, abi, ref generics, ref block) => - item_fn(ItemFnParts{ - ident: i.ident, decl: &**decl, unsafety: unsafety, body: &**block, - generics: generics, abi: abi, vis: i.vis, id: i.id, span: i.span + ast::ItemFn(ref decl, unsafety, constness, ref abi, ref generics, ref block) => + item_fn(ItemFnParts { + id: i.id, + ident: i.ident, + decl: &**decl, + unsafety: unsafety, + constness: constness, + body: &**block, + generics: generics, + abi: abi, + vis: i.vis, + constness: constness, + span: i.span }), _ => panic!("item FnLikeNode that is not fn-like"), }, |
