File tree Expand file tree Collapse file tree 3 files changed +20
-20
lines changed Expand file tree Collapse file tree 3 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ src/ProcessCmt.cmx : src/Utils.cmx src/Uri2.cmx src/SharedTypes.cmx \
29
29
src/Protocol.cmx : src/vendor/Json.cmx
30
30
src/References.cmx : src/Utils.cmx src/Uri2.cmx src/SharedTypes.cmx \
31
31
src/ProcessCmt.cmx src/Log.cmx src/Infix.cmx
32
- src/Shared.cmx : src/PrintType.cmx src/Files.cmx
32
+ src/Shared.cmx : src/PrintType.cmx src/Log.cmx src/ Files.cmx
33
33
src/SharedTypes.cmx : src/Utils.cmx src/Uri2.cmx src/Shared.cmx \
34
34
src/Infix.cmx
35
35
src/Uri2.cmx :
Original file line number Diff line number Diff line change @@ -535,8 +535,8 @@ let forCmt ~moduleName ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) =
535
535
536
536
let fileForCmt ~moduleName ~uri cmt =
537
537
match Shared. tryReadCmt cmt with
538
- | Error e -> Error e
539
- | Ok infos -> Ok (forCmt ~module Name ~uri infos)
538
+ | None -> None
539
+ | Some infos -> Some (forCmt ~module Name ~uri infos)
540
540
541
541
let addLocItem extra loc locType =
542
542
if not loc.Warnings. loc_ghost then
@@ -1178,20 +1178,18 @@ let extraForCmt ~file ({cmt_annots} : Cmt_format.cmt_infos) =
1178
1178
1179
1179
let fullForCmt ~moduleName ~package ~uri cmt =
1180
1180
match Shared. tryReadCmt cmt with
1181
- | Error e -> Error e
1182
- | Ok infos ->
1181
+ | None -> None
1182
+ | Some infos ->
1183
1183
let file = forCmt ~module Name ~uri infos in
1184
1184
let extra = extraForCmt ~file infos in
1185
- Ok {file; extra; package}
1185
+ Some {file; extra; package}
1186
1186
1187
1187
open SharedTypes
1188
1188
1189
1189
let newFileForCmt ~moduleName cmtCache changed ~cmt ~uri =
1190
1190
match fileForCmt ~module Name ~uri cmt with
1191
- | Error e ->
1192
- Log. log e;
1193
- None
1194
- | Ok file ->
1191
+ | None -> None
1192
+ | Some file ->
1195
1193
Hashtbl. replace cmtCache cmt (changed, file);
1196
1194
Some file
1197
1195
@@ -1209,10 +1207,8 @@ let getFullFromCmt ~uri =
1209
1207
| Some paths -> (
1210
1208
let cmt = SharedTypes. getCmt ~interface: (Utils. endsWith path " i" ) paths in
1211
1209
match fullForCmt ~module Name ~package ~uri cmt with
1212
- | Error message ->
1213
- prerr_endline message;
1214
- None
1215
- | Ok full ->
1210
+ | None -> None
1211
+ | Some full ->
1216
1212
Hashtbl. replace package.interModuleDependencies moduleName
1217
1213
(SharedTypes. hashList full.extra.externalReferences |> List. map fst);
1218
1214
Some full)
Original file line number Diff line number Diff line change 1
1
let tryReadCmt cmt =
2
- if not (Files. exists cmt) then Error (" Cmt file does not exist " ^ cmt)
2
+ if not (Files. exists cmt) then (
3
+ Log. log (" Cmt file does not exist " ^ cmt);
4
+ None )
3
5
else
4
6
match Cmt_format. read_cmt cmt with
5
7
| exception Cmi_format. Error err ->
6
- Error
8
+ Log. log
7
9
(" Failed to load " ^ cmt ^ " as a cmt w/ ocaml version " ^ " 406"
8
10
^ " , error: "
9
11
^
10
12
(Cmi_format. report_error Format. str_formatter err;
11
- Format. flush_str_formatter () ))
13
+ Format. flush_str_formatter () ));
14
+ None
12
15
| exception err ->
13
- Error
16
+ Log. log
14
17
(" Invalid cmt format " ^ cmt
15
18
^ " - probably wrong ocaml version, expected " ^ Config. version ^ " : "
16
- ^ Printexc. to_string err)
17
- | x -> Ok x
19
+ ^ Printexc. to_string err);
20
+ None
21
+ | x -> Some x
18
22
19
23
(* * TODO move to the Process_ stuff *)
20
24
let rec dig typ =
You can’t perform that action at this time.
0 commit comments