Skip to content

Commit 8dfd776

Browse files
committed
latest parser
1 parent dab2a95 commit 8dfd776

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

analysis/vendor/res_syntax/res_printer.ml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,14 @@ and printModuleBinding ~state ~isRec moduleBinding cmtTbl i =
705705
in
706706
let modExprDoc, modConstraintDoc =
707707
match moduleBinding.pmb_expr with
708-
| {pmod_desc = Pmod_constraint (modExpr, modType)} ->
708+
| {pmod_desc = Pmod_constraint (modExpr, modType)}
709+
when not
710+
(ParsetreeViewer.hasAwaitAttribute
711+
moduleBinding.pmb_expr.pmod_attributes) ->
709712
( printModExpr ~state modExpr cmtTbl,
710713
Doc.concat [Doc.text ": "; printModType ~state modType cmtTbl] )
711714
| modExpr -> (printModExpr ~state modExpr cmtTbl, Doc.nil)
712715
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
718716
let modName =
719717
let doc = Doc.text moduleBinding.pmb_name.Location.txt in
720718
printComments doc cmtTbl moduleBinding.pmb_name.loc
@@ -4967,11 +4965,13 @@ and printExpressionBlock ~state ~braces expr cmtTbl =
49674965
in
49684966
let name, modExpr =
49694967
match modExpr.pmod_desc with
4970-
| Pmod_constraint (modExpr, modType) ->
4968+
| Pmod_constraint (modExpr2, modType)
4969+
when not (ParsetreeViewer.hasAwaitAttribute modExpr.pmod_attributes)
4970+
->
49714971
let name =
49724972
Doc.concat [name; Doc.text ": "; printModType ~state modType cmtTbl]
49734973
in
4974-
(name, modExpr)
4974+
(name, modExpr2)
49754975
| _ -> (name, modExpr)
49764976
in
49774977
let letModuleDoc =
@@ -5455,6 +5455,14 @@ and printModExpr ~state modExpr cmtTbl =
54555455
]
54565456
| Pmod_functor _ -> printModFunctor ~state modExpr cmtTbl
54575457
in
5458+
let doc =
5459+
if ParsetreeViewer.hasAwaitAttribute modExpr.pmod_attributes then
5460+
match modExpr.pmod_desc with
5461+
| Pmod_constraint _ ->
5462+
Doc.concat [Doc.text "await "; Doc.lparen; doc; Doc.rparen]
5463+
| _ -> Doc.concat [Doc.text "await "; doc]
5464+
else doc
5465+
in
54585466
printComments doc cmtTbl modExpr.pmod_loc
54595467

54605468
and printModFunctor ~state modExpr cmtTbl =

0 commit comments

Comments
 (0)