Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add empty action function to Target #381

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin/sail.ml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ let rec options =
("--help", Arg.Unit (fun () -> help !options), " display this list of options");
]

let register_default_target () = Target.register ~name:"default" (fun _ _ _ _ _ _ -> ())
let register_default_target () = Target.register ~name:"default" Target.empty_action

let run_sail (config : Yojson.Basic.t option) tgt =
Target.run_pre_parse_hook tgt ();
Expand Down
2 changes: 2 additions & 0 deletions src/lib/target.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ let register ~name ?flag ?description:desc ?(options = []) ?(pre_parse_hook = fu
targets := StringMap.add name tgt !targets;
tgt

let empty_action _ _ _ _ _ _ = ()

let get_the_target () = match !the_target with Some name -> StringMap.find_opt name !targets | None -> None

let get ~name = StringMap.find_opt name !targets
Expand Down
4 changes: 4 additions & 0 deletions src/lib/target.mli
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ val register :
(Yojson.Basic.t option -> string -> string option -> tannot ast -> Effects.side_effect_info -> Env.t -> unit) ->
target

(** Use if you want to register a target that does nothing *)
val empty_action :
Yojson.Basic.t option -> string -> string option -> tannot ast -> Effects.side_effect_info -> Env.t -> unit

(** Return the current target. For example, if we register a 'coq'
target, and Sail is invoked with `sail -coq`, then this function
will return the coq target. *)
Expand Down
Loading