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

Commit e0b1443

Browse files
Maximcristianoc
Maxim
authored andcommitted
Remove assert false branch from async arrow expression parsing
1 parent 038c168 commit e0b1443

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/res_core.ml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3118,19 +3118,16 @@ and parseExprBlock ?first p =
31183118

31193119
and parseAsyncArrowExpression p =
31203120
let startPos = p.Parser.startPos in
3121-
match p.token with
3122-
| Lident "async" ->
3123-
let asyncAttr =
3124-
(Location.mkloc "async" (mkLoc startPos p.endPos), Parsetree.PStr [])
3125-
in
3126-
Parser.next p;
3127-
let expr = parseEs6ArrowExpression p in
3128-
{
3129-
expr with
3130-
pexp_attributes = asyncAttr :: expr.pexp_attributes;
3131-
pexp_loc = {expr.pexp_loc with loc_start = startPos};
3132-
}
3133-
| _ -> assert false
3121+
Parser.expect (Lident "async") p;
3122+
let asyncAttr =
3123+
(Location.mkloc "async" (mkLoc startPos p.prevEndPos), Parsetree.PStr [])
3124+
in
3125+
let expr = parseEs6ArrowExpression p in
3126+
{
3127+
expr with
3128+
pexp_attributes = asyncAttr :: expr.pexp_attributes;
3129+
pexp_loc = {expr.pexp_loc with loc_start = startPos};
3130+
}
31343131

31353132
and parseAwaitExpression p =
31363133
let awaitLoc = mkLoc p.Parser.startPos p.endPos in

0 commit comments

Comments
 (0)