Skip to content

Commit

Permalink
unsafe also disables check
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Sep 17, 2023
1 parent 39a87b8 commit b85d528
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@

let ( let* ) o f = match o with Error msg -> Error msg | Ok v -> f v

let until_check m = Check.modul m
let until_check ?(unsafe = false) m = if unsafe then Ok m else Check.modul m

let until_group m =
let* m = until_check m in
let until_group ?unsafe m =
let* m = until_check ?unsafe m in
let* m = Grouped.of_symbolic m in
Ok m

let until_assign m =
let* m = until_group m in
let until_assign ?unsafe m =
let* m = until_group ?unsafe m in
let* m = Assigned.of_grouped m in
Ok m

let until_simplify m =
let* m = until_assign m in
let until_simplify ?unsafe m =
let* m = until_assign ?unsafe m in
let* m = Rewrite.modul m in
Ok m

let until_typecheck ?(unsafe = false) m =
let* m = until_simplify m in
let* m = until_simplify ~unsafe m in
if unsafe then Ok m
else
let* () = Typecheck.modul m in
Expand Down
4 changes: 2 additions & 2 deletions src/compile.mli
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(** Utility functions to compile a module until a given step. *)

val until_check : Symbolic.modul -> Symbolic.modul Result.t
val until_check : ?unsafe:bool -> Symbolic.modul -> Symbolic.modul Result.t

val until_simplify : Symbolic.modul -> Simplified.modul Result.t
val until_simplify : ?unsafe:bool -> Symbolic.modul -> Simplified.modul Result.t

(** compile a module with a given link state and produce a new link state and a
runnable module *)
Expand Down

0 comments on commit b85d528

Please sign in to comment.