@@ -364,6 +364,22 @@ let definitionForLocItem ~full:{file; package} locItem =
364
364
maybeLog (" Got stamp " ^ string_of_int stamp);
365
365
definition ~file: env.file ~package stamp tip)))
366
366
367
+ let digConstructor ~env ~package path =
368
+ match ProcessCmt. resolveFromCompilerPath ~env ~package path with
369
+ | `Not_found -> None
370
+ | `Stamp stamp -> (
371
+ match Hashtbl. find_opt env.file.stamps.types stamp with
372
+ | None -> None
373
+ | Some t -> Some (env, t))
374
+ | `Exported (env , name ) -> (
375
+ match Hashtbl. find_opt env.exported.types name with
376
+ | None -> None
377
+ | Some stamp -> (
378
+ match Hashtbl. find_opt env.file.stamps.types stamp with
379
+ | None -> None
380
+ | Some t -> Some (env, t)))
381
+ | _ -> None
382
+
367
383
let typeDefinitionForLocItem ~full :{file; package} locItem =
368
384
match locItem.locType with
369
385
| Constant _ | TopLevelModule _ | LModule _ -> None
@@ -373,20 +389,9 @@ let typeDefinitionForLocItem ~full:{file; package} locItem =
373
389
match Shared. digConstructor typ with
374
390
| None -> None
375
391
| Some path -> (
376
- match ProcessCmt. resolveFromCompilerPath ~env ~package path with
377
- | `Not_found -> None
378
- | `Stamp stamp -> (
379
- match Hashtbl. find_opt env.file.stamps.types stamp with
380
- | None -> None
381
- | Some declared -> Some (env.file.uri, declared.item.decl.type_loc))
382
- | `Exported (env , name ) -> (
383
- match Hashtbl. find_opt env.exported.types name with
384
- | None -> None
385
- | Some stamp -> (
386
- match Hashtbl. find_opt env.file.stamps.types stamp with
387
- | None -> None
388
- | Some declared -> Some (env.file.uri, declared.item.decl.type_loc))))
389
- )
392
+ match digConstructor ~env ~package path with
393
+ | Some (env , declared ) -> Some (env.file.uri, declared.item.decl.type_loc)
394
+ | None -> None ))
390
395
391
396
let isVisible (declared : _ SharedTypes.declared ) =
392
397
declared.isExported
0 commit comments