Skip to content

Commit 1ec6560

Browse files
committed
Handle braces expression
1 parent bb8a22d commit 1ec6560

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

compiler/syntax/src/res_printer.ml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4482,6 +4482,23 @@ and print_jsx_children ~state (children_expr : Parsetree.expression) ~sep
44824482
let acc = expr :: acc in
44834483
acc
44844484
in
4485+
(* adjust for braces when we forward the current_loc to the recursion *)
4486+
let current_loc =
4487+
match expr with
4488+
| {Parsetree.pexp_loc = loc}
4489+
when loc.loc_start.pos_lnum == loc.loc_end.pos_lnum ->
4490+
current_loc
4491+
| _ when ParsetreeViewer.is_braced_expr expr ->
4492+
{
4493+
current_loc with
4494+
loc_end =
4495+
{
4496+
current_loc.loc_end with
4497+
pos_lnum = current_loc.loc_end.pos_lnum + 1;
4498+
};
4499+
}
4500+
| _ -> current_loc
4501+
in
44854502
loop current_loc docs tails
44864503
in
44874504
let docs = loop loc [] children in

0 commit comments

Comments
 (0)