Skip to content

Commit 2b9b5ce

Browse files
committed
Fix comments inside prop expression
1 parent 91c283e commit 2b9b5ce

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

compiler/syntax/src/res_comments_table.ml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,21 +1473,16 @@ and walk_expression expr t comments =
14731473
let xs = exprs |> List.map (fun e -> Expression e) in
14741474
walk_list xs t rest
14751475
| Pexp_jsx_unary_element {jsx_unary_element_props = props} ->
1476-
let xs = List.filter_map (fun prop ->
1476+
let _ = List.map (fun prop ->
14771477
match prop with
1478-
| Parsetree.JSXPropPunning (_, _) -> None
1479-
| Parsetree.JSXPropValue ({txt; loc}, _, expr) ->
1480-
let () = print_endline txt in
1481-
let () = print_location loc |> Doc.to_string ~width:80 |> print_endline in
1482-
let () = print_location expr.pexp_loc|> Doc.to_string ~width:80 |> print_endline in
1483-
let () = log t in
1484-
let (_leading, _inside, trailing) = partition_by_loc comments expr.pexp_loc in
1478+
| Parsetree.JSXPropPunning (_, _) -> ()
1479+
| Parsetree.JSXPropValue (_, _, expr) ->
1480+
let (_leading, inside, trailing) = partition_by_loc comments expr.pexp_loc in
14851481
let after_expr, _ = partition_adjacent_trailing expr.pexp_loc trailing in
14861482
attach t.trailing expr.pexp_loc after_expr;
1487-
Some (Expression expr)
1488-
| Parsetree.JSXPropSpreading (_loc, expr) -> Some (Expression expr)
1489-
) props in
1490-
walk_list xs t []
1483+
walk_expression expr t inside;
1484+
| Parsetree.JSXPropSpreading (_loc, _expr) -> ()
1485+
) props in ()
14911486
| Pexp_jsx_container_element
14921487
{
14931488
jsx_container_element_opening_tag_end = opening_greater_than;

0 commit comments

Comments
 (0)