@@ -155,6 +155,14 @@ module Declared = struct
155155end
156156
157157module Stamps : sig
158+ type kind =
159+ | KType of Type .t Declared .t
160+ | KValue of Types .type_expr Declared .t
161+ | KModule of Module .t Declared .t
162+ | KConstructor of Constructor .t Declared .t
163+
164+ val locOfKind : kind -> Warnings .loc
165+
158166 type t
159167
160168 val addConstructor : t -> int -> Constructor .t Declared .t -> unit
@@ -169,6 +177,7 @@ module Stamps : sig
169177 val iterModules : (int -> Module .t Declared .t -> unit ) -> t -> unit
170178 val iterTypes : (int -> Type .t Declared .t -> unit ) -> t -> unit
171179 val iterValues : (int -> Types .type_expr Declared .t -> unit ) -> t -> unit
180+ val getEntries : t -> (int * kind ) list
172181end = struct
173182 type 't stampMap = (int , 't Declared .t ) Hashtbl .t
174183
@@ -178,6 +187,12 @@ end = struct
178187 | KModule of Module .t Declared .t
179188 | KConstructor of Constructor .t Declared .t
180189
190+ let locOfKind = function
191+ | KType declared -> declared.extentLoc
192+ | KValue declared -> declared.extentLoc
193+ | KModule declared -> declared.extentLoc
194+ | KConstructor declared -> declared.extentLoc
195+
181196 type t = (int , kind ) Hashtbl .t
182197
183198 let init () = Hashtbl. create 10
@@ -239,6 +254,8 @@ end = struct
239254 | KConstructor d -> f stamp d
240255 | _ -> () )
241256 stamps
257+
258+ let getEntries t = t |> Hashtbl. to_seq |> List. of_seq
242259end
243260
244261module File = struct
@@ -533,16 +550,25 @@ let locKindToString = function
533550 | NotFound -> " NotFound"
534551 | Definition (_ , tip ) -> " (Definition " ^ Tip. toString tip ^ " )"
535552
553+ let constantToString = function
554+ | Asttypes. Const_int _ -> " Const_int"
555+ | Asttypes. Const_char _ -> " Const_char"
556+ | Asttypes. Const_string _ -> " Const_string"
557+ | Asttypes. Const_float _ -> " Const_float"
558+ | Asttypes. Const_int32 _ -> " Const_int32"
559+ | Asttypes. Const_int64 _ -> " Const_int64"
560+ | Asttypes. Const_bigint _ -> " Const_bigint"
561+
536562let locTypeToString = function
537563 | Typed (name , e , locKind ) ->
538- " Typed " ^ name ^ " " ^ Shared. typeToString e ^ " "
539- ^ locKindToString locKind
540- | Constant _ -> " Constant"
564+ Format. sprintf " Typed(%s) %s: %s " (locKindToString locKind) name
565+ ( Shared. typeToString e)
566+ | Constant c -> " Constant " ^ constantToString c
541567 | OtherExpression e -> " OtherExpression " ^ Shared. typeToString e
542568 | OtherPattern e -> " OtherPattern " ^ Shared. typeToString e
543569 | LModule locKind -> " LModule " ^ locKindToString locKind
544- | TopLevelModule _ -> " TopLevelModule"
545- | TypeDefinition _ -> " TypeDefinition"
570+ | TopLevelModule name -> " TopLevelModule " ^ name
571+ | TypeDefinition ( name , _ , _ ) -> " TypeDefinition " ^ name
546572
547573let locItemToString {loc = {Location. loc_start; loc_end} ; locType} =
548574 let pos1 = Utils. cmtPosToPosition loc_start in
0 commit comments