refactor(compiler): revert #5042a006 for the Lcalc.Ast.NoValueProvided exn

This commit is contained in:
EmileRolley 2021-06-08 19:37:06 +02:00
parent df578e78bc
commit e469854e86
5 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,7 @@ type lit =
| LDate of Runtime.date
| LDuration of Runtime.duration
type except = ConflictError | EmptyError | NoValueProvided of Dcalc.Ast.expr Pos.marked | Crash
type except = ConflictError | EmptyError | NoValueProvided | Crash
type expr =
| EVar of expr Bindlib.var Pos.marked

View File

@ -30,7 +30,7 @@ type lit =
| LDate of Runtime.date
| LDuration of Runtime.duration
type except = ConflictError | EmptyError | NoValueProvided of Dcalc.Ast.expr Pos.marked | Crash
type except = ConflictError | EmptyError | NoValueProvided | Crash
type expr =
| EVar of expr Bindlib.var Pos.marked

View File

@ -90,7 +90,7 @@ and translate_expr (ctx : ctx) (e : D.expr Pos.marked) : A.expr Pos.marked Bindl
Bindlib.box_apply
(fun arg ->
Pos.same_pos_as
(A.ECatch (arg, A.EmptyError, Pos.same_pos_as (A.ERaise (A.NoValueProvided e)) e))
(A.ECatch (arg, A.EmptyError, Pos.same_pos_as (A.ERaise A.NoValueProvided) e))
e)
(translate_expr ctx arg)
| D.EApp (e1, args) ->

View File

@ -62,8 +62,7 @@ let format_exception (fmt : Format.formatter) (exn : except) : unit =
| EmptyError -> Format.fprintf fmt "EmptyError"
| ConflictError -> Format.fprintf fmt "ConflictError"
| Crash -> Format.fprintf fmt "Crash"
(* TODO: manage position. *)
| NoValueProvided _ -> Format.fprintf fmt "NoValueProvided"
| NoValueProvided -> Format.fprintf fmt "NoValueProvided"
let format_keyword (fmt : Format.formatter) (s : string) : unit =
Format.fprintf fmt "%s" (Utils.Cli.print_with_style [ ANSITerminal.red ] "%s" s)

View File

@ -234,7 +234,8 @@ let rec format_expr (ctx : Dcalc.Ast.decl_ctx) (fmt : Format.formatter) (e : exp
| ConflictError -> Format.fprintf fmt "ConflictError"
| EmptyError -> Format.fprintf fmt "EmptyError"
| Crash -> Format.fprintf fmt "Crash"
| NoValueProvided (_, pos) ->
| NoValueProvided ->
let _, pos = e in
Format.fprintf fmt
"(NoValueProvided@ @[<hov 2>{filename = \"%s\";@ start_line=%d;@ start_column=%d;@ \
end_line=%d; end_column=%d;@ law_headings=%a}@])"