Skip to content

Commit 33aa565

Browse files
committed
Handle braces expression
1 parent 63093e4 commit 33aa565

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
@@ -4469,6 +4469,23 @@ and print_jsx_children ~state (children_expr : Parsetree.expression) ~sep
44694469
let acc = expr :: acc in
44704470
acc
44714471
in
4472+
(* adjust for braces when we forward the current_loc to the recursion *)
4473+
let current_loc =
4474+
match expr with
4475+
| {Parsetree.pexp_loc = loc}
4476+
when loc.loc_start.pos_lnum == loc.loc_end.pos_lnum ->
4477+
current_loc
4478+
| _ when ParsetreeViewer.is_braced_expr expr ->
4479+
{
4480+
current_loc with
4481+
loc_end =
4482+
{
4483+
current_loc.loc_end with
4484+
pos_lnum = current_loc.loc_end.pos_lnum + 1;
4485+
};
4486+
}
4487+
| _ -> current_loc
4488+
in
44724489
loop current_loc docs tails
44734490
in
44744491
let docs = loop loc [] children in

0 commit comments

Comments
 (0)