about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-03-14 15:03:47 +0100
committerGraydon Hoare <graydon@mozilla.com>2011-03-14 14:57:13 -0700
commit77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d (patch)
tree47cc577ea9b74b14cd2cbc9008567813680175cc /src/comp
parentea5dc54c3f0444fd3f20191fa1b1d94372c74c65 (diff)
downloadrust-77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d.tar.gz
rust-77f4c52c3ed5a172cd0c3dbc28f1043dab5cf97d.zip
Make pretty-printer print 'with' clause in rec literals
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/pretty/pprust.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs
index 9ef9bb16141..413de413df6 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,_)) {