diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-09-11 21:25:01 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-09-11 21:25:01 -0700 |
| commit | 8a8f200d102294cf1bd90cdacad995abccda7934 (patch) | |
| tree | 31e99a460697349c403fc5cf4809427303e14804 /src/libsyntax/print | |
| parent | 02b41097e42082a306ca6dbbd79ee9a1d7d35348 (diff) | |
| download | rust-8a8f200d102294cf1bd90cdacad995abccda7934.tar.gz rust-8a8f200d102294cf1bd90cdacad995abccda7934.zip | |
Introduce auto adjustment table to subsume autoderef/autoref/borrowings.
Fixes #3261 Fixes #3443
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 46fbaed8b5d..49133242d54 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -976,6 +976,16 @@ fn print_vstore(s: ps, t: ast::vstore) { } } +fn print_expr_vstore(s: ps, t: ast::expr_vstore) { + match t { + ast::expr_vstore_fixed(Some(i)) => word(s.s, fmt!("%u", i)), + ast::expr_vstore_fixed(None) => word(s.s, ~"_"), + ast::expr_vstore_uniq => word(s.s, ~"~"), + ast::expr_vstore_box => word(s.s, ~"@"), + ast::expr_vstore_slice => word(s.s, ~"&"), + } +} + fn print_expr(s: ps, &&expr: @ast::expr) { fn print_field(s: ps, field: ast::field) { ibox(s, indent_unit); @@ -992,17 +1002,17 @@ fn print_expr(s: ps, &&expr: @ast::expr) { let ann_node = node_expr(s, expr); s.ann.pre(ann_node); match expr.node { - ast::expr_vstore(e, v) => match v { - ast::vstore_fixed(_) => { - print_expr(s, e); - word(s.s, ~"/"); - print_vstore(s, v); - } - _ => { - print_vstore(s, v); - print_expr(s, e); - } - }, + ast::expr_vstore(e, v) => match v { + ast::expr_vstore_fixed(_) => { + print_expr(s, e); + word(s.s, ~"/"); + print_expr_vstore(s, v); + } + _ => { + print_expr_vstore(s, v); + print_expr(s, e); + } + }, ast::expr_vec(exprs, mutbl) => { ibox(s, indent_unit); word(s.s, ~"["); |
