Skip to content

Commit 8717372

Browse files
committed
cleanup
1 parent b12d83b commit 8717372

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

jscomp/syntax/src/res_printer.ml

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,34 +2602,33 @@ and print_pattern_record_row ~state row cmt_tbl =
26022602
print_comments doc cmt_tbl loc_for_comments
26032603

26042604
and print_pattern_dict_row ~state
2605-
(row : Longident.t Location.loc * Parsetree.pattern) cmt_tbl =
2606-
match row with
2607-
| longident, pattern ->
2608-
let loc_for_comments =
2609-
{longident.loc with loc_end = pattern.ppat_loc.loc_end}
2610-
in
2611-
let rhs_doc =
2612-
let doc = print_pattern ~state pattern cmt_tbl in
2613-
let doc =
2614-
if Parens.pattern_record_row_rhs pattern then add_parens doc else doc
2615-
in
2616-
Doc.concat [print_optional_label pattern.ppat_attributes; doc]
2617-
in
2618-
let lbl_doc =
2619-
Doc.concat [Doc.text "\""; print_longident longident.txt; Doc.text "\""]
2620-
in
2605+
((longident, pattern) : Longident.t Location.loc * Parsetree.pattern)
2606+
cmt_tbl =
2607+
let loc_for_comments =
2608+
{longident.loc with loc_end = pattern.ppat_loc.loc_end}
2609+
in
2610+
let rhs_doc =
2611+
let doc = print_pattern ~state pattern cmt_tbl in
26212612
let doc =
2622-
Doc.group
2623-
(Doc.concat
2624-
[
2625-
lbl_doc;
2626-
Doc.text ":";
2627-
(if ParsetreeViewer.is_huggable_pattern pattern then
2628-
Doc.concat [Doc.space; rhs_doc]
2629-
else Doc.indent (Doc.concat [Doc.line; rhs_doc]));
2630-
])
2613+
if Parens.pattern_record_row_rhs pattern then add_parens doc else doc
26312614
in
2632-
print_comments doc cmt_tbl loc_for_comments
2615+
Doc.concat [print_optional_label pattern.ppat_attributes; doc]
2616+
in
2617+
let lbl_doc =
2618+
Doc.concat [Doc.text "\""; print_longident longident.txt; Doc.text "\""]
2619+
in
2620+
let doc =
2621+
Doc.group
2622+
(Doc.concat
2623+
[
2624+
lbl_doc;
2625+
Doc.text ":";
2626+
(if ParsetreeViewer.is_huggable_pattern pattern then
2627+
Doc.concat [Doc.space; rhs_doc]
2628+
else Doc.indent (Doc.concat [Doc.line; rhs_doc]));
2629+
])
2630+
in
2631+
print_comments doc cmt_tbl loc_for_comments
26332632

26342633
and print_expression_with_comments ~state expr cmt_tbl : Doc.t =
26352634
let doc = print_expression ~state expr cmt_tbl in

0 commit comments

Comments
 (0)