@@ -155,6 +155,14 @@ module Declared = struct
155
155
end
156
156
157
157
module 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
+
158
166
type t
159
167
160
168
val addConstructor : t -> int -> Constructor .t Declared .t -> unit
@@ -169,6 +177,7 @@ module Stamps : sig
169
177
val iterModules : (int -> Module .t Declared .t -> unit ) -> t -> unit
170
178
val iterTypes : (int -> Type .t Declared .t -> unit ) -> t -> unit
171
179
val iterValues : (int -> Types .type_expr Declared .t -> unit ) -> t -> unit
180
+ val getEntries : t -> (int * kind ) list
172
181
end = struct
173
182
type 't stampMap = (int , 't Declared .t ) Hashtbl .t
174
183
@@ -178,6 +187,12 @@ end = struct
178
187
| KModule of Module .t Declared .t
179
188
| KConstructor of Constructor .t Declared .t
180
189
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
+
181
196
type t = (int , kind ) Hashtbl .t
182
197
183
198
let init () = Hashtbl. create 10
@@ -239,6 +254,8 @@ end = struct
239
254
| KConstructor d -> f stamp d
240
255
| _ -> () )
241
256
stamps
257
+
258
+ let getEntries t = t |> Hashtbl. to_seq |> List. of_seq
242
259
end
243
260
244
261
module File = struct
@@ -533,16 +550,25 @@ let locKindToString = function
533
550
| NotFound -> " NotFound"
534
551
| Definition (_ , tip ) -> " (Definition " ^ Tip. toString tip ^ " )"
535
552
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
+
536
562
let locTypeToString = function
537
563
| 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
541
567
| OtherExpression e -> " OtherExpression " ^ Shared. typeToString e
542
568
| OtherPattern e -> " OtherPattern " ^ Shared. typeToString e
543
569
| LModule locKind -> " LModule " ^ locKindToString locKind
544
- | TopLevelModule _ -> " TopLevelModule"
545
- | TypeDefinition _ -> " TypeDefinition"
570
+ | TopLevelModule name -> " TopLevelModule " ^ name
571
+ | TypeDefinition ( name , _ , _ ) -> " TypeDefinition " ^ name
546
572
547
573
let locItemToString {loc = {Location. loc_start; loc_end} ; locType} =
548
574
let pos1 = Utils. cmtPosToPosition loc_start in
0 commit comments