12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(* Copyright (C) 2019 - Present Hongbo Zhang, Authors of ReScript
*
* 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, either version 3 of the License, or
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a 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. *)openImportopenAst_helpertypet={override:override_flag;ident:Longident.tAsttypes.loc;loc:location;attributes:attributes;}letdestruct=letrecinnereacc=matchewith|{pexp_desc=Pexp_open({popen_override=override;popen_expr={pmod_desc=Pmod_identident;_};_;},cont);pexp_attributes=attributes;pexp_loc=loc;_;}->innercont({override;ident;loc;attributes}::acc)|_->(e,acc)infune->innere[](** destruct {[ A.B.let open C in (a,b)]} *)letdestruct_open_tuple=letrecinnereacc:(tlist*expressionlist*_)option=matchewith|{pexp_desc=Pexp_open({popen_override=override;popen_expr={pmod_desc=Pmod_identident;_};_;},cont);pexp_loc=loc;pexp_attributes=attributes;_;}->innercont({override;ident;loc;attributes}::acc)|{pexp_desc=Pexp_tuplees;pexp_attributes;_}->Some(acc,es,pexp_attributes)|_->Noneinfune->innere[]letrestore_expxsqualifiers=List.fold_leftqualifiers~init:xs~f:(funx{override;ident;loc;attributes}->Exp.open_~loc~attrs:attributes(Ast_helper.Opn.mk~override(Ast_helper.Mod.identident))x)