mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 16:28:12 +03:00
Allow trace w/ avoid-exceptions, fix options in api_web
--trace and --avoid-exceptions is a warning, but we want to be able to test with the combination (in particular, api_web as forcing --trace, so we couldn't detect its issues with exceptions).
This commit is contained in:
parent
36ca23eb89
commit
d72141653a
@ -244,19 +244,19 @@ module Passes = struct
|
||||
let avoid_exceptions = avoid_exceptions || closure_conversion in
|
||||
(* --closure-conversion implies --avoid-exceptions *)
|
||||
let prg =
|
||||
match avoid_exceptions, options.trace, typed with
|
||||
| true, true, _ ->
|
||||
Message.error
|
||||
"Option --avoid-exceptions is not compatible with option --trace"
|
||||
| true, _, Untyped _ ->
|
||||
if avoid_exceptions && options.trace then
|
||||
Message.warning
|
||||
"It is discouraged to use option @{<yellow>--avoid-exceptions@} if you@ also@ need@ @{<yellow>--trace@},@ the@ resulting@ trace@ may@ be@ unreliable@ at@ the@ moment.";
|
||||
match avoid_exceptions, typed with
|
||||
| true, Untyped _ ->
|
||||
Lcalc.From_dcalc.translate_program_without_exceptions prg
|
||||
| true, _, Typed _ ->
|
||||
| true, Typed _ ->
|
||||
Lcalc.From_dcalc.translate_program_without_exceptions prg
|
||||
| false, _, Typed _ ->
|
||||
| false, Typed _ ->
|
||||
Lcalc.From_dcalc.translate_program_with_exceptions prg
|
||||
| false, _, Untyped _ ->
|
||||
| false, Untyped _ ->
|
||||
Lcalc.From_dcalc.translate_program_with_exceptions prg
|
||||
| _, _, Custom _ -> invalid_arg "Driver.Passes.lcalc"
|
||||
| _, Custom _ -> invalid_arg "Driver.Passes.lcalc"
|
||||
in
|
||||
let prg =
|
||||
if optimize then begin
|
||||
|
@ -74,8 +74,7 @@ module To_jsoo = struct
|
||||
(* Tuples are encoded as an javascript polymorphic array. *)
|
||||
Format.fprintf fmt "Js.Unsafe.any_js_array Js.t "
|
||||
| TOption t ->
|
||||
Format.fprintf fmt "@[<hov 2>(%a)@] %a" format_typ_with_parens t
|
||||
format_enum_name Expr.option_enum
|
||||
Format.fprintf fmt "@[<hov 2>(%a)@] Js.opt" format_typ_with_parens t
|
||||
| TDefault t -> format_typ fmt t
|
||||
| TEnum e -> Format.fprintf fmt "%a Js.t" format_enum_name e
|
||||
| TArray t1 ->
|
||||
@ -116,7 +115,8 @@ module To_jsoo = struct
|
||||
elts
|
||||
| TOption t ->
|
||||
Format.fprintf fmt
|
||||
"(function Eoption.ENone -> Js.null | Eoption.ESome x -> %a x)"
|
||||
"(function Eoption.ENone () -> Js.null | Eoption.ESome x -> Js.some \
|
||||
(%a x))"
|
||||
format_to_js t
|
||||
| TAny -> Format.fprintf fmt "Js.Unsafe.inject"
|
||||
| TArrow _ | TClosureEnv -> ()
|
||||
|
Loading…
Reference in New Issue
Block a user