@@ -237,12 +237,7 @@ let replace_attribute ~loc (attr,value) =
237237
238238 Each token is equipped with a starting (but no ending) position.
239239*)
240- let ast_to_stream expr =
241- let expressions =
242- match expr.pexp_desc with
243- | Pexp_apply (f , arguments ) -> f::(List. map snd arguments)
244- | _ -> [expr]
245- in
240+ let ast_to_stream expressions =
246241
247242 let strings =
248243 expressions |> List. map @@ fun expr ->
@@ -380,6 +375,12 @@ let dispatch_ext {txt ; loc} =
380375 Some (Ppx_common. Svg , get_modname ~loc len l)
381376 | _ -> None
382377
378+ let application_to_list expr =
379+ match expr.pexp_desc with
380+ | Pexp_apply (f , arguments ) -> f::(List. map snd arguments)
381+ | _ -> [expr]
382+
383+
383384open Ast_mapper
384385open Ast_helper
385386
@@ -390,7 +391,8 @@ let markup_cases ~lang ~modname cases =
390391 let f ({pc_rhs} as case ) =
391392 let loc = pc_rhs.pexp_loc in
392393 let pc_rhs =
393- markup_to_expr_with_implementation lang modname loc pc_rhs
394+ markup_to_expr_with_implementation lang modname loc @@
395+ application_to_list pc_rhs
394396 in {case with pc_rhs}
395397 in
396398 List. map f cases
@@ -405,7 +407,8 @@ let rec markup_function ~lang ~modname e =
405407 let cases = markup_cases ~lang ~modname cases in
406408 {e with pexp_desc = Pexp_function cases}
407409 | _ ->
408- markup_to_expr_with_implementation lang modname loc e
410+ markup_to_expr_with_implementation lang modname loc @@
411+ application_to_list e
409412
410413let markup_bindings ~lang ~modname l =
411414 let f ({pvb_expr} as b ) =
@@ -424,7 +427,8 @@ let rec expr mapper e =
424427 let bindings = markup_bindings ~lang ~modname bindings in
425428 {e with pexp_desc = Pexp_let (recflag, bindings, expr mapper next)}
426429 | _ ->
427- markup_to_expr_with_implementation lang modname e.pexp_loc e
430+ markup_to_expr_with_implementation lang modname e.pexp_loc @@
431+ application_to_list e
428432 end
429433 | Some _ , _ -> error ext
430434 | None , _ -> default_mapper.expr mapper e
0 commit comments