123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110# 3 "shape_tools.cppo.ml"openOdoc_model.PathsopenOdoc_model.NamesmoduleKind=Shape.Sig_component_kindlet(>>=)mf=matchmwithSomex->fx|None->Nonetypet=Shape.t*Odoc_model.Paths.Identifier.SourceLocation.tShape.Uid.Map.t(** Project an identifier into a shape. *)letrecshape_of_idenv:[<Identifier.NonSrc.t_pv]Identifier.id->Shape.toption=letprojparentkindname=letitem=Shape.Item.makenamekindinmatchshape_of_idenv(parent:>Identifier.NonSrc.t)with|Someshape->Some(Shape.projshapeitem)|None->Noneinfunid->matchid.ivwith|`Root(_,name)->beginmatchEnv.lookup_unit(ModuleName.to_stringname)envwith|Some(Env.Foundunit)->(matchunit.shape_infowith|Some(shape,_)->Someshape|None->None)|_->Noneend|`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_idenv(parent:>Identifier.NonSrc.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)|`ExtensionDecl(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.Mkletunit_of_uiduid=matchuidwith|Shape.Uid.Compilation_units->Somes|Item{comp_unit;id=_}->Somecomp_unit|Predef_->None|Internal->Noneletlookup_shape:Env.t->Shape.t->Identifier.SourceLocation.toption=funenvquery->letmoduleReduce=Shape.Make_reduce(structtypeenv=unitletfuel=10letread_unit_shape~unit_name=matchEnv.lookup_unitunit_nameenvwith|Some(Foundunit)->(matchunit.shape_infowith|Some(shape,_)->Someshape|None->None)|_->Noneletfind_shape__=raiseNot_foundend)inletresult=trySome(Reduce.reduce()query)withNot_found->Noneinresult>>=funresult->result.uid>>=funuid->unit_of_uiduid>>=fununit_name->matchEnv.lookup_unitunit_nameenvwith|None|SomeForward_reference|Some(Not_found)->None|Some(Foundunit)->letuid_to_id=matchunit.shape_infowith|Some(_,uid_to_id)->uid_to_id|None->Odoc_model.Compat.empty_mapinmatchShape.Uid.Map.find_optuiduid_to_idwith|Somex->Somex|None->(matchunit.source_infowith|Somesi->Some(MkId.source_location_modsi.id)|None->None)letlookup_def:Env.t->Identifier.NonSrc.t->Identifier.SourceLocation.toption=funenvid->matchshape_of_idenvidwith|None->None|Somequery->lookup_shapeenvquery