Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file merlin_state.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293(* This file is part of ppx_cstubs (https://github.com/fdopen/ppx_cstubs)
* Copyright (c) 2018-2019 fdopen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)typeto_child={opt:Options.merlin_state;sr:Script_result.merlin_state;ur:Uniq_ref.merlin_state;lc:Lconst.merlin_state;ui:Uniq_ids.merlin_state;}typefrom_child={fsr:Script_result.merlin_state;fur:Uniq_ref.merlin_state;fui:Uniq_ids.merlin_state;}letto_child()={opt=Options.merlin_save();sr=Script_result.merlin_save();ur=Uniq_ref.merlin_save();lc=Lconst.merlin_save();ui=Uniq_ids.merlin_save();}letfrom_parent{opt;sr;ur;lc;ui}=Options.merlin_restoreopt;Script_result.merlin_restoresr;Uniq_ref.merlin_restoreur;Lconst.merlin_restorelc;Uniq_ids.merlin_restoreuiletto_parent()={fsr=Script_result.merlin_save();fur=Uniq_ref.merlin_save();fui=Uniq_ids.merlin_save();}letfrom_child{fsr;fur;fui}=Script_result.merlin_restorefsr;Uniq_ref.merlin_restorefur;Uniq_ids.merlin_restorefuitypeerror=(* fixme: more errors? *)|LocationofLocation.t*string|EnvofEnv.error|TypecoreofLocation.t*Env.t*Typecore.error|TypedeclofLocation.t*Typedecl.errorletto_errorx=leterx=leta,b=Toplevel.serialize_location_errorxinLocation(a,b)inletcommonx=lets=Printexc.to_stringxintryStd.Util.error"%s"swithLocation.Errorx->erxinletcatche=matchignore(Marshal.to_stringe[]:string)with|()->e|exceptionInvalid_argument_->commonxinmatchxwith|Location.Errorx->erx|Env.Errore->catch(Enve)|Typecore.Error(e,f,g)->catch(Typecore(e,f,g))|Typedecl.Error(l,e)->catch(Typedecl(l,e))|x->commonxletraise_error=function|Location(loc,s)->Std.Util.error~loc"%s"s|Envx->raise(Env.Errorx)|Typecore(a,b,c)->raise(Typecore.Error(a,b,c))|Typedecl(a,b)->raise(Typedecl.Error(a,b))