@@ -64,27 +64,33 @@ 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);
81
-
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
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);
87
+ match inner ~file: env.file stamp tip with
88
+ | None ->
89
+ Log. log " could not get defined" ;
90
+ None
91
+ | Some res ->
92
+ maybeLog " Yes!! got it" ;
93
+ Some res))))
88
94
89
95
let alternateDeclared ~file ~pathsForModule ~getUri declared tip =
90
96
match Hashtbl. find_opt pathsForModule file.moduleName with
@@ -97,19 +103,23 @@ let alternateDeclared ~file ~pathsForModule ~getUri declared tip =
97
103
let intfUri = Uri2. fromPath intf in
98
104
let implUri = Uri2. fromPath impl in
99
105
if intfUri = file.uri then
100
- match getUri implUri |> RResult. toOptionAndLog with
101
- | None -> None
102
- | Some (file , extra ) -> (
106
+ match getUri implUri with
107
+ | Error e ->
108
+ Log. log e;
109
+ None
110
+ | Ok (file , extra ) -> (
103
111
match
104
112
Query. declaredForExportedTip ~stamps: file.stamps
105
113
~exported: file.contents.exported declared.name.txt tip
106
114
with
107
115
| None -> None
108
116
| Some declared -> Some (file, extra, declared))
109
117
else
110
- match getUri intfUri |> RResult. toOptionAndLog with
111
- | None -> None
112
- | Some (file , extra ) -> (
118
+ match getUri intfUri with
119
+ | Error e ->
120
+ Log. log e;
121
+ None
122
+ | Ok (file , extra ) -> (
113
123
match
114
124
Query. declaredForExportedTip ~stamps: file.stamps
115
125
~exported: file.contents.exported declared.name.txt tip
0 commit comments