Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 1d531ca

Browse files
author
Maxim
committed
Remove assert false branch from async arrow expression parsing
1 parent 269a0de commit 1d531ca

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/res_core.ml

+10-13
Original file line numberDiff line numberDiff line change
@@ -3108,19 +3108,16 @@ and parseExprBlock ?first p =
31083108

31093109
and parseAsyncArrowExpression p =
31103110
let startPos = p.Parser.startPos in
3111-
match p.token with
3112-
| Lident "async" ->
3113-
let asyncAttr =
3114-
(Location.mkloc "async" (mkLoc startPos p.endPos), Parsetree.PStr [])
3115-
in
3116-
Parser.next p;
3117-
let expr = parseEs6ArrowExpression p in
3118-
{
3119-
expr with
3120-
pexp_attributes = asyncAttr :: expr.pexp_attributes;
3121-
pexp_loc = {expr.pexp_loc with loc_start = startPos};
3122-
}
3123-
| _ -> assert false
3111+
Parser.expect (Lident "async") p;
3112+
let asyncAttr =
3113+
(Location.mkloc "async" (mkLoc startPos p.prevEndPos), Parsetree.PStr [])
3114+
in
3115+
let expr = parseEs6ArrowExpression p in
3116+
{
3117+
expr with
3118+
pexp_attributes = asyncAttr :: expr.pexp_attributes;
3119+
pexp_loc = {expr.pexp_loc with loc_start = startPos};
3120+
}
31243121

31253122
and parseAwaitExpression p =
31263123
let awaitLoc = mkLoc p.Parser.startPos p.endPos in

0 commit comments

Comments
 (0)