@@ -710,6 +710,11 @@ and printModuleBinding ~state ~isRec moduleBinding cmtTbl i =
710710 Doc. concat [Doc. text " : " ; printModType ~state modType cmtTbl] )
711711 | modExpr -> (printModExpr ~state modExpr cmtTbl, Doc. nil)
712712 in
713+ let modExprDoc =
714+ if ParsetreeViewer. hasAwaitAttribute moduleBinding.pmb_expr.pmod_attributes
715+ then Doc. concat [Doc. text " await " ; modExprDoc]
716+ else modExprDoc
717+ in
713718 let modName =
714719 let doc = Doc. text moduleBinding.pmb_name.Location. txt in
715720 printComments doc cmtTbl moduleBinding.pmb_name.loc
@@ -3187,14 +3192,8 @@ and printExpression ~state (e : Parsetree.expression) cmtTbl =
31873192 | Pexp_letexception (_extensionConstructor , _expr ) ->
31883193 printExpressionBlock ~state ~braces: true e cmtTbl
31893194 | Pexp_assert expr ->
3190- let rhs =
3191- let doc = printExpressionWithComments ~state expr cmtTbl in
3192- match Parens. lazyOrAssertOrAwaitExprRhs expr with
3193- | Parens. Parenthesized -> addParens doc
3194- | Braced braces -> printBraces doc expr braces
3195- | Nothing -> doc
3196- in
3197- Doc. concat [Doc. text " assert " ; rhs]
3195+ let expr = printExpressionWithComments ~state expr cmtTbl in
3196+ Doc. concat [Doc. text " assert(" ; expr; Doc. text " )" ]
31983197 | Pexp_lazy expr ->
31993198 let rhs =
32003199 let doc = printExpressionWithComments ~state expr cmtTbl in
@@ -3970,6 +3969,13 @@ and printPexpApply ~state expr cmtTbl =
39703969 let uncurried, attrs =
39713970 ParsetreeViewer. processUncurriedAppAttribute expr.pexp_attributes
39723971 in
3972+ let partial, attrs = ParsetreeViewer. processPartialAppAttribute attrs in
3973+ let args =
3974+ if partial then
3975+ let dummy = Ast_helper.Exp. constant (Ast_helper.Const. int 0 ) in
3976+ args @ [(Asttypes. Labelled " ..." , dummy)]
3977+ else args
3978+ in
39733979 let dotted = state.uncurried_config |> Res_uncurried. getDotted ~uncurried in
39743980 let callExprDoc =
39753981 let doc = printExpressionWithComments ~state callExpr cmtTbl in
@@ -4580,7 +4586,7 @@ and printArguments ~state ~dotted
45804586and printArgument ~state (argLbl , arg ) cmtTbl =
45814587 match (argLbl, arg) with
45824588 (* ~a (punned)*)
4583- | ( Asttypes. Labelled lbl,
4589+ | ( Labelled lbl,
45844590 ({
45854591 pexp_desc = Pexp_ident {txt = Longident. Lident name};
45864592 pexp_attributes = [] | [({Location. txt = " res.namedArgLoc" }, _)];
@@ -4594,7 +4600,7 @@ and printArgument ~state (argLbl, arg) cmtTbl =
45944600 let doc = Doc. concat [Doc. tilde; printIdentLike lbl] in
45954601 printComments doc cmtTbl loc
45964602 (* ~a: int (punned)*)
4597- | ( Asttypes. Labelled lbl,
4603+ | ( Labelled lbl,
45984604 {
45994605 pexp_desc =
46004606 Pexp_constraint
@@ -4622,7 +4628,7 @@ and printArgument ~state (argLbl, arg) cmtTbl =
46224628 in
46234629 printComments doc cmtTbl loc
46244630 (* ~a? (optional lbl punned)*)
4625- | ( Asttypes. Optional lbl,
4631+ | ( Optional lbl,
46264632 {
46274633 pexp_desc = Pexp_ident {txt = Longident. Lident name};
46284634 pexp_attributes = [] | [({Location. txt = " res.namedArgLoc" }, _)];
@@ -4642,27 +4648,32 @@ and printArgument ~state (argLbl, arg) cmtTbl =
46424648 (loc, {expr with pexp_attributes = attrs})
46434649 | _ -> (expr.pexp_loc, expr)
46444650 in
4645- let printedLbl =
4651+ let printedLbl, dotdotdot =
46464652 match argLbl with
4647- | Asttypes. Nolabel -> Doc. nil
4648- | Asttypes. Labelled lbl ->
4653+ | Nolabel -> (Doc. nil, false )
4654+ | Labelled "..." ->
4655+ let doc = Doc. text " ..." in
4656+ (printComments doc cmtTbl argLoc, true )
4657+ | Labelled lbl ->
46494658 let doc = Doc. concat [Doc. tilde; printIdentLike lbl; Doc. equal] in
4650- printComments doc cmtTbl argLoc
4651- | Asttypes. Optional lbl ->
4659+ ( printComments doc cmtTbl argLoc, false )
4660+ | Optional lbl ->
46524661 let doc =
46534662 Doc. concat [Doc. tilde; printIdentLike lbl; Doc. equal; Doc. question]
46544663 in
4655- printComments doc cmtTbl argLoc
4664+ ( printComments doc cmtTbl argLoc, false )
46564665 in
46574666 let printedExpr =
46584667 let doc = printExpressionWithComments ~state expr cmtTbl in
46594668 match Parens. expr expr with
4660- | Parens. Parenthesized -> addParens doc
4669+ | Parenthesized -> addParens doc
46614670 | Braced braces -> printBraces doc expr braces
46624671 | Nothing -> doc
46634672 in
46644673 let loc = {argLoc with loc_end = expr.pexp_loc.loc_end} in
4665- let doc = Doc. concat [printedLbl; printedExpr] in
4674+ let doc =
4675+ if dotdotdot then printedLbl else Doc. concat [printedLbl; printedExpr]
4676+ in
46664677 printComments doc cmtTbl loc
46674678
46684679and printCases ~state (cases : Parsetree.case list ) cmtTbl =
0 commit comments