From 77b06d24cd76bf808138f1f7df4dcff40260ff38 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 2 Feb 2012 16:50:17 -0800 Subject: infer modes rather than overwriting with expected ty --- src/comp/syntax/print/pprust.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/comp/syntax/print/pprust.rs') diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index f4a04c145d7..864702d2ba1 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -136,7 +136,7 @@ fn res_to_str(decl: ast::fn_decl, name: ast::ident, fn test_res_to_str() { let decl: ast::fn_decl = { inputs: [{ - mode: ast::by_val, + mode: ast::expl(ast::by_val), ty: @ast_util::respan(ast_util::dummy_sp(), ast::ty_bool), ident: "b", id: 0 @@ -1280,17 +1280,22 @@ fn print_fn_block_args(s: ps, decl: ast::fn_decl) { maybe_print_comment(s, decl.output.span.lo); } -fn print_arg_mode(s: ps, m: ast::mode) { +fn mode_to_str(m: ast::mode) -> str { alt m { - ast::by_mut_ref { word(s.s, "&"); } - ast::by_move { word(s.s, "-"); } - ast::by_ref { word(s.s, "&&"); } - ast::by_val { word(s.s, "++"); } - ast::by_copy { word(s.s, "+"); } - ast::mode_infer {} + ast::expl(ast::by_mut_ref) { "&" } + ast::expl(ast::by_move) { "-" } + ast::expl(ast::by_ref) { "&&" } + ast::expl(ast::by_val) { "++" } + ast::expl(ast::by_copy) { "+" } + ast::infer(_) { "" } } } +fn print_arg_mode(s: ps, m: ast::mode) { + let ms = mode_to_str(m); + if ms != "" { word(s.s, ms); } +} + fn print_bounds(s: ps, bounds: @[ast::ty_param_bound]) { if vec::len(*bounds) > 0u { word(s.s, ":"); -- cgit 1.4.1-3-g733a5