123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116openImportletwith_outputfn~binary~f=matchfnwith|None|Some"-"->fstdout|Somefn->Out_channel.with_filefn~binary~f;;moduleKind=structtypet=Intf|Implletof_filenamefn:toption=ifCaml.Filename.check_suffixfn".ml"thenSomeImplelseifCaml.Filename.check_suffixfn".mli"thenSomeIntfelseNone;;letdescribe=function|Impl->"implementation"|Intf->"interface";;letequal:t->t->bool=Poly.equalendmoduleSome_intf_or_impl=structtypet=|IntfofMigrate_parsetree.Driver.some_signature|ImplofMigrate_parsetree.Driver.some_structureletto_ast_io(ast:t)~add_ppx_context=letopenMigrate_parsetreeinmatchastwith|Intf(Migrate_parsetree.Driver.Sig((moduleVer),sg))->letsg=(Migrate_parsetree.Versions.migrate(moduleVer)(moduleVersions.OCaml_current)).copy_signaturesginletsg=ifadd_ppx_contextthenOcaml_common.Ast_mapper.add_ppx_context_sig~tool_name:"ppxlib_driver"sgelsesginAst_io.Intf((moduleVersions.OCaml_current),sg)|Impl(Migrate_parsetree.Driver.Str((moduleVer),st))->letst=(Migrate_parsetree.Versions.migrate(moduleVer)(moduleVersions.OCaml_current)).copy_structurestinletst=ifadd_ppx_contextthenOcaml_common.Ast_mapper.add_ppx_context_str~tool_name:"ppxlib_driver"stelsestinAst_io.Impl((moduleVersions.OCaml_current),st)endmoduleIntf_or_impl=structtypet=|Intfofsignature|Implofstructureletmapt(map:Ast_traverse.map)=matchtwith|Implx->Impl(map#structurex)|Intfx->Intf(map#signaturex);;letmap_with_contextt(map:_Ast_traverse.map_with_context)ctx=matchtwith|Implx->Impl(map#structurectxx)|Intfx->Intf(map#signaturectxx);;letkind:_->Kind.t=function|Intf_->Intf|Impl_->Implletof_some_intf_or_implast:t=letopenSome_intf_or_implinmatchastwith|Intf(Migrate_parsetree.Driver.Sig((moduleVer),sg))->Intf((Migrate_parsetree.Versions.migrate(moduleVer)(modulePpxlib_ast.Selected_ast)).copy_signaturesg)|Impl(Migrate_parsetree.Driver.Str((moduleVer),st))->Impl((Migrate_parsetree.Versions.migrate(moduleVer)(modulePpxlib_ast.Selected_ast)).copy_structurest)letof_ast_ioast:t=letopenMigrate_parsetreeinmatchastwith|Ast_io.Intf((moduleVer),sg)->letmoduleC=Versions.Convert(Ver)(Ppxlib_ast.Selected_ast)inIntf(C.copy_signaturesg)|Ast_io.Impl((moduleVer),st)->letmoduleC=Versions.Convert(Ver)(Ppxlib_ast.Selected_ast)inImpl(C.copy_structurest)end(*
let map_impl x ~(f : _ Intf_or_impl.t -> _ Intf_or_impl.t) =
match f (Impl x) with
| Impl x -> x
| Intf _ -> assert false
let map_intf x ~(f : _ Intf_or_impl.t -> _ Intf_or_impl.t) =
match f (Intf x) with
| Intf x -> x
| Impl _ -> assert false
*)