@@ -2273,6 +2273,11 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
22732273 | Pexp_apply (e0 , e1N1 ) -> (
22742274 match pexp_attributes with
22752275 | [{attr_name= {txt= " JSX" ;loc= _}; attr_payload= PStr [] ; _}] ->
2276+ let is_jsx_element e =
2277+ match e.pexp_attributes with
2278+ | [{attr_name= {txt= " JSX" ;_}; attr_payload= PStr [] ; _}] -> true
2279+ | _ -> false
2280+ in
22762281 let children = ref None in
22772282 let props = List. filter_map e1N1 ~f: (function
22782283 | Labelled {txt ="children" ;_} , {pexp_desc =Pexp_list es ;pexp_loc;_} ->
@@ -2305,11 +2310,6 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
23052310 match props with
23062311 | [] -> str " "
23072312 | props ->
2308- let is_jsx_element e =
2309- match e.pexp_attributes with
2310- | [{attr_name= {txt= " JSX" ;_}; attr_payload= PStr [] ; _}] -> true
2311- | _ -> false
2312- in
23132313 let fmt_labelled ?(prefix =" " ) label e =
23142314 let flabel = str (Printf. sprintf " %s%s" prefix label.txt) in
23152315 match e.pexp_desc with
@@ -2338,7 +2338,11 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
23382338 let children =
23392339 hvbox 0 (
23402340 list children (break 1 0 )
2341- (fun e -> fmt_expression c ~parens: false (sub_exp ~ctx e))
2341+ (fun e ->
2342+ if is_jsx_element e then
2343+ fmt_expression c ~parens: false (sub_exp ~ctx e)
2344+ else
2345+ fmt_expression c (sub_exp ~ctx e))
23422346 $ Cmts. fmt_after c children_loc)
23432347 in
23442348 hvbox 2 (head $ break 0 0 $ children $ break 0 (- 2 ) $ end_tag () )
0 commit comments