Pretty-print ivecs as []

This commit is contained in:
Brian Anderson 2011-08-17 16:20:53 -07:00
parent 079fae28e6
commit 53eb4a3025
3 changed files with 22 additions and 26 deletions

View File

@ -720,11 +720,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
alt expr.node {
ast::expr_vec(exprs, mut, kind) {
ibox(s, indent_unit);
alt kind {
ast::sk_rc. { word(s.s, "["); }
ast::sk_unique. { word(s.s, "~["); }
}
word(s.s, "[");
if mut == ast::mut {
word(s.s, "mutable");
if vec::len(exprs) > 0u { nbsp(s); }

View File

@ -2,4 +2,4 @@
fn f1(x: [int]) { }
fn g1() { f1(~[1, 2, 3]); }
fn g1() { f1([1, 2, 3]); }

View File

@ -3,7 +3,7 @@
// pp-exact:vec-comments.pp
fn main() {
let v1 =
~[
[
// Comment
0,
// Comment
@ -11,11 +11,11 @@ fn main() {
// Comment
2];
let v2 =
~[0, // Comment
[0, // Comment
1, // Comment
2]; // Comment
let v3 =
~[
[
/* Comment */
0,
/* Comment */
@ -23,7 +23,7 @@ fn main() {
/* Comment */
2];
let v4 =
~[0, /* Comment */
[0, /* Comment */
1, /* Comment */
2]; /* Comment */
}