diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-02-02 16:50:17 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-02-05 09:12:44 -0800 |
| commit | 77b06d24cd76bf808138f1f7df4dcff40260ff38 (patch) | |
| tree | 1830c6000f2c4a02be320e088389979cefb1414f /src/comp/syntax/print | |
| parent | 5163606d060ccb2c6462d34f590e2a1f30ce4a1f (diff) | |
| download | rust-77b06d24cd76bf808138f1f7df4dcff40260ff38.tar.gz rust-77b06d24cd76bf808138f1f7df4dcff40260ff38.zip | |
infer modes rather than overwriting with expected ty
Diffstat (limited to 'src/comp/syntax/print')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 21 |
1 files changed, 13 insertions, 8 deletions
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, ":"); |
