@@ -237,12 +237,7 @@ let replace_attribute ~loc (attr,value) =
237
237
238
238
Each token is equipped with a starting (but no ending) position.
239
239
*)
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 =
246
241
247
242
let strings =
248
243
expressions |> List. map @@ fun expr ->
@@ -380,6 +375,12 @@ let dispatch_ext {txt ; loc} =
380
375
Some (Ppx_common. Svg , get_modname ~loc len l)
381
376
| _ -> None
382
377
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
+
383
384
open Ast_mapper
384
385
open Ast_helper
385
386
@@ -390,7 +391,8 @@ let markup_cases ~lang ~modname cases =
390
391
let f ({pc_rhs} as case ) =
391
392
let loc = pc_rhs.pexp_loc in
392
393
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
394
396
in {case with pc_rhs}
395
397
in
396
398
List. map f cases
@@ -405,7 +407,8 @@ let rec markup_function ~lang ~modname e =
405
407
let cases = markup_cases ~lang ~modname cases in
406
408
{e with pexp_desc = Pexp_function cases}
407
409
| _ ->
408
- markup_to_expr_with_implementation lang modname loc e
410
+ markup_to_expr_with_implementation lang modname loc @@
411
+ application_to_list e
409
412
410
413
let markup_bindings ~lang ~modname l =
411
414
let f ({pvb_expr} as b ) =
@@ -424,7 +427,8 @@ let rec expr mapper e =
424
427
let bindings = markup_bindings ~lang ~modname bindings in
425
428
{e with pexp_desc = Pexp_let (recflag, bindings, expr mapper next)}
426
429
| _ ->
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
428
432
end
429
433
| Some _ , _ -> error ext
430
434
| None , _ -> default_mapper.expr mapper e
0 commit comments