Skip to content

Commit 554c924

Browse files
Use more generic map function instead of map_string_with_vars
Signed-off-by: Marek Kubica <[email protected]>
1 parent edfd20a commit 554c924

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/dune_lang/action.mli

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ val encode : t Encoder.t
124124
val decode_dune_file : t Decoder.t
125125
val decode_pkg : t Decoder.t
126126

127-
(** Transform the string in the action *)
128-
val map_string_with_vars : t -> f:(String_with_vars.t -> String_with_vars.t) -> t
127+
val map
128+
: t
129+
-> string_with_vars:(String_with_vars.t -> String_with_vars.t)
130+
-> slang:(Slang.t -> Slang.t)
131+
-> blang:(Slang.Blang.t -> Slang.Blang.t)
132+
-> t
129133

130134
(** Raises User_error on invalid action. *)
131135
val validate : loc:Loc.t -> t -> unit

src/dune_rules/pkg_rules.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,9 +1170,13 @@ end = struct
11701170
end
11711171

11721172
let relocate action =
1173-
Dune_lang.Action.map_string_with_vars action ~f:(fun sw ->
1173+
let string_with_vars sw =
11741174
let loc = sw |> String_with_vars.loc |> Dune_pkg.Lock_dir.loc_in_source_tree in
1175-
String_with_vars.with_loc sw ~loc)
1175+
String_with_vars.with_loc sw ~loc
1176+
in
1177+
let slang = Slang.map_loc ~f:Dune_pkg.Lock_dir.loc_in_source_tree in
1178+
let blang = Slang.Blang.map_loc ~f:Dune_pkg.Lock_dir.loc_in_source_tree in
1179+
Dune_lang.Action.map action ~string_with_vars ~slang ~blang
11761180
;;
11771181

11781182
let relocate_build b =

0 commit comments

Comments
 (0)