(* Rename the function to goal_<name>. *)
let gname = "goal_" ^ name in
+ (* Convert loc to string for goalloc. *)
+ let goalloc = Loc.to_string _loc in
+
(* Split the function into parameters and body. *)
let params, body = function_parameters expr in
let body = <:expr<
(* Define a goal name which the body may use. *)
let goalname = $str:name$ in
+
+ (* Source location. *)
+ let goalloc = $str:goalloc$ in
+
(* Define onsuccess, onrun, onfail functions that the body may call. *)
let _on, _call_on =
let _on fns f = fns := f :: !fns in
_call_onsuccesses ();
(* Avoid a compiler warning: *)
- ignore (goalname)
+ ignore (goalname); ignore (goalloc)
with
(* target() within the body may raise Goal_OK meaning that the
* goal should be short-circuited. We return as if it's an