From 8b56a8380b6cca384f4ade7aa1a07b0c5eb77d60 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 25 Mar 2013 13:21:04 -0700 Subject: librustc: Modify all code to use new lifetime binder syntax --- src/libsyntax/parse/parser.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 962607ffec4..cc0196d18de 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -362,10 +362,11 @@ pub impl Parser { let purity = self.parse_purity(); self.expect_keyword(&~"fn"); + let (decl, _) = self.parse_ty_fn_decl(); return ty_bare_fn(@TyBareFn { abi: RustAbi, purity: purity, - decl: self.parse_ty_fn_decl() + decl: decl }); } @@ -400,12 +401,15 @@ pub impl Parser { ObsoletePostFnTySigil); } + let (decl, lifetimes) = self.parse_ty_fn_decl(); + return ty_closure(@TyClosure { sigil: sigil, region: region, purity: purity, onceness: onceness, - decl: self.parse_ty_fn_decl() + decl: decl, + lifetimes: lifetimes, }); fn parse_onceness(self: &Parser) -> Onceness { @@ -424,7 +428,7 @@ pub impl Parser { } } - fn parse_ty_fn_decl(&self) -> fn_decl { + fn parse_ty_fn_decl(&self) -> (fn_decl, OptVec) { /* (fn) <'lt> (S) -> T @@ -435,10 +439,14 @@ pub impl Parser { Lifetimes */ - if self.eat(&token::LT) { - let _lifetimes = self.parse_lifetimes(); + let lifetimes = if self.eat(&token::LT) { + let lifetimes = self.parse_lifetimes(); self.expect_gt(); - } + lifetimes + } else { + opt_vec::Empty + }; + let inputs = self.parse_unspanned_seq( &token::LPAREN, &token::RPAREN, @@ -446,7 +454,12 @@ pub impl Parser { |p| p.parse_arg_general(false) ); let (ret_style, ret_ty) = self.parse_ret_ty(); - ast::fn_decl { inputs: inputs, output: ret_ty, cf: ret_style } + let decl = ast::fn_decl { + inputs: inputs, + output: ret_ty, + cf: ret_style + }; + (decl, lifetimes) } fn parse_trait_methods(&self) -> ~[trait_method] { -- cgit 1.4.1-3-g733a5