From c047819ab33ebce511b177b3ea8b5405011a450d Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Wed, 1 Feb 2017 13:53:11 -0800 Subject: [PATCH] [infer] rename Mangled.Set and add Mangled.Map Reviewed By: jberdine Differential Revision: D4496582 fbshipit-source-id: 74d513f --- infer/src/IR/Mangled.re | 7 ++++++- infer/src/IR/Mangled.rei | 6 +++++- infer/src/java/jTrans.ml | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/infer/src/IR/Mangled.re b/infer/src/IR/Mangled.re index cd4114eb0..453df11b1 100644 --- a/infer/src/IR/Mangled.re +++ b/infer/src/IR/Mangled.re @@ -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; }; diff --git a/infer/src/IR/Mangled.rei b/infer/src/IR/Mangled.rei index 4d1a9e818..dffa51d1d 100644 --- a/infer/src/IR/Mangled.rei +++ b/infer/src/IR/Mangled.rei @@ -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; diff --git a/infer/src/java/jTrans.ml b/infer/src/java/jTrans.ml index e1f2d8145..7944dbc68 100644 --- a/infer/src/java/jTrans.ml +++ b/infer/src/java/jTrans.ml @@ -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