[absint] Add filter_map to MonoMap signature

Reviewed By: jvillard

Differential Revision: D27879096

fbshipit-source-id: da5aae3ef
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 35d6c53e9c
commit d17cbfc155

@ -607,6 +607,12 @@ module SafeInvertedMap (Key : PrettyPrintable.PrintableOrderedType) (ValueDomain
let filter = M.filter let filter = M.filter
let filter_map f x =
M.filter_map
(fun k v -> match f k v with Some v when ValueDomain.is_top v -> None | v_opt -> v_opt)
x
let partition = M.partition let partition = M.partition
let cardinal = M.cardinal let cardinal = M.cardinal

@ -134,12 +134,11 @@ module UncheckedCalleesCond = struct
let filter_known_expensive fields_map = let filter_known_expensive fields_map =
fold filter_map
(fun fields callees acc -> (fun _ callees ->
let expensive_callees = UncheckedCallees.filter_known_expensive callees in let expensive_callees = UncheckedCallees.filter_known_expensive callees in
if UncheckedCallees.is_empty expensive_callees then acc Option.some_if (not (UncheckedCallees.is_empty expensive_callees)) expensive_callees )
else add fields expensive_callees acc ) fields_map
fields_map empty
end end
module Loc = struct module Loc = struct

@ -83,6 +83,8 @@ module type MonoMap = sig
val filter : (key -> value -> bool) -> t -> t val filter : (key -> value -> bool) -> t -> t
val filter_map : (key -> value -> value option) -> t -> t
val partition : (key -> value -> bool) -> t -> t * t val partition : (key -> value -> bool) -> t -> t * t
val cardinal : t -> int val cardinal : t -> int

@ -85,6 +85,8 @@ module type MonoMap = sig
val filter : (key -> value -> bool) -> t -> t val filter : (key -> value -> bool) -> t -> t
val filter_map : (key -> value -> value option) -> t -> t
val partition : (key -> value -> bool) -> t -> t * t val partition : (key -> value -> bool) -> t -> t * t
val cardinal : t -> int val cardinal : t -> int

Loading…
Cancel
Save