Skip to content

Commit ce84c26

Browse files
authored
Expose Bap_var.sort_of_typ (#1563)
For convenience, we can convert a BIL type to a Core Theory sort.
1 parent f21b437 commit ce84c26

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

lib/bap/bap.mli

+6
Original file line numberDiff line numberDiff line change
@@ -2806,6 +2806,12 @@ module Std : sig
28062806
*)
28072807
val check : bil -> (unit,error) Result.t
28082808

2809+
(** [sort t] translates the type [t] into a Core Theory sort.
2810+
2811+
@since 2.6.0
2812+
*)
2813+
val sort : t -> unit Theory.Value.sort
2814+
28092815
(** BIL type errors.
28102816
28112817
Not all syntactically correct expressions make sense. A

lib/bap_types/bap_helpers.ml

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ module Type = struct
150150
let check xs = match check xs with
151151
| None -> Ok ()
152152
| Some err -> Error err
153+
154+
let sort = Bap_var.sort_of_typ
153155
end
154156

155157
(*

lib/bap_types/bap_helpers.mli

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(** BIL high level functions. *)
22
open Core_kernel[@@warning "-D"]
3+
open Bap_core_theory
34
open Bap_common
45
open Bap_bil
56
open Bap_visitor
@@ -36,6 +37,7 @@ module Type : sig
3637
val check : stmt list -> (unit,Bap_type_error.t) Result.t
3738
val infer : exp -> (typ, Bap_type_error.t) Result.t
3839
val infer_exn : exp -> typ
40+
val sort : typ -> unit Theory.Value.sort
3941
end
4042

4143
module Eff : sig

0 commit comments

Comments
 (0)