[infer] rename Mangled.Set and add Mangled.Map

Reviewed By: jberdine

Differential Revision: D4496582

fbshipit-source-id: 74d513f
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 38a336694a
commit c047819ab3

@ -61,7 +61,12 @@ let from_package_class package_name class_name =>
/** Pretty print a mangled name */
let pp f pn => F.fprintf f "%s" (to_string pn);
let module MangledSet = Caml.Set.Make {
let module Set = Caml.Set.Make {
type nonrec t = t;
let compare = compare;
};
let module Map = Caml.Map.Make {
type nonrec t = t;
let compare = compare;
};

@ -49,4 +49,8 @@ let pp: Format.formatter => t => unit;
/** Set of Mangled. */
let module MangledSet: Caml.Set.S with type elt = t;
let module Set: Caml.Set.S with type elt = t;
/** Map with Mangled as key */
let module Map: Caml.Map.S with type key = t;

@ -148,14 +148,14 @@ let translate_formals program tenv cn impl =
let translate_locals program tenv formals bytecode jbir_code =
let formal_set =
IList.fold_left
(fun set (var, _) -> Mangled.MangledSet.add var set)
Mangled.MangledSet.empty
(fun set (var, _) -> Mangled.Set.add var set)
Mangled.Set.empty
formals in
let collect (seen_vars, l) (var, typ) =
if Mangled.MangledSet.mem var seen_vars then
if Mangled.Set.mem var seen_vars then
(seen_vars, l)
else
(Mangled.MangledSet.add var seen_vars, (var, typ) :: l) in
(Mangled.Set.add var seen_vars, (var, typ) :: l) in
let with_bytecode_vars =
(* Do not consider parameters as local variables *)
let init = (formal_set, []) in

Loading…
Cancel
Save