[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_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 cardinal = M.cardinal

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

@ -83,6 +83,8 @@ module type MonoMap = sig
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 cardinal : t -> int

@ -85,6 +85,8 @@ module type MonoMap = sig
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 cardinal : t -> int

Loading…
Cancel
Save