From f970d94dd684876e9fbd16812c8d416a73b6dc8c Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 19 Sep 2024 20:56:37 +0200 Subject: [PATCH] missing-file --- compiler/tests-dynlink-js/effects_flags.ml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 compiler/tests-dynlink-js/effects_flags.ml diff --git a/compiler/tests-dynlink-js/effects_flags.ml b/compiler/tests-dynlink-js/effects_flags.ml new file mode 100644 index 0000000000..c0fce23c94 --- /dev/null +++ b/compiler/tests-dynlink-js/effects_flags.ml @@ -0,0 +1,19 @@ +let enable b n = + let f = if b then "--enable" else "--disable" in + [ f; n ] + +let () = + let major = String.split_on_char '.' Sys.ocaml_version |> List.hd |> int_of_string in + let has_effect l = + match l with + | [ "using-effects" ] -> major >= 5 + | _ -> false + in + let aux l = enable (has_effect l) "effects" in + match Sys.argv |> Array.to_list |> List.tl with + | "txt" :: rest -> List.iter print_endline (aux rest) + | "sexp" :: rest -> + print_endline "("; + List.iter print_endline (aux rest); + print_endline ")" + | _ -> assert false