Skip to content

Commit efc4ca1

Browse files
committed
Cleanup
1 parent e71246b commit efc4ca1

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

compiler/syntax/src/res_core.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4957,7 +4957,6 @@ and parse_type_constructor_declarations ?first p =
49574957
let first_constr_decl =
49584958
match first with
49594959
| None ->
4960-
(* bar *)
49614960
let doc_comment_attrs =
49624961
match p.Parser.token with
49634962
| DocComment (loc, s) ->
@@ -5565,9 +5564,6 @@ and parse_type_equation_and_representation ?current_type_name_path
55655564
p
55665565
| Private -> parse_private_eq_or_repr p
55675566
| Bar | DotDot | DocComment _ ->
5568-
(* DOCCOMMENT: Reached here if the first variant starts with |.
5569-
It is possible that the first variant may not have | (with multiple variants)
5570-
*)
55715567
let priv, kind = parse_type_representation p in
55725568
(None, priv, kind)
55735569
| _ -> (

compiler/syntax/src/res_printer.ml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,37 +1549,11 @@ and print_constructor_declarations ~state ~private_flag
15491549

15501550
and print_constructor_declaration2 ~state i
15511551
(cd : Parsetree.constructor_declaration) cmt_tbl =
1552-
let comment_attrs, attrs =
1553-
List.partition
1554-
(fun ((id, payload) : Parsetree.attribute) ->
1555-
match (id, payload) with
1556-
| ( {txt = "res.doc"},
1557-
PStr
1558-
[
1559-
{
1560-
pstr_desc =
1561-
Pstr_eval
1562-
({pexp_desc = Pexp_constant (Pconst_string (_, _))}, _);
1563-
};
1564-
] ) ->
1565-
true
1566-
| _ -> false)
1567-
cd.pcd_attributes
1568-
in
1552+
let comment_attrs, attrs = ParsetreeViewer.partition_doc_comment_attributes cd.pcd_attributes in
15691553
let comment_doc =
15701554
match comment_attrs with
15711555
| [] -> Doc.nil
1572-
| comment_attrs ->
1573-
Doc.concat
1574-
[
1575-
Doc.group
1576-
(Doc.join_with_sep
1577-
(List.map
1578-
(fun attr -> print_attribute ~state attr cmt_tbl)
1579-
comment_attrs));
1580-
Doc.hard_line;
1581-
]
1582-
in
1556+
| comment_attrs -> print_doc_comments ~sep:Doc.hard_line ~state cmt_tbl comment_attrs in
15831557
let attrs = print_attributes ~state attrs cmt_tbl in
15841558
let is_dot_dot_dot = cd.pcd_name.txt = "..." in
15851559
let bar =

0 commit comments

Comments
 (0)