Skip to content

Commit 851a973

Browse files
committed
parsing await module
1 parent 1aedfb7 commit 851a973

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

res_syntax/src/res_core.ml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5783,7 +5783,22 @@ and parseFunctorModuleExpr p =
57835783
* | extension
57845784
* | attributes module-expr *)
57855785
and parseModuleExpr p =
5786+
let hasAwait, loc_await =
5787+
let startPos = p.startPos in
5788+
match p.Parser.token with
5789+
| Await ->
5790+
Parser.expect Await p;
5791+
let endPos = p.endPos in
5792+
(true, mkLoc startPos endPos)
5793+
| _ -> (false, mkLoc startPos startPos)
5794+
in
57865795
let attrs = parseAttributes p in
5796+
let attrs =
5797+
if hasAwait then
5798+
(({txt = "res.await"; loc = loc_await}, PStr []) : Parsetree.attribute)
5799+
:: attrs
5800+
else attrs
5801+
in
57875802
let modExpr =
57885803
if isEs6ArrowFunctor p then parseFunctorModuleExpr p
57895804
else parsePrimaryModExpr p

0 commit comments

Comments
 (0)