@@ -468,6 +468,9 @@ and forStructure ~env strItems =
468468
469469let fileForCmtInfos ~moduleName ~uri
470470 ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos ) =
471+ let env =
472+ {Env. stamps = Stamps. init () ; modulePath = File (uri, moduleName)}
473+ in
471474 match cmt_annots with
472475 | Partial_implementation parts ->
473476 let items =
@@ -479,9 +482,6 @@ let fileForCmtInfos ~moduleName ~uri
479482 | _ -> None )
480483 |> List. concat
481484 in
482- let env =
483- {Env. stamps = Stamps. init () ; modulePath = File (uri, moduleName)}
484- in
485485 let structure = forStructure ~env items in
486486 {File. uri; moduleName = cmt_modname; stamps = env.stamps; structure}
487487 | Partial_interface parts ->
@@ -494,21 +494,12 @@ let fileForCmtInfos ~moduleName ~uri
494494 | _ -> None )
495495 |> List. concat
496496 in
497- let env =
498- {Env. stamps = Stamps. init () ; modulePath = File (uri, moduleName)}
499- in
500497 let structure = forSignature ~env items in
501498 {uri; moduleName = cmt_modname; stamps = env.stamps; structure}
502499 | Implementation structure ->
503- let env =
504- {Env. stamps = Stamps. init () ; modulePath = File (uri, moduleName)}
505- in
506500 let structure = forStructure ~env structure.str_items in
507501 {uri; moduleName = cmt_modname; stamps = env.stamps; structure}
508502 | Interface signature ->
509- let env =
510- {Env. stamps = Stamps. init () ; modulePath = File (uri, moduleName)}
511- in
512503 let structure = forSignature ~env signature.sig_items in
513504 {uri; moduleName = cmt_modname; stamps = env.stamps; structure}
514505 | _ -> File. create moduleName uri
@@ -526,13 +517,11 @@ let fileForCmt ~moduleName ~cmt ~uri =
526517
527518let fileForModule moduleName ~package =
528519 match Hashtbl. find_opt package.pathsForModule moduleName with
529- | Some paths -> (
520+ | Some paths ->
530521 let uri = getUri paths in
531522 let cmt = getCmtPath ~uri paths in
532523 Log. log (" fileForModule " ^ showPaths paths);
533- match fileForCmt ~cmt ~module Name ~uri with
534- | None -> None
535- | Some docs -> Some docs)
524+ fileForCmt ~cmt ~module Name ~uri
536525 | None ->
537526 Log. log (" No path for module " ^ moduleName);
538527 None
0 commit comments