Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file visitor_ast_js.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283(* Yoann Padioleau
*
* Copyright (C) 2019 r2c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation, with the
* special exception on linking described in file license.txt.
*
* This library 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 file
* license.txt for more details.
*)openOcamlopenAst_js(* generated by ocamltarzan with: camlp4o -o /tmp/yyy.ml -I pa/ pa_type_conv.cmo pa_visitor.cmo pr_o.cmo /tmp/xxx.ml *)(*****************************************************************************)(* Prelude *)(*****************************************************************************)(* hooks *)typevisitor_in={kexpr:(expr->unit)*visitor_out->expr->unit;kstmt:(stmt->unit)*visitor_out->stmt->unit;ktop:(toplevel->unit)*visitor_out->toplevel->unit;kprop:(property->unit)*visitor_out->property->unit;kparam:(parameter->unit)*visitor_out->parameter->unit;kinfo:(tok->unit)*visitor_out->tok->unit;}andvisitor_out=any->unitletdefault_visitor={kexpr=(fun(k,_)x->kx);kstmt=(fun(k,_)x->kx);ktop=(fun(k,_)x->kx);kprop=(fun(k,_)x->kx);kparam=(fun(k,_)x->kx);kinfo=(fun(k,_)x->kx);}let(mk_visitor:visitor_in->visitor_out)=funvin->letrecv_infox=letkx=matchxwith{Parse_info.token=_v_pinfox;transfo=_v_transfo}->(*
let arg = Parse_info.v_pinfo v_pinfox in
let arg = v_unit v_comments in
let arg = Parse_info.v_transformation v_transfo in
*)()invin.kinfo(k,all_functions)x(* start of auto generation *)andv_tokv=v_infovandv_wrap:'a.('a->unit)->'awrap->unit=fun_of_a(v1,v2)->letv1=_of_av1andv2=v_infov2in()andv_namev=v_wrapv_stringvandv_filenamev=v_wrapv_stringvandv_special=function|UseStrict->()|Null->()|Undefined->()|This->()|Super->()|Require->()|Exports->()|Module->()|Define->()|Arguments->()|New->()|NewTarget->()|Eval->()|Seq->()|Typeof->()|Instanceof->()|In->()|Delete->()|Void->()|Spread->()|Yield->()|YieldStar->()|Await->()|Encapsv1->letv1=v_optionv_namev1in()|Not->()|And->()|Or->()|BitNot->()|BitAnd->()|BitOr->()|BitXor->()|Lsr->()|Asr->()|Lsl->()|Equal->()|PhysEqual->()|Lower->()|Greater->()|Plus->()|Minus->()|Mul->()|Div->()|Mod->()|Expo->()|IncrDecrv->letv=v_inc_decvin()andv_inc_dec_=()andv_property_name=function|PNv1->letv1=v_namev1in()|PN_Computedv1->letv1=v_exprv1in()andv_labelv=v_wrapv_stringvandv_expr(x:expr)=(* tweak *)letkx=matchxwith|Boolv1->letv1=v_wrapv_boolv1in()|Numv1->letv1=v_wrapv_stringv1in()|Stringv1->letv1=v_wrapv_stringv1in()|Regexpv1->letv1=v_wrapv_stringv1in()|Id(v1,_)->letv1=v_namev1in()|IdSpecialv1->letv1=v_wrapv_specialv1in()|Nop->()|Assign((v1,v2))->letv1=v_exprv1andv2=v_exprv2in()|ArrAccess((v1,v2))->letv1=v_exprv1andv2=v_exprv2in()|Objv1->letv1=v_obj_v1in()|Class(v1,v2)->letv1=v_class_v1inletv2=v_optionv_namev2in()|ObjAccess((v1,v2))->letv1=v_exprv1andv2=v_property_namev2in()|Fun((v1,v2))->letv1=v_fun_v1andv2=v_optionv_namev2in()|Apply((v1,v2))->letv1=v_exprv1andv2=v_listv_exprv2in()|Arr((v1))->letv1=v_listv_exprv1in()|Conditional((v1,v2,v3))->letv1=v_exprv1andv2=v_exprv2andv3=v_exprv3in()invin.kexpr(k,all_functions)xandv_stmtx=letkx=matchxwith|VarDeclv1->letv1=v_varv1in()|Blockv1->letv1=v_listv_stmtv1in()|ExprStmtv1->letv1=v_exprv1in()|If((v1,v2,v3))->letv1=v_exprv1andv2=v_stmtv2andv3=v_stmtv3in()|Do((v1,v2))->letv1=v_stmtv1andv2=v_exprv2in()|While((v1,v2))->letv1=v_exprv1andv2=v_stmtv2in()|For((v1,v2))->letv1=v_for_headerv1andv2=v_stmtv2in()|Switch((v1,v2))->letv1=v_exprv1andv2=v_listv_casev2in()|Continuev1->letv1=v_optionv_labelv1in()|Breakv1->letv1=v_optionv_labelv1in()|Returnv1->letv1=v_exprv1in()|Label((v1,v2))->letv1=v_labelv1andv2=v_stmtv2in()|Throwv1->letv1=v_exprv1in()|Try((v1,v2,v3))->letv1=v_stmtv1andv2=v_option(fun(v1,v2)->letv1=v_namev1andv2=v_stmtv2in())v2andv3=v_optionv_stmtv3in()invin.kstmt(k,all_functions)xandv_for_header=function|ForClassic((v1,v2,v3))->letv1=v_either(v_listv_var)v_exprv1andv2=v_exprv2andv3=v_exprv3in()|ForIn((v1,v2))->letv1=v_eitherv_varv_exprv1andv2=v_exprv2in()andv_case=function|Case((v1,v2))->letv1=v_exprv1andv2=v_stmtv2in()|Defaultv1->letv1=v_stmtv1in()andv_resolved_name_=()andv_var{v_name=v_v_name;v_kind=v_v_kind;v_init=v_v_init;v_resolved=v_v_resolved}=letarg=v_namev_v_nameinletarg=v_var_kindv_v_kindinletarg=v_exprv_v_initinletarg=v_refv_resolved_namev_v_resolvedin()andv_var_kind=function|Var->()|Let->()|Const->()andv_fun_{f_props=v_f_props;f_params=v_f_params;f_body=v_f_body}=letarg=v_listv_fun_propv_f_propsinletarg=v_listv_parameterv_f_paramsinletarg=v_stmtv_f_bodyin()andv_parameterx=letkx=matchxwith{p_name=v_p_name;p_default=v_p_default;p_dots=v_p_dots}->letarg=v_namev_p_nameinletarg=v_optionv_exprv_p_defaultinletarg=v_boolv_p_dotsin()invin.kparam(k,all_functions)xandv_fun_prop=function|Get->()|Set->()|Generator->()|Async->()andv_obj_v=v_listv_propertyvandv_class_{c_extends=v_c_extends;c_body=v_c_body}=letarg=v_optionv_exprv_c_extendsinletarg=v_listv_propertyv_c_bodyin()andv_propertyx=(* tweak *)letkx=matchxwith|Field((v1,v2,v3))->letv1=v_property_namev1andv2=v_listv_property_propv2andv3=v_exprv3in()|FieldSpreadv1->letv1=v_exprv1in()invin.kprop(k,all_functions)xandv_property_prop=function|Static->()|Public->()|Private->()|Protected->()andv_toplevelx=letkx=matchxwith|Vv1->letv1=v_varv1in()|S((v1,v2))->letv1=v_tokv1andv2=v_stmtv2in()|Mv1->letv1=v_module_directivev1in()invin.ktop(k,all_functions)xandv_module_directivex=matchxwith|Import((v1,v2,v3))->letv1=v_namev1andv2=v_namev2andv3=v_filenamev3in()|ImportCss((v1))->letv1=v_namev1in()|ImportEffect((v1))->letv1=v_namev1in()|ModuleAlias((v1,v2))->letv1=v_namev1andv2=v_filenamev2in()|Export((v1))->letv1=v_namev1in()andv_any=function|Exprv1->letv1=v_exprv1in()|Stmtv1->letv1=v_stmtv1in()|Topv1->letv1=v_toplevelv1in()|Programv1->letv1=v_programv1in()andv_programv=v_listv_toplevelvandall_functionsx=v_anyxinall_functions(*****************************************************************************)(* Helpers *)(*****************************************************************************)letdo_visit_with_refmk_hooks=funany->letres=ref[]inlethooks=mk_hooksresinletvout=mk_visitorhooksinvoutany;List.rev!res