File tree Expand file tree Collapse file tree 3 files changed +11
-25
lines changed Expand file tree Collapse file tree 3 files changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -1256,9 +1256,8 @@ let getFullFromCmt ~uri =
12561256let extraForModule ~package modname =
12571257 if Hashtbl. mem package.pathsForModule modname then
12581258 let paths = Hashtbl. find package.pathsForModule modname in
1259- match SharedTypes. getSrc paths with
1260- | None -> None
1261- | Some src -> getFullFromCmt ~uri: (Uri2. fromPath src)
1259+ let uri = SharedTypes. getUri paths in
1260+ getFullFromCmt ~uri
12621261 else None
12631262
12641263let fileForCmt ~moduleName ~cmt ~uri state =
@@ -1287,11 +1286,7 @@ let fileForModule modname ~package =
12871286 let paths = Hashtbl. find package.pathsForModule modname in
12881287 (* TODO: do better *)
12891288 let cmt = SharedTypes. getCmt ~interface: false paths in
1290- let uri =
1291- match SharedTypes. getSrc paths with
1292- | Some sourcePath -> Uri2. fromPath sourcePath
1293- | None -> Uri2. fromPath cmt
1294- in
1289+ let uri = SharedTypes. getUri paths in
12951290 Log. log (" FINDING docs for module " ^ SharedTypes. showPaths paths);
12961291 Log. log (" FINDING " ^ cmt ^ " uri " ^ Uri2. toString uri);
12971292 match fileForCmt ~module Name:modname ~cmt ~uri state with
Original file line number Diff line number Diff line change @@ -305,13 +305,6 @@ let definition ~file ~package stamp tip =
305305 maybeLog (" Inner uri " ^ Uri2. toString uri);
306306 Some (uri, loc))
307307
308- let orLog message v =
309- match v with
310- | None ->
311- maybeLog message;
312- None
313- | _ -> v
314-
315308let definitionForLocItem ~full :{file; package} locItem =
316309 match locItem.locType with
317310 | Typed (_ , _ , Definition (stamp , tip )) -> (
@@ -335,13 +328,11 @@ let definitionForLocItem ~full:{file; package} locItem =
335328 None
336329 | TopLevelModule name -> (
337330 maybeLog (" Toplevel " ^ name);
338- let open Infix in
339- match
340- Hashtbl. find_opt package.pathsForModule name
341- |> orLog " No paths found" |?> getSrc |> orLog " No src found"
342- with
331+ match Hashtbl. find_opt package.pathsForModule name with
343332 | None -> None
344- | Some src -> Some (Uri2. fromPath src, Utils. topLoc src))
333+ | Some paths ->
334+ let uri = getUri paths in
335+ Some (uri, Utils. topLoc (Uri2. toPath uri)))
345336 | LModule (LocalReference (stamp, tip))
346337 | Typed (_ , _ , LocalReference (stamp , tip )) ->
347338 maybeLog (" Local defn " ^ tipToString tip);
Original file line number Diff line number Diff line change @@ -130,11 +130,11 @@ let showPaths paths =
130130 | IntfAndImpl {cmti; resi; cmt; res} ->
131131 Printf. sprintf " IntfAndImpl(%s, %s, %s, %s)" cmti resi cmt res
132132
133- let getSrc p =
133+ let getUri p =
134134 match p with
135- | Impl {res} -> Some res
136- | Namespace _ -> None
137- | IntfAndImpl {resi} -> Some resi
135+ | Impl {res} -> Uri2. fromPath res
136+ | Namespace {cmt} -> Uri2. fromPath cmt
137+ | IntfAndImpl {resi} -> Uri2. fromPath resi
138138
139139let getCmt ~interface p =
140140 match p with
You can’t perform that action at this time.
0 commit comments