@@ -23,10 +23,9 @@ type t = string option [@@deriving eq, ord, hash]
2323(* * [None] means top. *)
2424
2525let hash x =
26- if get_string_domain () <> Unit then
27- hash x
28- else
29- 13859
26+ match get_string_domain () with
27+ | Disjoint | Flat -> hash x
28+ | Unit -> 13859
3029
3130let show = function
3231 | Some x -> " \" " ^ x ^ " \" "
@@ -40,10 +39,9 @@ include Printable.SimpleShow (
4039 )
4140
4241let of_string x =
43- if get_string_domain () = Unit then
44- None
45- else
46- Some x
42+ match get_string_domain () with
43+ | Unit -> None
44+ | Disjoint | Flat -> Some x
4745let to_string x = x
4846
4947(* only keep part before first null byte *)
@@ -92,24 +90,25 @@ let join x y =
9290 | _ , None -> None
9391 | Some a , Some b when a = b -> Some a
9492 | Some a , Some b (* when a <> b *) ->
95- if get_string_domain () = Disjoint then
96- raise Lattice. Uncomparable
97- else
98- None
93+ match get_string_domain () with
94+ | Disjoint -> raise Lattice. Uncomparable
95+ | Flat -> None
96+ | Unit -> assert false
9997
10098let meet x y =
10199 match x, y with
102100 | None , a
103101 | a , None -> a
104102 | Some a , Some b when a = b -> Some a
105103 | Some a , Some b (* when a <> b *) ->
106- if get_string_domain () = Disjoint then
107- raise Lattice. Uncomparable
108- else
109- raise Lattice. BotValue
104+ match get_string_domain () with
105+ | Disjoint -> raise Lattice. Uncomparable
106+ | Flat -> raise Lattice. BotValue
107+ | Unit -> assert false
110108
111109let repr x =
112- if get_string_domain () = Disjoint then
110+ match get_string_domain () with
111+ | Disjoint ->
113112 x (* everything else is kept separate, including strings if not limited *)
114- else
113+ | Flat | Unit ->
115114 None (* all strings together if limited *)
0 commit comments