diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-04-09 15:33:42 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-04-11 18:01:34 +0300 |
| commit | 0ac532686f0134d28602fdb01d7fe128bc2f498e (patch) | |
| tree | 923febef6cf5dbe55cff5aa98f38ec0b7e4760bc /src/libsyntax/print | |
| parent | 65abf96fb6630d7ddbcdc3b39f599c02ecfc2f1e (diff) | |
| download | rust-0ac532686f0134d28602fdb01d7fe128bc2f498e.tar.gz rust-0ac532686f0134d28602fdb01d7fe128bc2f498e.zip | |
syntax: remove ast::Sigil.
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 3e2509f4f6e..4d911f6a89b 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -483,14 +483,23 @@ impl<'a> State<'a> { f.fn_style, ast::Many, f.decl, None, &None, Some(&generics), None)); } - ast::TyClosure(f) => { + ast::TyClosure(f, ref region) => { let generics = ast::Generics { lifetimes: f.lifetimes.clone(), ty_params: OwnedSlice::empty() }; - try!(self.print_ty_fn(None, Some(f.sigil), &f.region, - f.fn_style, f.onceness, f.decl, None, &f.bounds, - Some(&generics), None)); + try!(self.print_ty_fn(None, Some('&'), region, f.fn_style, + f.onceness, f.decl, None, &f.bounds, + Some(&generics), None)); + } + ast::TyProc(f) => { + let generics = ast::Generics { + lifetimes: f.lifetimes.clone(), + ty_params: OwnedSlice::empty() + }; + try!(self.print_ty_fn(None, Some('~'), &None, f.fn_style, + f.onceness, f.decl, None, &f.bounds, + Some(&generics), None)); } ast::TyPath(ref path, ref bounds, _) => { try!(self.print_bounded_path(path, bounds)); @@ -1716,8 +1725,7 @@ impl<'a> State<'a> { opt_explicit_self: Option<ast::ExplicitSelf_>, vis: ast::Visibility) -> IoResult<()> { try!(self.head("")); - try!(self.print_fn_header_info(opt_explicit_self, fn_style, abi, - ast::Many, None, vis)); + try!(self.print_fn_header_info(opt_explicit_self, fn_style, abi, vis)); try!(self.nbsp()); try!(self.print_ident(name)); try!(self.print_generics(generics)); @@ -2023,7 +2031,7 @@ impl<'a> State<'a> { pub fn print_ty_fn(&mut self, opt_abi: Option<abi::Abi>, - opt_sigil: Option<ast::Sigil>, + opt_sigil: Option<char>, opt_region: &Option<ast::Lifetime>, fn_style: ast::FnStyle, onceness: ast::Onceness, @@ -2037,15 +2045,15 @@ impl<'a> State<'a> { // Duplicates the logic in `print_fn_header_info()`. This is because that // function prints the sigil in the wrong place. That should be fixed. - if opt_sigil == Some(ast::OwnedSigil) && onceness == ast::Once { + if opt_sigil == Some('~') && onceness == ast::Once { try!(word(&mut self.s, "proc")); - } else if opt_sigil == Some(ast::BorrowedSigil) { + } else if opt_sigil == Some('&') { try!(self.print_extern_opt_abi(opt_abi)); try!(self.print_fn_style(fn_style)); try!(self.print_onceness(onceness)); } else { + assert!(opt_sigil.is_none()); try!(self.print_opt_abi_and_extern_if_nondefault(opt_abi)); - try!(self.print_opt_sigil(opt_sigil)); try!(self.print_fn_style(fn_style)); try!(self.print_onceness(onceness)); try!(word(&mut self.s, "fn")); @@ -2062,7 +2070,7 @@ impl<'a> State<'a> { match generics { Some(g) => try!(self.print_generics(g)), _ => () } try!(zerobreak(&mut self.s)); - if opt_sigil == Some(ast::BorrowedSigil) { + if opt_sigil == Some('&') { try!(word(&mut self.s, "|")); } else { try!(self.popen()); @@ -2070,7 +2078,7 @@ impl<'a> State<'a> { try!(self.print_fn_args(decl, opt_explicit_self)); - if opt_sigil == Some(ast::BorrowedSigil) { + if opt_sigil == Some('&') { try!(word(&mut self.s, "|")); } else { if decl.variadic { @@ -2327,22 +2335,10 @@ impl<'a> State<'a> { } } - pub fn print_opt_sigil(&mut self, - opt_sigil: Option<ast::Sigil>) -> IoResult<()> { - match opt_sigil { - Some(ast::BorrowedSigil) => word(&mut self.s, "&"), - Some(ast::OwnedSigil) => word(&mut self.s, "~"), - Some(ast::ManagedSigil) => word(&mut self.s, "@"), - None => Ok(()) - } - } - pub fn print_fn_header_info(&mut self, _opt_explicit_self: Option<ast::ExplicitSelf_>, opt_fn_style: Option<ast::FnStyle>, abi: abi::Abi, - onceness: ast::Onceness, - opt_sigil: Option<ast::Sigil>, vis: ast::Visibility) -> IoResult<()> { try!(word(&mut self.s, visibility_qualified(vis, ""))); @@ -2357,9 +2353,7 @@ impl<'a> State<'a> { try!(self.print_opt_fn_style(opt_fn_style)); } - try!(self.print_onceness(onceness)); - try!(word(&mut self.s, "fn")); - self.print_opt_sigil(opt_sigil) + word(&mut self.s, "fn") } pub fn print_fn_style(&mut self, s: ast::FnStyle) -> IoResult<()> { |
