mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
refactor parse_fn_decl
This commit is contained in:
parent
2b7f1a4f24
commit
50a7f5483b
@ -259,7 +259,7 @@ pub impl Parser {
|
||||
fn try_parse_obsolete_struct_ctor(&self) -> bool {
|
||||
if self.eat_obsolete_ident("new") {
|
||||
self.obsolete(*self.last_span, ObsoleteStructCtor);
|
||||
self.parse_fn_decl(|p| p.parse_arg());
|
||||
self.parse_fn_decl();
|
||||
self.parse_block();
|
||||
true
|
||||
} else {
|
||||
|
@ -2844,7 +2844,8 @@ pub impl Parser {
|
||||
(lifetimes, opt_vec::take_vec(result))
|
||||
}
|
||||
|
||||
fn parse_fn_decl(&self, parse_arg_fn: &fn(&Parser) -> arg_or_capture_item)
|
||||
// parse the argument list and result type of a function declaration
|
||||
fn parse_fn_decl(&self)
|
||||
-> fn_decl
|
||||
{
|
||||
let args_or_capture_items: ~[arg_or_capture_item] =
|
||||
@ -2852,7 +2853,7 @@ pub impl Parser {
|
||||
&token::LPAREN,
|
||||
&token::RPAREN,
|
||||
seq_sep_trailing_disallowed(token::COMMA),
|
||||
parse_arg_fn
|
||||
|p| p.parse_arg()
|
||||
);
|
||||
|
||||
let inputs = either::lefts(args_or_capture_items);
|
||||
@ -3081,7 +3082,7 @@ pub impl Parser {
|
||||
// parse an item-position function declaration.
|
||||
fn parse_item_fn(&self, purity: purity, abis: AbiSet) -> item_info {
|
||||
let (ident, generics) = self.parse_fn_header();
|
||||
let decl = self.parse_fn_decl(|p| p.parse_arg());
|
||||
let decl = self.parse_fn_decl();
|
||||
let (inner_attrs, body) = self.parse_inner_attrs_and_block(true);
|
||||
(ident,
|
||||
item_fn(decl, purity, abis, generics, body),
|
||||
@ -3593,7 +3594,7 @@ pub impl Parser {
|
||||
let vis = self.parse_visibility();
|
||||
let purity = self.parse_fn_purity();
|
||||
let (ident, generics) = self.parse_fn_header();
|
||||
let decl = self.parse_fn_decl(|p| p.parse_arg());
|
||||
let decl = self.parse_fn_decl();
|
||||
let hi = self.span.hi;
|
||||
self.expect(&token::SEMI);
|
||||
@ast::foreign_item { ident: ident,
|
||||
|
Loading…
Reference in New Issue
Block a user