Skip to content

latest parser #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions analysis/vendor/res_syntax/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -705,16 +705,14 @@ and printModuleBinding ~state ~isRec moduleBinding cmtTbl i =
in
let modExprDoc, modConstraintDoc =
match moduleBinding.pmb_expr with
| {pmod_desc = Pmod_constraint (modExpr, modType)} ->
| {pmod_desc = Pmod_constraint (modExpr, modType)}
when not
(ParsetreeViewer.hasAwaitAttribute
moduleBinding.pmb_expr.pmod_attributes) ->
( printModExpr ~state modExpr cmtTbl,
Doc.concat [Doc.text ": "; printModType ~state modType cmtTbl] )
| modExpr -> (printModExpr ~state modExpr cmtTbl, Doc.nil)
in
let modExprDoc =
if ParsetreeViewer.hasAwaitAttribute moduleBinding.pmb_expr.pmod_attributes
then Doc.concat [Doc.text "await "; modExprDoc]
else modExprDoc
in
let modName =
let doc = Doc.text moduleBinding.pmb_name.Location.txt in
printComments doc cmtTbl moduleBinding.pmb_name.loc
Expand Down Expand Up @@ -4967,11 +4965,13 @@ and printExpressionBlock ~state ~braces expr cmtTbl =
in
let name, modExpr =
match modExpr.pmod_desc with
| Pmod_constraint (modExpr, modType) ->
| Pmod_constraint (modExpr2, modType)
when not (ParsetreeViewer.hasAwaitAttribute modExpr.pmod_attributes)
->
let name =
Doc.concat [name; Doc.text ": "; printModType ~state modType cmtTbl]
in
(name, modExpr)
(name, modExpr2)
| _ -> (name, modExpr)
in
let letModuleDoc =
Expand Down Expand Up @@ -5455,6 +5455,14 @@ and printModExpr ~state modExpr cmtTbl =
]
| Pmod_functor _ -> printModFunctor ~state modExpr cmtTbl
in
let doc =
if ParsetreeViewer.hasAwaitAttribute modExpr.pmod_attributes then
match modExpr.pmod_desc with
| Pmod_constraint _ ->
Doc.concat [Doc.text "await "; Doc.lparen; doc; Doc.rparen]
| _ -> Doc.concat [Doc.text "await "; doc]
else doc
in
printComments doc cmtTbl modExpr.pmod_loc

and printModFunctor ~state modExpr cmtTbl =
Expand Down