Skip to content

Commit 9a488e9

Browse files
committed
DRY code a bit
1 parent 490331a commit 9a488e9

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

compiler/syntax/src/res_printer.ml

+5-13
Original file line numberDiff line numberDiff line change
@@ -5044,20 +5044,12 @@ and print_argument ~state (arg_lbl, arg) cmt_tbl =
50445044
in
50455045
let printed_expr =
50465046
let doc = print_expression_with_comments ~state expr cmt_tbl in
5047-
let doc =
5048-
match Parens.expr expr with
5049-
| Parenthesized -> add_parens doc
5050-
| Braced braces -> print_braces doc expr braces
5051-
| Nothing -> doc
5052-
in
5053-
match expr.pexp_desc with
5054-
| Pexp_apply
5055-
{
5056-
funct = {pexp_desc = Pexp_ident {txt = Longident.Lident "~~"}};
5057-
args = [(Nolabel, _)];
5058-
} ->
5047+
match Parens.expr expr with
5048+
| Parenthesized -> add_parens doc
5049+
| Braced braces -> print_braces doc expr braces
5050+
| Nothing when ParsetreeViewer.is_unary_bitnot_expression expr ->
50595051
add_parens doc
5060-
| _ -> doc
5052+
| Nothing -> doc
50615053
in
50625054
let loc = {arg_loc with loc_end = expr.pexp_loc.loc_end} in
50635055
let doc =

0 commit comments

Comments
 (0)