[trivial] procname should implement Hashable

Summary: No reason to use custom function name and not implement `Hashable`.

Reviewed By: mbouaziz

Differential Revision: D15097603

fbshipit-source-id: 7303fc15e
master
Nikos Gorogiannis 6 years ago committed by Facebook Github Bot
parent 95ddfd04ca
commit 8450ac36d8

@ -986,6 +986,7 @@ module Procname = struct
let equal = [%compare.equal: t]
(** hash function for procname *)
let hash = Hashtbl.hash
let with_block_parameters base blocks = WithBlockParameters (base, blocks)
@ -1278,15 +1279,12 @@ module Procname = struct
let describe f pn = F.pp_print_string f (hashable_name pn)
(** hash function for procname *)
let hash_pname = Hashtbl.hash
module Hashable = struct
type nonrec t = t
let equal = equal
let hash = hash_pname
let hash = hash
end
module Hash = Hashtbl.Make (Hashable)

@ -552,7 +552,7 @@ being the name of the struct, [None] means the parameter is of some other type.
val is_objc_block : t -> bool
(** Return whether the procname is a block procname. *)
val hash_pname : t -> int
val hash : t -> int
(** Hash function for procname. *)
val is_c_method : t -> bool

@ -113,18 +113,18 @@ module H = Hashtbl.Make (struct
| Null_field_access (so, fn, _, _) ->
Hashtbl.hash (6, string_opt_hash so, string_hash (Typ.Fieldname.to_string fn))
| Call_receiver_annotation_inconsistent (ann, so, pn, _) ->
Hashtbl.hash (7, ann, string_opt_hash so, Typ.Procname.hash_pname pn)
Hashtbl.hash (7, ann, string_opt_hash so, Typ.Procname.hash pn)
| Parameter_annotation_inconsistent (ann, s, n, pn, _, _) ->
Hashtbl.hash (8, ann, string_hash s, n, Typ.Procname.hash_pname pn)
Hashtbl.hash (8, ann, string_hash s, n, Typ.Procname.hash pn)
| Return_annotation_inconsistent (ann, pn, _) ->
Hashtbl.hash (9, ann, Typ.Procname.hash_pname pn)
Hashtbl.hash (9, ann, Typ.Procname.hash pn)
| Return_over_annotated pn ->
Hashtbl.hash (10, Typ.Procname.hash_pname pn)
Hashtbl.hash (10, Typ.Procname.hash pn)
| Inconsistent_subclass_return_annotation (pn, opn) ->
Hashtbl.hash (11, Typ.Procname.hash_pname pn, Typ.Procname.hash_pname opn)
Hashtbl.hash (11, Typ.Procname.hash pn, Typ.Procname.hash opn)
| Inconsistent_subclass_parameter_annotation (param_name, pos, pn, opn) ->
let pn_hash = string_hash param_name in
Hashtbl.hash (12, pn_hash, pos, Typ.Procname.hash_pname pn, Typ.Procname.hash_pname opn)
Hashtbl.hash (12, pn_hash, pos, Typ.Procname.hash pn, Typ.Procname.hash opn)
let hash (err_inst, instr_ref_opt) =

Loading…
Cancel
Save