mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 00:15:39 +03:00
Allow catala ocaml --closure-conversion
it's probably not useful per se, but will be handy for debugging
This commit is contained in:
parent
09bdc3b4da
commit
8881fee37f
@ -488,7 +488,8 @@ let base_bindings catala_exe catala_flags build_dir include_dirs test_flags =
|
||||
let catala_flags_ocaml =
|
||||
List.filter
|
||||
(function
|
||||
| "--avoid-exceptions" | "-O" | "--optimize" -> true | _ -> false)
|
||||
| "--avoid-exceptions" | "-O" | "--optimize" | "--closure-conversion" ->
|
||||
true | _ -> false)
|
||||
test_flags
|
||||
in
|
||||
let catala_flags_python =
|
||||
|
@ -76,7 +76,7 @@ let catala_test_command test_flags catala_exe catala_opts args out =
|
||||
let cmd0, flags =
|
||||
match String.lowercase_ascii cmd0, flags, test_flags with
|
||||
| "test-scope", scope_name :: flags, test_flags ->
|
||||
"interpret", (("--scope=" ^ scope_name) :: flags) @ test_flags
|
||||
"interpret", flags @ test_flags @ ["--scope=" ^ scope_name]
|
||||
| "test-scope", [], _ ->
|
||||
out_line out
|
||||
"[INVALID TEST] Invalid test command syntax, the 'test-scope' \
|
||||
|
@ -47,6 +47,7 @@ end = struct
|
||||
type nonrec t = t
|
||||
|
||||
let pass k ~avoid_exceptions ~closure_conversion ~monomorphize_types =
|
||||
let avoid_exceptions = avoid_exceptions || closure_conversion in
|
||||
(* Should not affect the call convention or actual interfaces: include,
|
||||
optimize, check_invariants, typed *)
|
||||
!(avoid_exceptions : bool)
|
||||
|
@ -837,10 +837,11 @@ module Commands = struct
|
||||
optimize
|
||||
check_invariants
|
||||
avoid_exceptions
|
||||
closure_conversion
|
||||
ex_scope_opt =
|
||||
let prg, type_ordering =
|
||||
Passes.lcalc options ~includes ~optimize ~check_invariants
|
||||
~avoid_exceptions ~typed:Expr.typed ~closure_conversion:false
|
||||
~avoid_exceptions ~typed:Expr.typed ~closure_conversion
|
||||
~monomorphize_types:false
|
||||
in
|
||||
let output_file, with_output =
|
||||
@ -853,7 +854,7 @@ module Commands = struct
|
||||
(Option.value ~default:"stdout" output_file);
|
||||
let exec_scope = Option.map (get_scope_uid prg.decl_ctx) ex_scope_opt in
|
||||
let hashf =
|
||||
Hash.finalise ~avoid_exceptions ~closure_conversion:false
|
||||
Hash.finalise ~avoid_exceptions ~closure_conversion
|
||||
~monomorphize_types:false
|
||||
in
|
||||
Lcalc.To_ocaml.format_program fmt prg ?exec_scope ~hashf type_ordering
|
||||
@ -870,6 +871,7 @@ module Commands = struct
|
||||
$ Cli.Flags.optimize
|
||||
$ Cli.Flags.check_invariants
|
||||
$ Cli.Flags.avoid_exceptions
|
||||
$ Cli.Flags.closure_conversion
|
||||
$ Cli.Flags.ex_scope_opt)
|
||||
|
||||
let scalc
|
||||
|
@ -223,11 +223,11 @@ type typ = naked_typ Mark.pos
|
||||
|
||||
and naked_typ =
|
||||
| TLit of typ_lit
|
||||
| TArrow of typ list * typ
|
||||
| TTuple of typ list
|
||||
| TStruct of StructName.t
|
||||
| TEnum of EnumName.t
|
||||
| TOption of typ
|
||||
| TArrow of typ list * typ
|
||||
| TArray of typ
|
||||
| TDefault of typ
|
||||
| TAny
|
||||
|
Loading…
Reference in New Issue
Block a user