Skip to content

Commit e270ab6

Browse files
committed
Minor improvements to pretty-printer.
1 parent e6729a6 commit e270ab6

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/boot/fe/ast.ml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,12 @@ and fmt_ty_fn
714714
end;
715715
fmt_slots ff tsig.sig_input_slots None;
716716
fmt_decl_constrs ff tsig.sig_input_constrs;
717-
fmt ff " -> ";
718-
fmt_slot ff tsig.sig_output_slot;
717+
if tsig.sig_output_slot.slot_ty <> (Some TY_nil)
718+
then
719+
begin
720+
fmt ff " -> ";
721+
fmt_slot ff tsig.sig_output_slot;
722+
end
719723

720724
and fmt_constrained ff (ty, constrs) : unit =
721725
fmt ff "@[";
@@ -1607,8 +1611,12 @@ and fmt_fn
16071611
fmt_ident_and_params ff id params;
16081612
fmt_header_slots ff f.fn_input_slots;
16091613
fmt_decl_constrs ff f.fn_input_constrs;
1610-
fmt ff " -> ";
1611-
fmt_slot ff f.fn_output_slot.node;
1614+
if f.fn_output_slot.node.slot_ty <> (Some TY_nil)
1615+
then
1616+
begin
1617+
fmt ff " -> ";
1618+
fmt_slot ff f.fn_output_slot.node;
1619+
end;
16121620
fmt ff " ";
16131621
fmt_obr ff;
16141622
fmt_stmts ff f.fn_body.node;
@@ -1713,6 +1721,7 @@ and fmt_import (ff:Format.formatter) (ident:ident) (name:name) : unit =
17131721
fmt ff "import ";
17141722
fmt ff "%s = " ident;
17151723
fmt_name ff name;
1724+
fmt ff ";";
17161725

17171726
and fmt_export (ff:Format.formatter) (export:export) _ : unit =
17181727
fmt ff "@\n";
@@ -1722,7 +1731,9 @@ and fmt_export (ff:Format.formatter) (export:export) _ : unit =
17221731

17231732
and fmt_mod_view (ff:Format.formatter) (mv:mod_view) : unit =
17241733
Hashtbl.iter (fmt_import ff) mv.view_imports;
1725-
Hashtbl.iter (fmt_export ff) mv.view_exports
1734+
if not ((Hashtbl.length mv.view_exports = 1) &&
1735+
(Hashtbl.mem mv.view_exports EXPORT_all_decls))
1736+
then Hashtbl.iter (fmt_export ff) mv.view_exports
17261737

17271738
and fmt_mod_items (ff:Format.formatter) (mi:mod_items) : unit =
17281739
Hashtbl.iter (fmt_mod_item ff) mi

0 commit comments

Comments
 (0)