@@ -64,27 +64,34 @@ let definedForLoc ~file ~getModule locKind =
64
64
| NotFound -> None
65
65
| LocalReference (stamp , tip ) | Definition (stamp , tip ) ->
66
66
inner ~file stamp tip
67
- | GlobalReference (moduleName , path , tip ) ->
68
- (maybeLog (" Getting global " ^ moduleName);
69
- match getModule moduleName with
70
- | None -> Error (" Cannot get module " ^ moduleName)
71
- | Some file -> (
72
- let env = Query. fileEnv file in
73
- match Query. resolvePath ~env ~path ~get Module with
74
- | None -> Error (" Cannot resolve path " ^ pathToString path)
75
- | Some (env , name ) -> (
76
- match Query. exportedForTip ~env name tip with
77
- | None ->
78
- Error (" Exported not found for tip " ^ name ^ " > " ^ tipToString tip)
79
- | Some stamp -> (
80
- maybeLog (" Getting for " ^ string_of_int stamp ^ " in " ^ name);
67
+ | GlobalReference (moduleName , path , tip ) -> (
68
+ maybeLog (" Getting global " ^ moduleName);
69
+ match getModule moduleName with
70
+ | None ->
71
+ Log. log (" Cannot get module " ^ moduleName);
72
+ None
73
+ | Some file -> (
74
+ let env = Query. fileEnv file in
75
+ match Query. resolvePath ~env ~path ~get Module with
76
+ | None ->
77
+ Log. log (" Cannot resolve path " ^ pathToString path);
78
+ None
79
+ | Some (env , name ) -> (
80
+ match Query. exportedForTip ~env name tip with
81
+ | None ->
82
+ Log. log
83
+ (" Exported not found for tip " ^ name ^ " > " ^ tipToString tip);
84
+ None
85
+ | Some stamp -> (
86
+ maybeLog (" Getting for " ^ string_of_int stamp ^ " in " ^ name);
81
87
82
- match inner ~file: env.file stamp tip with
83
- | None -> Error " could not get defined"
84
- | Some res ->
85
- maybeLog " Yes!! got it" ;
86
- Ok res))))
87
- |> RResult. toOptionAndLog
88
+ match inner ~file: env.file stamp tip with
89
+ | None ->
90
+ Log. log " could not get defined" ;
91
+ None
92
+ | Some res ->
93
+ maybeLog " Yes!! got it" ;
94
+ Some res))))
88
95
89
96
let alternateDeclared ~file ~pathsForModule ~getUri declared tip =
90
97
match Hashtbl. find_opt pathsForModule file.moduleName with
@@ -97,19 +104,23 @@ let alternateDeclared ~file ~pathsForModule ~getUri declared tip =
97
104
let intfUri = Uri2. fromPath intf in
98
105
let implUri = Uri2. fromPath impl in
99
106
if intfUri = file.uri then
100
- match getUri implUri |> RResult. toOptionAndLog with
101
- | None -> None
102
- | Some (file , extra ) -> (
107
+ match getUri implUri with
108
+ | Error e ->
109
+ Log. log e;
110
+ None
111
+ | Ok (file , extra ) -> (
103
112
match
104
113
Query. declaredForExportedTip ~stamps: file.stamps
105
114
~exported: file.contents.exported declared.name.txt tip
106
115
with
107
116
| None -> None
108
117
| Some declared -> Some (file, extra, declared))
109
118
else
110
- match getUri intfUri |> RResult. toOptionAndLog with
111
- | None -> None
112
- | Some (file , extra ) -> (
119
+ match getUri intfUri with
120
+ | Error e ->
121
+ Log. log e;
122
+ None
123
+ | Ok (file , extra ) -> (
113
124
match
114
125
Query. declaredForExportedTip ~stamps: file.stamps
115
126
~exported: file.contents.exported declared.name.txt tip
0 commit comments