about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-06-30 16:03:07 -0700
committerBrian Anderson <banderson@mozilla.com>2011-06-30 16:08:28 -0700
commit50b1953f9b13342fa8034f91164ae8bb34d43207 (patch)
tree47e7b9c952c362cdddf84ab6edc7faabda7c8e4b /src/comp
parent1e63d5303f19b103393195a64d1069728015358f (diff)
downloadrust-50b1953f9b13342fa8034f91164ae8bb34d43207.tar.gz
rust-50b1953f9b13342fa8034f91164ae8bb34d43207.zip
Pretty-print view items in mod items
For mods that aren't defined at the file level we were forgetting to print the
view items so, e.g. 'mod { use std; }' would not print correctly.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/pretty/pprust.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs
index 433a7234dd4..9cc017a221f 100644
--- a/src/comp/pretty/pprust.rs
+++ b/src/comp/pretty/pprust.rs
@@ -41,8 +41,7 @@ fn print_crate(session sess, @ast::crate crate, str filename,
              mutable cur_lit=0u,
              mutable boxes=boxes,
              mode=mode);
-    print_inner_attributes(s, crate.node.attrs);
-    print_mod(s, crate.node.module);
+    print_mod(s, crate.node.module, crate.node.attrs);
     eof(s.s);
 }
 
@@ -186,7 +185,8 @@ fn commasep_exprs(&ps s, breaks b, vec[@ast::expr] exprs) {
     commasep_cmnt(s, b, exprs, print_expr, expr_span);
 }
 
-fn print_mod(&ps s, ast::_mod _mod) {
+fn print_mod(&ps s, ast::_mod _mod, &vec[ast::attribute] attrs) {
+    print_inner_attributes(s, attrs);
     for (@ast::view_item vitem in _mod.view_items) {
         print_view_item(s, vitem);
     }
@@ -322,8 +322,7 @@ fn print_item(&ps s, &@ast::item item) {
             head(s, "mod");
             word_nbsp(s, item.ident);
             bopen(s);
-            print_inner_attributes(s, item.attrs);
-            for (@ast::item itm in _mod.items) { print_item(s, itm); }
+            print_mod(s, _mod, item.attrs);
             bclose(s, item.span);
         }
         case (ast::item_native_mod(?nmod)) {