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

Commit 3b17a08

Browse files
author
Maxim
committed
Document Lident "async" branch in parseBracedOrRecordExpr.
1 parent d20b149 commit 3b17a08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/res_core.ml

+8
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,14 @@ and parseBracedOrRecordExpr p =
27592759
let expr = parseRecordExpr ~startPos [] p in
27602760
Parser.expect Rbrace p;
27612761
expr
2762+
(*
2763+
The branch below takes care of the "braced" expression {async}.
2764+
The big reason that we need all these branches is that {x} isn't a record with a punned field x, but a braced expression… There's lots of "ambiguity" between a record with a single punned field and a braced expression…
2765+
What is {x}?
2766+
1) record {x: x}
2767+
2) expression x which happens to wrapped in braces
2768+
Due to historical reasons, we always follow 2
2769+
*)
27622770
| Lident "async" when isEs6ArrowExpression ~inTernary:false p ->
27632771
let expr = parseAsyncArrowExpression p in
27642772
let expr = parseExprBlock ~first:expr p in

0 commit comments

Comments
 (0)