@@ -173,15 +173,9 @@ let replace_attribute ~loc (attr,value) =
173173
174174 Each token is equipped with a starting (but no ending) position.
175175*)
176- let ast_to_stream expr =
176+ let ast_to_stream expressions =
177177 let current_adjust_location = ref (Loc. adjust Lexing. dummy_pos 0 ) in
178178
179- let expressions =
180- match expr.pexp_desc with
181- | Pexp_apply (f , arguments ) -> f::(List. map snd arguments)
182- | _ -> [expr]
183- in
184-
185179 let strings =
186180 expressions |> List. map @@ fun expr ->
187181 match expr.pexp_desc with
@@ -321,14 +315,21 @@ let dispatch_ext {txt ; loc} =
321315 Some (Ppx_common. Svg , get_modname ~loc len l)
322316 | _ -> None
323317
318+ let application_to_list expr =
319+ match expr.pexp_desc with
320+ | Pexp_apply (f , arguments ) -> f::(List. map snd arguments)
321+ | _ -> [expr]
322+
323+
324324open Ast_mapper
325325
326326let map_expr mapper e =
327327 match e.pexp_desc with
328328 | Pexp_extension (ext , payload ) ->
329329 begin match dispatch_ext ext, payload with
330330 | Some (lang , modname ), PStr [{pstr_desc = Pstr_eval (e, _)}] ->
331- markup_to_expr_with_implementation lang modname e.pexp_loc e
331+ markup_to_expr_with_implementation lang modname e.pexp_loc @@
332+ application_to_list e
332333 | Some _ , _ ->
333334 Ppx_common. error e.pexp_loc
334335 " Error: Payload of [%%tyxml] must be a single string"
0 commit comments