let clean kf state =
let map =
M.filter_base
(function
(* Duplicate code from Base.is_formal_or_local,
replacing Utils.is_formal_or_local by Db.is_formal_or_local,
but no way to produce non mutually recursive module
dependencies between Base and Db :-( *)
| Base.Var(v, _) | Base.Initialized_Var(v, _) ->
not (Kernel_function.is_formal_or_local v kf)
| Base.Null | Base.String _ | Base.Cell_class _ ->
assert false)
state.map
in
{ state with map = map }