123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130# 1 "src/model/compat.cppo.ml"(*
* Copyright (c) 2019 Jon Ludlam <jon@recoil.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)(* Compatibility for older versions of OCaml *)(* This module contains a subset of the types in ocaml.git/typing/types.ml from
the latest version of the compiler. There is also conditionally compiled code
for older versions of the compiler to convert from their version of types.ml
to this version. This simplifies the support for older versions of OCaml.
This is only done for the subsets of the types that contain the most invasive
changes. For other simpler changes we use in-line cppo directives *)typevisibility=|Exported|Hiddentypemodule_type=Mty_identofPath.t|Mty_signatureofsignature|Mty_functoroffunctor_parameter*module_type|Mty_aliasofPath.tandfunctor_parameter=|Unit|NamedofIdent.toption*module_typeandmodule_presence=|Mp_present|Mp_absentandsignature=signature_itemlistandsignature_item=Sig_valueofIdent.t*Types.value_description*visibility|Sig_typeofIdent.t*Types.type_declaration*Types.rec_status*visibility|Sig_typextofIdent.t*Types.extension_constructor*Types.ext_status*visibility|Sig_moduleofIdent.t*module_presence*module_declaration*Types.rec_status*visibility|Sig_modtypeofIdent.t*modtype_declaration*visibility|Sig_classofIdent.t*Types.class_declaration*Types.rec_status*visibility|Sig_class_typeofIdent.t*Types.class_type_declaration*Types.rec_status*visibilityandmodule_declaration={md_type:module_type;md_attributes:Parsetree.attributes;md_loc:Location.t;}andmodtype_declaration={mtd_type:module_typeoption;(* Note: abstract *)mtd_attributes:Parsetree.attributes;mtd_loc:Location.t;}letoptconv=function|None->None|Somex->Some(convx)# 76 "src/model/compat.cppo.ml"letrecsignature:Types.signature->signature=funx->List.mapsignature_itemxandsignature_item:Types.signature_item->signature_item=function|Types.Sig_value(a,b,c)->Sig_value(a,b,visibilityc)|Types.Sig_type(a,b,c,d)->Sig_type(a,b,c,visibilityd)|Types.Sig_typext(a,b,c,d)->Sig_typext(a,b,c,visibilityd)|Types.Sig_module(a,b,c,d,e)->Sig_module(a,module_presenceb,module_declarationc,d,visibilitye)|Types.Sig_modtype(a,b,c)->Sig_modtype(a,modtype_declarationb,visibilityc)|Types.Sig_class(a,b,c,d)->Sig_class(a,b,c,visibilityd)|Types.Sig_class_type(a,b,c,d)->Sig_class_type(a,b,c,visibilityd)andvisibility:Types.visibility->visibility=function|Types.Hidden->Hidden|Types.Exported->Exportedandmodule_type:Types.module_type->module_type=function|Types.Mty_identp->Mty_identp|Types.Mty_signatures->Mty_signature(signatures)|Types.Mty_functor(a,b)->Mty_functor(functor_parametera,module_typeb)|Types.Mty_aliasp->Mty_aliaspandfunctor_parameter:Types.functor_parameter->functor_parameter=function|Types.Unit->Unit|Types.Named(a,b)->Named(a,module_typeb)andmodule_presence:Types.module_presence->module_presence=function|Types.Mp_present->Mp_present|Types.Mp_absent->Mp_absentandmodule_declaration:Types.module_declaration->module_declaration=funx->{md_type=module_typex.Types.md_type;md_attributes=x.md_attributes;md_loc=x.md_loc}andmodtype_declaration:Types.modtype_declaration->modtype_declaration=funx->{mtd_type=optmodule_typex.Types.mtd_type;mtd_attributes=x.Types.mtd_attributes;mtd_loc=x.Types.mtd_loc}# 227 "src/model/compat.cppo.ml"(* Shapes were introduced in OCaml 4.14.0. They're used for resolving to source-code
locations *)# 231 "src/model/compat.cppo.ml"typeshape=Shape.ttype'ashape_uid_map='aShape.Uid.Map.ttypeuid_to_loc=Warnings.locTypes.Uid.Tbl.tletempty_map=Shape.Uid.Map.emptyletshape_of_cmt_infos:Cmt_format.cmt_infos->shapeoption=funx->x.cmt_impl_shape