Skip to content

Commit 9823662

Browse files
committed
Handle braces expression
1 parent f100b63 commit 9823662

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
@@ -4463,6 +4463,23 @@ and print_jsx_children ~state (children_expr : Parsetree.expression) ~sep
44634463
let acc = expr :: acc in
44644464
acc
44654465
in
4466+
(* adjust for braces when we forward the current_loc to the recursion *)
4467+
let current_loc =
4468+
match expr with
4469+
| {Parsetree.pexp_loc = loc}
4470+
when loc.loc_start.pos_lnum == loc.loc_end.pos_lnum ->
4471+
current_loc
4472+
| _ when ParsetreeViewer.is_braced_expr expr ->
4473+
{
4474+
current_loc with
4475+
loc_end =
4476+
{
4477+
current_loc.loc_end with
4478+
pos_lnum = current_loc.loc_end.pos_lnum + 1;
4479+
};
4480+
}
4481+
| _ -> current_loc
4482+
in
44664483
loop current_loc docs tails
44674484
in
44684485
let docs = loop loc [] children in

0 commit comments

Comments
 (0)