File: effects_flags.ml

package info (click to toggle)
js-of-ocaml 6.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 37,932 kB
  • sloc: ml: 135,957; javascript: 58,364; ansic: 437; makefile: 422; sh: 12; perl: 4
file content (15 lines) | stat: -rw-r--r-- 603 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let () =
  let major = String.split_on_char '.' Sys.ocaml_version |> List.hd |> int_of_string in
  let effects_flags l =
    match l, major >= 5 with
    | [ "with-effects-double-translation" ], true -> [ "--effects"; "double-translation" ]
    | [ "with-effects" ], true -> [ "--effects"; "cps" ]
    | _ -> [ "--effects"; "disabled" ]
  in
  match Sys.argv |> Array.to_list |> List.tl with
  | "txt" :: rest -> List.iter print_endline (effects_flags rest)
  | "sexp" :: rest ->
      print_endline "(";
      List.iter print_endline (effects_flags rest);
      print_endline ")"
  | _ -> assert false