diff options
| author | John Clements <clements@racket-lang.org> | 2013-04-04 14:30:43 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-04-28 09:49:20 -0700 |
| commit | 50a7f5483b4f474d7469ea7709aed8e370eab5ba (patch) | |
| tree | 0f40d7387045adc326f3da5bb4684ace18a0aa65 /src/libsyntax/parse/parser.rs | |
| parent | 2b7f1a4f2437eb20dc71eeda13976249f02ad408 (diff) | |
| download | rust-50a7f5483b4f474d7469ea7709aed8e370eab5ba.tar.gz rust-50a7f5483b4f474d7469ea7709aed8e370eab5ba.zip | |
refactor parse_fn_decl
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9ebc6af04a9..0afef442efc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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, |
