12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576# 3 "src/loader/lookup_def.ml"openOdoc_modelopenOdoc_model.PathsopenOdoc_model.NamesmoduleKind=Shape.Sig_component_kindlet(>>=)mf=matchmwithSomex->fx|None->Nonetypet=Shape.t(** Project an identifier into a shape. *)letrecshape_of_idlookup_shape:[<Identifier.t_pv]Identifier.id->Shape.toption=letprojparentkindname=letitem=Shape.Item.makenamekindinmatchshape_of_idlookup_shape(parent:>Identifier.t)with|Someshape->Some(Shape.projshapeitem)|None->Noneinfunid->matchid.ivwith|`Root(_,name)->lookup_shape(ModuleName.to_stringname)>>=fun(_,shape)->Someshape|`Module(parent,name)->projparentKind.Module(ModuleName.to_stringname)|`Resultparent->(* Apply the functor to an empty signature. This doesn't seem to cause
any problem, as the shape would stop resolve on an item inside the
result of the function, which is what we want. *)shape_of_idlookup_shape(parent:>Identifier.t)>>=funparent->Some(Shape.appparent~arg:(Shape.strShape.Item.Map.empty))|`ModuleType(parent,name)->projparentKind.Module_type(ModuleTypeName.to_stringname)|`Type(parent,name)->projparentKind.Type(TypeName.to_stringname)|`Value(parent,name)->projparentKind.Value(ValueName.to_stringname)|`Extension(parent,name)->projparentKind.Extension_constructor(ExtensionName.to_stringname)|`Exception(parent,name)->projparentKind.Extension_constructor(ExceptionName.to_stringname)|`Class(parent,name)->projparentKind.Class(ClassName.to_stringname)|`ClassType(parent,name)->projparentKind.Class_type(ClassTypeName.to_stringname)|`Page_|`LeafPage_|`Label_|`CoreType_|`CoreException_|`Constructor_|`Field_|`Method_|`InstanceVariable_|`Parameter_->(* Not represented in shapes. *)NonemoduleMkId=Identifier.Mkletlookup_deflookup_unitid=matchshape_of_idlookup_unitidwith|None->None|Somequery->letmoduleReduce=Shape.Make_reduce(structtypeenv=unitletfuel=10letread_unit_shape~unit_name=matchlookup_unitunit_namewith|Some(_,shape)->Someshape|None->Noneletfind_shape__=raiseNot_foundend)inletresult=trySome(Reduce.reduce()query)withNot_found->Noneinresult>>=funresult->result.uid>>=funuid->Uid.unpack_uid(Uid.of_shape_uiduid)>>=fun(unit_name,id)->lookup_unitunit_name>>=fun(unit,_)->unit.Lang.Compilation_unit.sources>>=funsources->letanchor=id>>=funid->Some(Uid.anchor_of_idid)inSome{Lang.Locations.source_parent=sources.id;anchor}letof_cmt(cmt:Cmt_format.cmt_infos)=cmt.cmt_impl_shape