diff options
| author | Marijn Haverbeke <[email protected]> | 2011-03-14 15:03:47 +0100 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-14 14:57:13 -0700 |
| commit | 77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d (patch) | |
| tree | 47cc577ea9b74b14cd2cbc9008567813680175cc /src | |
| parent | Add functionality for running external programs to the std lib (diff) | |
| download | rust-77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d.tar.xz rust-77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d.zip | |
Make pretty-printer print 'with' clause in rec literals
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/pretty/pprust.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index 9ef9bb16..413de413 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -308,7 +308,7 @@ impure fn print_expr(ps s, @ast.expr expr) { commasep[ast.elt](s, exprs, f); pclose(s); } - case (ast.expr_rec(?fields,_,_)) { + case (ast.expr_rec(?fields,?wth,_)) { impure fn print_field(ps s, ast.field field) { hbox(s); if (field.mut == ast.mut) {wrd1(s, "mutable");} @@ -321,6 +321,16 @@ impure fn print_expr(ps s, @ast.expr expr) { popen(s); auto f = print_field; commasep[ast.field](s, fields, f); + alt (wth) { + case (option.some[@ast.expr](?expr)) { + if (_vec.len[ast.field](fields) > 0u) {space(s);} + hbox(s); + wrd1(s, "with"); + print_expr(s, expr); + end(s); + } + case (_) {} + } pclose(s); } case (ast.expr_call(?func,?args,_)) { |