@@ -79,6 +79,8 @@ let addBraces doc =
79
79
Doc. rbrace;
80
80
])
81
81
82
+ let addAsync doc = Doc. concat [Doc. text " async " ; doc]
83
+
82
84
let getFirstLeadingComment tbl loc =
83
85
match Hashtbl. find tbl.CommentTable. leading loc with
84
86
| comment :: _ -> Some comment
@@ -4597,7 +4599,7 @@ and printExprFunParameters ~customLayout ~inCallback ~async ~uncurried
4597
4599
let doc = if hasConstraint then Doc. text " (_)" else Doc. text " _" in
4598
4600
printComments doc cmtTbl ppat_loc
4599
4601
in
4600
- if async then Doc. concat [ Doc. text " async " ; any] else any
4602
+ if async then addAsync any else any
4601
4603
(* let f = a => () *)
4602
4604
| [
4603
4605
ParsetreeViewer. Parameter
@@ -4612,7 +4614,7 @@ and printExprFunParameters ~customLayout ~inCallback ~async ~uncurried
4612
4614
let txtDoc =
4613
4615
let var = printIdentLike stringLoc.txt in
4614
4616
let var = if hasConstraint then addParens var else var in
4615
- if async then Doc. concat [Doc. text " async ( " ; var; Doc. rparen] else var
4617
+ if async then addAsync ( Doc. concat [Doc. lparen ; var; Doc. rparen]) else var
4616
4618
in
4617
4619
printComments txtDoc cmtTbl stringLoc.loc
4618
4620
(* let f = () => () *)
@@ -4627,7 +4629,10 @@ and printExprFunParameters ~customLayout ~inCallback ~async ~uncurried
4627
4629
};
4628
4630
]
4629
4631
when not uncurried ->
4630
- let doc = if async then Doc. text " async ()" else Doc. text " ()" in
4632
+ let doc =
4633
+ let lparenRparen = Doc. text " ()" in
4634
+ if async then addAsync lparenRparen else lparenRparen
4635
+ in
4631
4636
printComments doc cmtTbl loc
4632
4637
(* let f = (~greeting, ~from as hometown, ~x=?) => () *)
4633
4638
| parameters ->
@@ -4637,11 +4642,8 @@ and printExprFunParameters ~customLayout ~inCallback ~async ~uncurried
4637
4642
| _ -> false
4638
4643
in
4639
4644
let maybeAsyncLparen =
4640
- match (async, uncurried) with
4641
- | true , true -> Doc. text " async (. "
4642
- | true , false -> Doc. text " async ("
4643
- | false , true -> Doc. text " (. "
4644
- | false , false -> Doc. lparen
4645
+ let lparen = if uncurried then Doc. text " (. " else Doc. lparen in
4646
+ if async then addAsync lparen else lparen
4645
4647
in
4646
4648
let shouldHug = ParsetreeViewer. parametersShouldHug parameters in
4647
4649
let printedParamaters =
0 commit comments