about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-09-15 18:14:14 -0700
committerGraydon Hoare <graydon@mozilla.com>2010-09-15 18:14:14 -0700
commite270ab6fbfcfcca44ac5ee028da2b4d91fe29419 (patch)
tree805791ed44d20d9a0aade8ad41f418013ff038b7
parente6729a66ecd10a8606488e16a32812fa378bdafe (diff)
downloadrust-e270ab6fbfcfcca44ac5ee028da2b4d91fe29419.tar.gz
rust-e270ab6fbfcfcca44ac5ee028da2b4d91fe29419.zip
Minor improvements to pretty-printer.
-rw-r--r--src/boot/fe/ast.ml21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index 44c56d62341..adc6f60d72e 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -714,8 +714,12 @@ and fmt_ty_fn
     end;
     fmt_slots ff tsig.sig_input_slots None;
     fmt_decl_constrs ff tsig.sig_input_constrs;
-    fmt ff " -> ";
-    fmt_slot ff tsig.sig_output_slot;
+    if tsig.sig_output_slot.slot_ty <> (Some TY_nil)
+    then
+      begin
+        fmt ff " -> ";
+        fmt_slot ff tsig.sig_output_slot;
+      end
 
 and fmt_constrained ff (ty, constrs) : unit =
   fmt ff "@[";
@@ -1607,8 +1611,12 @@ and fmt_fn
   fmt_ident_and_params ff id params;
   fmt_header_slots ff f.fn_input_slots;
   fmt_decl_constrs ff f.fn_input_constrs;
-  fmt ff " -> ";
-  fmt_slot ff f.fn_output_slot.node;
+  if f.fn_output_slot.node.slot_ty <> (Some TY_nil)
+  then
+    begin
+      fmt ff " -> ";
+      fmt_slot ff f.fn_output_slot.node;
+    end;
   fmt ff " ";
   fmt_obr ff;
   fmt_stmts ff f.fn_body.node;
@@ -1713,6 +1721,7 @@ and fmt_import (ff:Format.formatter) (ident:ident) (name:name) : unit =
   fmt ff "import ";
   fmt ff "%s = " ident;
   fmt_name ff name;
+  fmt ff ";";
 
 and fmt_export (ff:Format.formatter) (export:export) _ : unit =
   fmt ff "@\n";
@@ -1722,7 +1731,9 @@ and fmt_export (ff:Format.formatter) (export:export) _ : unit =
 
 and fmt_mod_view (ff:Format.formatter) (mv:mod_view) : unit =
   Hashtbl.iter (fmt_import ff) mv.view_imports;
-  Hashtbl.iter (fmt_export ff) mv.view_exports
+  if not ((Hashtbl.length mv.view_exports = 1) &&
+            (Hashtbl.mem mv.view_exports EXPORT_all_decls))
+  then Hashtbl.iter (fmt_export ff) mv.view_exports
 
 and fmt_mod_items (ff:Format.formatter) (mi:mod_items) : unit =
   Hashtbl.iter (fmt_mod_item ff) mi