1- let loc_to_string (loc : Warnings.loc ) : string =
2- Format. sprintf " (%02d,%02d--%02d,%02d)" loc.loc_start.pos_lnum
3- (loc.loc_start.pos_cnum - loc.loc_start.pos_bol)
4- loc.loc_end.pos_lnum
5- (loc.loc_end.pos_cnum - loc.loc_end.pos_bol)
6-
71let filter_by_cursor cursor (loc : Warnings.loc ) : bool =
82 match cursor with
93 | None -> true
@@ -70,16 +64,16 @@ let dump ?filter rescript_json cmt_path =
7064 match kind with
7165 | KType t ->
7266 Printf. printf " %d ktype %s\n " stamp
73- (loc_to_string t.extentLoc)
67+ (Warnings. loc_to_string t.extentLoc)
7468 | KValue t ->
7569 Printf. printf " %d kvalue %s\n " stamp
76- (loc_to_string t.extentLoc)
70+ (Warnings. loc_to_string t.extentLoc)
7771 | KModule t ->
7872 Printf. printf " %d kmodule %s\n " stamp
79- (loc_to_string t.extentLoc)
73+ (Warnings. loc_to_string t.extentLoc)
8074 | KConstructor t ->
8175 Printf. printf " %d kconstructor %s\n " stamp
82- (loc_to_string t.extentLoc));
76+ (Warnings. loc_to_string t.extentLoc));
8377
8478 (* dump the structure *)
8579 let rec dump_structure indent (structure : Module.structure ) =
@@ -91,11 +85,13 @@ let dump ?filter rescript_json cmt_path =
9185 let open Module in
9286 match item.kind with
9387 | Value _typedExpr ->
94- Printf. printf " Value %s %s\n " item.name (loc_to_string item.loc)
88+ Printf. printf " Value %s %s\n " item.name
89+ (Warnings. loc_to_string item.loc)
9590 | Type _ ->
96- Printf. printf " Type %s %s\n " item.name (loc_to_string item.loc)
91+ Printf. printf " Type %s %s\n " item.name (Warnings. loc_to_string item.loc)
9792 | Module {type_ = m } ->
98- Printf. printf " Module %s %s\n " item.name (loc_to_string item.loc);
93+ Printf. printf " Module %s %s\n " item.name
94+ (Warnings. loc_to_string item.loc);
9995 dump_module indent m
10096 and dump_module indent (module_ : Module.t ) =
10197 match module_ with
@@ -127,6 +123,6 @@ let dump ?filter rescript_json cmt_path =
127123 | 0 -> compare aLoc.pos_cnum bLoc.pos_cnum
128124 | c -> c)
129125 |> List. iter (fun {loc; locType} ->
130- let locStr = loc_to_string loc in
126+ let locStr = Warnings. loc_to_string loc in
131127 let kindStr = SharedTypes. locTypeToString locType in
132128 Printf. printf " %s %s\n " locStr kindStr)
0 commit comments