123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899letread_lexbuf?annot_schema?(expand=false)?keep_poly?(xdebug=false)?(inherit_fields=false)?(inherit_variants=false)?(pos_fname="")?(pos_lnum=1)lexbuf=Lexer.init_fnamelexbufpos_fnamepos_lnum;lethead,body=Parser.full_moduleLexer.tokenlexbufinCheck.checkbody;letbody=ifinherit_fields||inherit_variantsthenInherit.expand_module_body~inherit_fields~inherit_variantsbodyelsebodyinlet(body,original_types)=ifexpandthenExpand.expand_module_body?keep_poly~debug:xdebugbodyelse(body,Hashtbl.create0)inletfull_module=(head,body)in(matchannot_schemawith|None->()|Someschema->Annot.validateschema(Ast.Full_modulefull_module));(full_module,original_types)letread_channel?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnumic=letlexbuf=Lexing.from_channelicinletpos_fname=ifpos_fname=None&&ic==stdinthenSome"<stdin>"elsepos_fnameinread_lexbuf?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnumlexbufletload_file?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnumfile=letic=open_infileinletfinally()=close_in_noerricintryletpos_fname=matchpos_fnamewithNone->Somefile|Some_->pos_fnameinletast=read_channel?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnumicinfinally();astwithe->finally();raiseeletload_string?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnums=letlexbuf=Lexing.from_stringsinread_lexbuf?annot_schema?expand?keep_poly?xdebug?inherit_fields?inherit_variants?pos_fname?pos_lnumlexbufmoduleTsort=Sort.Make(structtypet=Ast.module_itemtypeid=string(* type name *)letiddef=letAst.Type(_,(name,_,_),_)=definnameletto_stringname=nameend)lettsortl0=letignorable=["unit";"bool";"int";"float";"string";"abstract"]inletl=List.map(fundef->letAst.Type(_,(_,_,_),x)=definletdeps=Ast.extract_type_names~ignorablexin(def,deps))l0inList.rev(Tsort.sortl)