language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
OCaml Interface
hhvm/hphp/hack/src/naming/naming_validate_module.mli
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) val pass : (Naming_phase_error.t -> unit) -> Naming_phase_env.t Naming_phase_pass.t
OCaml
hhvm/hphp/hack/src/naming/naming_validate_supportdyn.ml
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude module Err = Naming_phase_error module SN = Naming_special_names module Env = struct let is_hhi Naming_phase_env.{ is_hhi; _ } = is_hhi let is_systemlib Naming_phase_env.{ is_systemlib; _ } = is_systemlib let supportdynamic_type_hint_enabled Naming_phase_env.{ supportdynamic_type_hint_enabled; _ } = supportdynamic_type_hint_enabled end let on_hint_ on_error hint_ ~ctx = let err_opt = if Env.is_hhi ctx || Env.is_systemlib ctx || Env.supportdynamic_type_hint_enabled ctx then None else match hint_ with | Aast.Happly ((pos, ty_name), _) when String.(equal ty_name SN.Classes.cSupportDyn) -> Some (Err.supportdyn pos) | _ -> None in Option.iter ~f:on_error err_opt; (ctx, Ok hint_) let pass on_error = let id = Aast.Pass.identity () in Naming_phase_pass.top_down Aast.Pass.{ id with on_ty_hint_ = Some (on_hint_ on_error) }
OCaml Interface
hhvm/hphp/hack/src/naming/naming_validate_supportdyn.mli
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) (* This validation pass will warn when use of \\HH\\supportdyn. This pass must be run before `everything-sdt` elaboration which will add this class. The pass is intended for use when the `--enable-supportdyn-hint` typechecker option is _not_ set *) val pass : (Naming_phase_error.t -> unit) -> Naming_phase_env.t Naming_phase_pass.t
OCaml
hhvm/hphp/hack/src/naming/naming_validate_xhp_name.ml
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude module Err = Naming_phase_error let on_hint_ on_error hint_ ~ctx = let err_opt = match hint_ with (* some common Xhp screw ups *) | Aast.Happly ((pos, ty_name), _hints) when String.( equal ty_name "Xhp" || equal ty_name ":Xhp" || equal ty_name "XHP") -> Some (Err.naming @@ Naming_error.Disallowed_xhp_type { pos; ty_name }) | _ -> None in Option.iter ~f:on_error err_opt; (ctx, Ok hint_) let pass on_error = let id = Aast.Pass.identity () in Naming_phase_pass.top_down Aast.Pass.{ id with on_ty_hint_ = Some (on_hint_ on_error) }
OCaml Interface
hhvm/hphp/hack/src/naming/naming_validate_xhp_name.mli
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) (* This validation pass will raise errors when it encounters use of certain miscased or errneous XHP related class names. *) val pass : (Naming_phase_error.t -> unit) -> Naming_phase_env.t Naming_phase_pass.t
OCaml
hhvm/hphp/hack/src/naming/nast.ml
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude open Aast module SN = Naming_special_names let show_tprim = Naming_special_names.Typehints.( function | Tnull -> null | Tvoid -> void | Tint -> int | Tbool -> bool | Tfloat -> float | Tstring -> string | Tnum -> num | Tresource -> resource | Tarraykey -> arraykey | Tnoreturn -> noreturn) type program = (unit, unit) Aast.program [@@deriving show] type def = (unit, unit) Aast.def type expr = (unit, unit) Aast.expr [@@deriving eq, show] type expr_ = (unit, unit) Aast.expr_ type stmt = (unit, unit) Aast.stmt type block = (unit, unit) Aast.block type user_attribute = (unit, unit) Aast.user_attribute [@@deriving eq, show] type class_id_ = (unit, unit) Aast.class_id_ [@@deriving eq] type class_ = (unit, unit) Aast.class_ type class_var = (unit, unit) Aast.class_var type method_ = (unit, unit) Aast.method_ type file_attribute = (unit, unit) Aast.file_attribute type fun_ = (unit, unit) Aast.fun_ type capture_lid = unit Aast.capture_lid type efun = (unit, unit) Aast.efun type fun_def = (unit, unit) Aast.fun_def type func_body = (unit, unit) Aast.func_body type fun_param = (unit, unit) Aast.fun_param type typedef = (unit, unit) Aast.typedef type tparam = (unit, unit) Aast.tparam type gconst = (unit, unit) Aast.gconst type class_const = (unit, unit) Aast.class_const type class_id = (unit, unit) Aast.class_id type catch = (unit, unit) Aast.catch type case = (unit, unit) Aast.case type stmt_match = (unit, unit) Aast.stmt_match type stmt_match_arm = (unit, unit) Aast.stmt_match_arm type default_case = (unit, unit) Aast.default_case type gen_case = (unit, unit) Aast.gen_case type field = (unit, unit) Aast.field type afield = (unit, unit) Aast.afield type xhp_attribute = (unit, unit) Aast.xhp_attribute type expression_tree = (unit, unit) Aast.expression_tree type targ = unit Aast.targ type sid = Aast.sid [@@deriving show] type shape_field_name = Ast_defs.shape_field_name type hint = Aast.hint type class_hint = Aast.class_hint type trait_hint = Aast.trait_hint type xhp_attr_hint = Aast.xhp_attr_hint type type_hint = unit Aast.type_hint type module_def = (unit, unit) Aast.module_def module ShapeMap = Ast_defs.ShapeMap let class_id_to_str = function | CIparent -> SN.Classes.cParent | CIself -> SN.Classes.cSelf | CIstatic -> SN.Classes.cStatic | CIexpr (_, _, This) -> SN.SpecialIdents.this | CIexpr (_, _, Lvar (_, x)) -> "$" ^ Local_id.to_string x | CIexpr (_, _, Lplaceholder _) -> SN.SpecialIdents.placeholder | CIexpr (_, _, Dollardollar _) -> SN.SpecialIdents.dollardollar | CIexpr _ -> assert false | CI (_, x) -> x let is_kvc_kind name = String.equal name SN.Collections.cMap || String.equal name SN.Collections.cImmMap || String.equal name SN.Collections.cDict let get_kvc_kind name = match name with | x when String.equal x SN.Collections.cMap -> Map | x when String.equal x SN.Collections.cImmMap -> ImmMap | x when String.equal x SN.Collections.cDict -> Dict | _ -> Errors.internal_error Pos.none ("Invalid KeyValueCollection name: " ^ name); Map let kvc_kind_to_name kind = match kind with | Map -> SN.Collections.cMap | ImmMap -> SN.Collections.cImmMap | Dict -> SN.Collections.cDict let is_vc_kind name = String.equal name SN.Collections.cVector || String.equal name SN.Collections.cImmVector || String.equal name SN.Collections.cSet || String.equal name SN.Collections.cImmSet || String.equal name SN.Collections.cKeyset || String.equal name SN.Collections.cVec let get_vc_kind name = match name with | x when String.equal x SN.Collections.cVector -> Vector | x when String.equal x SN.Collections.cImmVector -> ImmVector | x when String.equal x SN.Collections.cVec -> Vec | x when String.equal x SN.Collections.cSet -> Set | x when String.equal x SN.Collections.cImmSet -> ImmSet | x when String.equal x SN.Collections.cKeyset -> Keyset | _ -> Errors.internal_error Pos.none ("Invalid ValueCollection name: " ^ name); Set let vc_kind_to_name kind = match kind with | Vector -> SN.Collections.cVector | ImmVector -> SN.Collections.cImmVector | Vec -> SN.Collections.cVec | Set -> SN.Collections.cSet | ImmSet -> SN.Collections.cImmSet | Keyset -> SN.Collections.cKeyset (* XHP attribute helpers *) let map_xhp_attr (f : pstring -> pstring) (g : expr -> expr) = function | Xhp_simple { xs_name = id; xs_type; xs_expr = e } -> Xhp_simple { xs_name = f id; xs_type; xs_expr = g e } | Xhp_spread e -> Xhp_spread (g e) let get_xhp_attr_expr = function | Xhp_simple { xs_expr = e; _ } | Xhp_spread e -> e let get_simple_xhp_attrs = List.filter_map ~f:(function | Xhp_simple { xs_name = id; xs_expr = e; _ } -> Some (id, e) | Xhp_spread _ -> None) (* Definitions appearing in a Nast.program *) type defs = { funs: (FileInfo.id * fun_def) list; classes: (FileInfo.id * class_) list; typedefs: (FileInfo.id * typedef) list; constants: (FileInfo.id * gconst) list; modules: (FileInfo.id * module_def) list; } (* Given a Nast.program, give me the list of entities it defines *) let get_defs (ast : program) : defs = (* fold_right traverses the file from top to bottom, and as such gives nicer * error messages than fold_left. E.g. in the case where a function is * declared twice in the same file, the error will say that the declaration * with the larger line number is a duplicate. *) let to_id (a, b) = (a, b, None) in (* TODO(hgoldstein): Just have this return four values, not five *) let rec get_defs ast acc = List.fold_right ast ~init:acc ~f:(fun def acc -> Aast.( match def with | Fun f -> let f = (FileInfo.pos_full (to_id f.fd_name), f) in { acc with funs = f :: acc.funs } | Class c -> let c = (FileInfo.pos_full (to_id c.c_name), c) in { acc with classes = c :: acc.classes } | Typedef t -> let t = (FileInfo.pos_full (to_id t.t_name), t) in { acc with typedefs = t :: acc.typedefs } | Constant cst -> let cst = (FileInfo.pos_full (to_id cst.cst_name), cst) in { acc with constants = cst :: acc.constants } | Module md -> let md = (FileInfo.pos_full (to_id md.md_name), md) in { acc with modules = md :: acc.modules } | Namespace (_, defs) -> get_defs defs acc | NamespaceUse _ | SetNamespaceEnv _ | SetModule _ -> acc (* toplevel statements are ignored *) | FileAttributes _ | Stmt _ -> acc)) in let acc = { funs = []; classes = []; typedefs = []; constants = []; modules = [] } in get_defs ast acc let get_def_names ast : FileInfo.t = let { funs; classes; typedefs; constants; modules } = get_defs ast in FileInfo. { empty_t with funs = List.map funs ~f:fst; classes = List.map classes ~f:fst; typedefs = List.map typedefs ~f:fst; consts = List.map constants ~f:fst; modules = List.map modules ~f:fst; } type ignore_attribute_env = { ignored_attributes: string list } (** Some utility functions **) let ast_deregister_attributes_mapper = object (self) inherit [_] Aast.endo as super method on_'ex _ (ex : unit) = ex method on_'en _ (en : unit) = en method ignored_attr env l = List.exists l ~f:(fun attr -> List.mem env.ignored_attributes (snd attr.ua_name) ~equal:String.equal) (* Filter all functions and classes with the user attributes banned *) method! on_program env toplevels = let toplevels = List.filter toplevels ~f:(fun toplevel -> match toplevel with | Fun f when self#ignored_attr env f.fd_fun.f_user_attributes -> false | Class c when self#ignored_attr env c.c_user_attributes -> false | _ -> true) in super#on_program env toplevels method! on_class_ env this = (* Filter out class elements which are methods with wrong attributes *) let methods = List.filter this.c_methods ~f:(fun m -> not @@ self#ignored_attr env m.m_user_attributes) in let cvars = List.filter this.c_vars ~f:(fun cv -> not @@ self#ignored_attr env cv.cv_user_attributes) in let this = { this with c_methods = methods; c_vars = cvars } in super#on_class_ env this end let deregister_ignored_attributes (ast : program) = let env = { (* For now, only ignore the __PHPStdLib *) ignored_attributes = [Naming_special_names.UserAttributes.uaPHPStdLib]; } in ast_deregister_attributes_mapper#on_program env ast let ast_no_pos_or_docblock_mapper = object inherit [_] Aast.endo as super method! on_pos _ _pos = Pos.none method on_'ex _ (ex : unit) = ex method on_'en _ (en : unit) = en method! on_fun_ env f = super#on_fun_ env { f with f_doc_comment = None } method! on_class_ env c = super#on_class_ env { c with c_doc_comment = None } method! on_class_var env cv = super#on_class_var env { cv with cv_doc_comment = None } method! on_method_ env m = super#on_method_ env { m with m_doc_comment = None } method! on_class_const env ccs = super#on_class_const env { ccs with cc_doc_comment = None } method! on_class_typeconst_def env tc = super#on_class_typeconst_def env { tc with c_tconst_doc_comment = None } (* Skip all blocks because we don't care about method bodies *) method! on_block _ _ = [] end (* Given an AST, return an AST with no position or docblock info *) let remove_pos_and_docblock ast = ast_no_pos_or_docblock_mapper#on_program () ast (* Given an AST, generate a unique hash for its decl tree. *) let generate_ast_decl_hash ast = (* Why we marshal it into a string first: regular Hashtbl.hash will collide improperly because it doesn't compare ADTs with strings correctly. Using Marshal, we guarantee that the two ASTs are represented by a single primitive type, which we hash. *) let str = Marshal.to_string (remove_pos_and_docblock ast) [] in OpaqueDigest.string str (*****************************************************************************) (** This module defines a visitor class on the Nast data structure. To use it you must inherit the generic object and redefine the appropriate methods. It has been deprecated because it contains holes and needs to be updated manually. Please use the autogenerated visitors instead (e.g., {!Nast.iter}, {!Nast.reduce}). @see <https://gitlab.inria.fr/fpottier/visitors> Visitor generation plugin @see <http://gallium.inria.fr/~fpottier/visitors/manual.pdf> Visitors docs To convert a visitor using this deprecated base class to the autogenerated visitors, you will likely want to use either {!Nast.iter} with a mutable result member or {!Nast.reduce}. For example, this visitor: let has_return_visitor = object inherit [bool] Nast.Visitor_DEPRECATED.visitor method! on_return _ _ _ = true end let has_return block = has_return_visitor#on_block false block Could be written this way: class has_return_visitor = object (_ : 'self) inherit [_] Nast.iter val mutable result = false method result = result method! on_Return () _ _ = result <- true end let has_return block = let visitor = new has_return_visitor in visitor#on_block () block; visitor#result But it would be even better to use a reduce visitor: let has_return_visitor = object (_ : 'self) inherit [_] Nast.reduce method zero = false method plus = (||) method! on_Return () _ _ = true end let has_return block = has_return_visitor#on_block () block *) (*****************************************************************************) module Visitor_DEPRECATED = struct (*****************************************************************************) (* The signature of the visitor. *) (*****************************************************************************) type id = lid class type ['a] visitor_type = object method on_block : 'a -> block -> 'a method on_declare_local : 'a -> lid -> hint -> expr option -> 'a method on_break : 'a -> 'a method on_case : 'a -> case -> 'a method on_default_case : 'a -> default_case -> 'a method on_catch : 'a -> catch -> 'a method on_continue : 'a -> 'a method on_darray : 'a -> (targ * targ) option -> field list -> 'a method on_varray : 'a -> targ option -> expr list -> 'a method on_do : 'a -> block -> expr -> 'a method on_expr : 'a -> expr -> 'a method on_expr_ : 'a -> expr_ -> 'a method on_for : 'a -> expr list -> expr option -> expr list -> block -> 'a method on_foreach : 'a -> expr -> (unit, unit) as_expr -> block -> 'a method on_if : 'a -> expr -> block -> block -> 'a method on_noop : 'a -> 'a method on_fallthrough : 'a -> 'a method on_return : 'a -> expr option -> 'a method on_awaitall : 'a -> (id option * expr) list -> block -> 'a method on_stmt : 'a -> stmt -> 'a method on_stmt_ : 'a -> (unit, unit) stmt_ -> 'a method on_switch : 'a -> expr -> case list -> default_case option -> 'a method on_stmt_match : 'a -> stmt_match -> 'a method on_stmt_match_arm : 'a -> stmt_match_arm -> 'a method on_pattern : 'a -> pattern -> 'a method on_pat_var : 'a -> pat_var -> 'a method on_pat_refinement : 'a -> pat_refinement -> 'a method on_throw : 'a -> expr -> 'a method on_try : 'a -> block -> catch list -> block -> 'a method on_while : 'a -> expr -> block -> 'a method on_using : 'a -> (unit, unit) using_stmt -> 'a method on_as_expr : 'a -> (unit, unit) as_expr -> 'a method on_shape : 'a -> (Ast_defs.shape_field_name * expr) list -> 'a method on_valCollection : 'a -> pos * vc_kind -> targ option -> expr list -> 'a method on_keyValCollection : 'a -> pos * kvc_kind -> (targ * targ) option -> field list -> 'a method on_collection : 'a -> unit collection_targ option -> afield list -> 'a method on_this : 'a -> 'a method on_id : 'a -> sid -> 'a method on_lvar : 'a -> id -> 'a method on_dollardollar : 'a -> id -> 'a method on_method_caller : 'a -> sid -> pstring -> 'a method on_obj_get : 'a -> expr -> expr -> 'a method on_array_get : 'a -> expr -> expr option -> 'a method on_class_get : 'a -> class_id -> (unit, unit) class_get_expr -> 'a method on_class_const : 'a -> class_id -> pstring -> 'a method on_call : 'a -> expr -> (Ast_defs.param_kind * expr) list -> expr option -> 'a method on_function_pointer : 'a -> (unit, unit) function_ptr_id -> targ list -> 'a method on_true : 'a -> 'a method on_false : 'a -> 'a method on_int : 'a -> string -> 'a method on_float : 'a -> string -> 'a method on_null : 'a -> 'a method on_string : 'a -> string -> 'a method on_string2 : 'a -> expr list -> 'a method on_yield_break : 'a -> 'a method on_yield : 'a -> afield -> 'a method on_await : 'a -> expr -> 'a method on_list : 'a -> expr list -> 'a method on_pair : 'a -> (targ * targ) option -> expr -> expr -> 'a method on_cast : 'a -> hint -> expr -> 'a method on_expression_tree : 'a -> expression_tree -> 'a method on_unop : 'a -> Ast_defs.uop -> expr -> 'a method on_binop : 'a -> Ast_defs.bop -> expr -> expr -> 'a method on_pipe : 'a -> id -> expr -> expr -> 'a method on_eif : 'a -> expr -> expr option -> expr -> 'a method on_is : 'a -> expr -> hint -> 'a method on_as : 'a -> expr -> hint -> bool -> 'a method on_upcast : 'a -> expr -> hint -> 'a method on_omitted : 'a -> 'a method on_class_id : 'a -> class_id -> 'a method on_class_id_ : 'a -> class_id_ -> 'a method on_new : 'a -> class_id -> expr list -> expr option -> 'a method on_record : 'a -> sid -> (expr * expr) list -> 'a method on_efun : 'a -> efun -> 'a method on_lfun : 'a -> fun_ -> capture_lid list -> 'a method on_xml : 'a -> sid -> xhp_attribute list -> expr list -> 'a method on_param_kind : 'a -> Ast_defs.param_kind -> 'a method on_clone : 'a -> expr -> 'a method on_field : 'a -> field -> 'a method on_afield : 'a -> afield -> 'a method on_class_typeconst_def : 'a -> (unit, unit) class_typeconst_def -> 'a method on_class_c_const : 'a -> class_const -> 'a method on_class_var : 'a -> class_var -> 'a method on_class_use : 'a -> hint -> 'a method on_class_req : 'a -> hint * require_kind -> 'a method on_func_body : 'a -> func_body -> 'a method on_method_ : 'a -> method_ -> 'a method on_fun_def : 'a -> fun_def -> 'a method on_fun_ : 'a -> fun_ -> 'a method on_class_ : 'a -> class_ -> 'a method on_gconst : 'a -> gconst -> 'a method on_typedef : 'a -> typedef -> 'a method on_hint : 'a -> hint -> 'a method on_type_hint : 'a -> type_hint -> 'a method on_targ : 'a -> targ -> 'a method on_def : 'a -> def -> 'a method on_program : 'a -> program -> 'a method on_markup : 'a -> pstring -> 'a method on_enum_class_label : 'a -> sid option -> string -> 'a method on_function_ptr_id : 'a -> (unit, unit) function_ptr_id -> 'a method on_et_splice : 'a -> expr -> 'a method on_readonly_expr : 'a -> expr -> 'a end (*****************************************************************************) (* The generic visitor ('a is the type of the accumulator). *) (*****************************************************************************) class virtual ['a] visitor : ['a] visitor_type = object (this) method on_break acc = acc method on_continue acc = acc method on_noop acc = acc method on_fallthrough acc = acc method on_markup acc _ = acc method on_throw acc e = let acc = this#on_expr acc e in acc method on_return acc eopt = match eopt with | None -> acc | Some e -> this#on_expr acc e method on_awaitall acc el b = let acc = List.fold_left ~f:(fun acc (x, y) -> let acc = match x with | Some x -> this#on_lvar acc x | None -> acc in let acc = this#on_expr acc y in acc) ~init:acc el in let acc = this#on_block acc b in acc method on_if acc e b1 b2 = let acc = this#on_expr acc e in let acc = this#on_block acc b1 in let acc = this#on_block acc b2 in acc method on_do acc b e = let acc = this#on_block acc b in let acc = this#on_expr acc e in acc method on_while acc e b = let acc = this#on_expr acc e in let acc = this#on_block acc b in acc method on_using acc us = let acc = List.fold_left (snd us.us_exprs) ~f:this#on_expr ~init:acc in let acc = this#on_block acc us.us_block in acc method on_for acc e1 e2 e3 b = let on_expr_list acc es = List.fold_left es ~f:this#on_expr ~init:acc in let acc = on_expr_list acc e1 in let acc = on_expr_list acc e3 in let acc = match e2 with | None -> acc | Some e -> this#on_expr acc e in let acc = this#on_block acc b in acc method on_switch acc e cl dfl = let acc = this#on_expr acc e in let acc = List.fold_left cl ~f:this#on_case ~init:acc in let acc = match dfl with | None -> acc | Some dfl -> this#on_default_case acc dfl in acc method on_stmt_match acc { sm_expr; sm_arms } = let acc = this#on_expr acc sm_expr in let acc = List.fold_left sm_arms ~f:this#on_stmt_match_arm ~init:acc in acc method on_stmt_match_arm acc { sma_pat; sma_body } = let acc = this#on_pattern acc sma_pat in let acc = this#on_block acc sma_body in acc method on_pattern acc = function | PVar pv -> this#on_pat_var acc pv | PRefinement pr -> this#on_pat_refinement acc pr method on_pat_var acc { pv_pos = _; pv_id = _ } = acc method on_pat_refinement acc { pr_pos = _; pr_id = _; pr_hint } = let acc = this#on_hint acc pr_hint in acc method on_foreach acc e ae b = let acc = this#on_expr acc e in let acc = this#on_as_expr acc ae in let acc = this#on_block acc b in acc method on_try acc b cl fb = let acc = this#on_block acc b in let acc = List.fold_left cl ~f:this#on_catch ~init:acc in let acc = this#on_block acc fb in acc method on_declare_local acc id t e = let acc = this#on_lvar acc id in let acc = this#on_hint acc t in match e with | None -> acc | Some e -> this#on_expr acc e method on_block acc b = List.fold_left b ~f:this#on_stmt ~init:acc method on_case acc (e, b) = let acc = this#on_expr acc e in let acc = this#on_block acc b in acc method on_default_case acc (_, dfl) = this#on_block acc dfl method on_as_expr acc = function | As_v e | Await_as_v (_, e) -> let acc = this#on_expr acc e in acc | As_kv (e1, e2) | Await_as_kv (_, e1, e2) -> let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_catch acc (_, _, b) = this#on_block acc b method on_stmt acc (_, stmt) = this#on_stmt_ acc stmt method on_stmt_ acc = function | Expr e -> this#on_expr acc e | Break -> this#on_break acc | Continue -> this#on_continue acc | Throw e -> this#on_throw acc e | Return eopt -> this#on_return acc eopt | Yield_break -> this#on_yield_break acc | If (e, b1, b2) -> this#on_if acc e b1 b2 | Do (b, e) -> this#on_do acc b e | While (e, b) -> this#on_while acc e b | Using us -> this#on_using acc us | For (e1, e2, e3, b) -> this#on_for acc e1 e2 e3 b | Switch (e, cl, dfl) -> this#on_switch acc e cl dfl | Match sm -> this#on_stmt_match acc sm | Foreach (e, ae, b) -> this#on_foreach acc e ae b | Try (b, cl, fb) -> this#on_try acc b cl fb | Noop -> this#on_noop acc | Fallthrough -> this#on_fallthrough acc | Awaitall (el, b) -> this#on_awaitall acc el b | Declare_local (id, t, e) -> this#on_declare_local acc id t e | Block b -> this#on_block acc b | Markup s -> this#on_markup acc s | AssertEnv _ -> this#on_noop acc method on_expr acc (_, _, e) = this#on_expr_ acc e method on_expr_ acc e = match e with | Darray (tap, fieldl) -> this#on_darray acc tap fieldl | Varray (ta, el) -> this#on_varray acc ta el | Shape sh -> this#on_shape acc sh | True -> this#on_true acc | False -> this#on_false acc | Int n -> this#on_int acc n | Float n -> this#on_float acc n | Null -> this#on_null acc | String s -> this#on_string acc s | This -> this#on_this acc | Id sid -> this#on_id acc sid | Lplaceholder _pos -> acc | Dollardollar id -> this#on_dollardollar acc id | Lvar id -> this#on_lvar acc id | Method_caller (sid, pstr) -> this#on_method_caller acc sid pstr | Yield e -> this#on_yield acc e | Await e -> this#on_await acc e | Tuple el -> this#on_list acc el | List el -> this#on_list acc el | Clone e -> this#on_clone acc e | Obj_get (e1, e2, _, _) -> this#on_obj_get acc e1 e2 | Array_get (e1, e2) -> this#on_array_get acc e1 e2 | Class_get (cid, e, _) -> this#on_class_get acc cid e | Class_const (cid, id) -> this#on_class_const acc cid id | Call { func = e; args = el; unpacked_arg; _ } -> this#on_call acc e el unpacked_arg | FunctionPointer (fpid, targs) -> this#on_function_pointer acc fpid targs | String2 el -> this#on_string2 acc el | PrefixedString (_, e) -> this#on_expr acc e | Pair (ta, e1, e2) -> this#on_pair acc ta e1 e2 | Cast (hint, e) -> this#on_cast acc hint e | ExpressionTree et -> this#on_expression_tree acc et | Unop (uop, e) -> this#on_unop acc uop e | Binop { bop; lhs; rhs } -> this#on_binop acc bop lhs rhs | Pipe (id, e1, e2) -> this#on_pipe acc id e1 e2 | Eif (e1, e2, e3) -> this#on_eif acc e1 e2 e3 | Is (e, h) -> this#on_is acc e h | As (e, h, b) -> this#on_as acc e h b | Upcast (e, h) -> this#on_upcast acc e h | New (cid, _, el, unpacked_element, _) -> this#on_new acc cid el unpacked_element | Efun ef -> this#on_efun acc ef | Xml (sid, attrl, el) -> this#on_xml acc sid attrl el | ValCollection (s, ta, el) -> this#on_valCollection acc s ta el | KeyValCollection (s, tap, fl) -> this#on_keyValCollection acc s tap fl | Omitted -> this#on_omitted acc | Lfun (f, idl) -> this#on_lfun acc f idl | Import (_, e) -> this#on_expr acc e | Collection (_, tal, fl) -> this#on_collection acc tal fl | ET_Splice e -> this#on_et_splice acc e | EnumClassLabel (opt_sid, name) -> this#on_enum_class_label acc opt_sid name | ReadonlyExpr e -> this#on_readonly_expr acc e | Hole (e, _, _, _) -> this#on_expr acc e | Package id -> this#on_id acc id | Invalid (Some e) -> this#on_expr acc e | Invalid _ -> acc method on_collection acc tal afl = let acc = match tal with | Some (CollectionTKV (tk, tv)) -> let acc = this#on_targ acc tk in let acc = this#on_targ acc tv in acc | Some (CollectionTV tv) -> this#on_targ acc tv | None -> acc in List.fold_left afl ~f:this#on_afield ~init:acc method on_shape acc sm = List.fold_left ~f: begin fun acc (_, e) -> let acc = this#on_expr acc e in acc end ~init:acc sm method on_darray acc tap fieldl = let acc = match tap with | Some (t1, t2) -> let acc = this#on_targ acc t1 in let acc = this#on_targ acc t2 in acc | None -> acc in List.fold_left fieldl ~f:this#on_field ~init:acc method on_varray acc ta el = let acc = match ta with | Some t -> this#on_targ acc t | None -> acc in List.fold_left el ~f:this#on_expr ~init:acc method on_valCollection acc _ ta el = let acc = match ta with | Some t -> this#on_targ acc t | None -> acc in List.fold_left el ~f:this#on_expr ~init:acc method on_keyValCollection acc _ tap fieldl = let acc = match tap with | Some (t1, t2) -> let acc = this#on_targ acc t1 in let acc = this#on_targ acc t2 in acc | None -> acc in List.fold_left fieldl ~f:this#on_field ~init:acc method on_this acc = acc method on_id acc _ = acc method on_lvar acc _ = acc method on_dollardollar acc id = this#on_lvar acc id method on_method_caller acc _ _ = acc method on_obj_get acc e1 e2 = let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_array_get acc e e_opt = let acc = this#on_expr acc e in let acc = match e_opt with | None -> acc | Some e -> this#on_expr acc e in acc method on_class_get acc cid e = let acc = this#on_class_id acc cid in match e with | CGstring _ -> acc | CGexpr e -> this#on_expr acc e method on_class_const acc cid _ = this#on_class_id acc cid method on_call acc e el unpacked_element = let acc = this#on_expr acc e in let f acc_ (pk, e_) = let acc_ = this#on_param_kind acc_ pk in this#on_expr acc_ e_ in let acc = List.fold_left el ~f ~init:acc in let acc = Option.value_map unpacked_element ~f:(this#on_expr acc) ~default:acc in acc method on_function_pointer acc e targs = let acc = this#on_function_ptr_id acc e in let acc = List.fold_left targs ~f:this#on_targ ~init:acc in acc method on_true acc = acc method on_false acc = acc method on_int acc _ = acc method on_float acc _ = acc method on_null acc = acc method on_string acc _ = acc method on_string2 acc el = let acc = List.fold_left el ~f:this#on_expr ~init:acc in acc method on_yield_break acc = acc method on_yield acc e = this#on_afield acc e method on_await acc e = this#on_expr acc e method on_list acc el = List.fold_left el ~f:this#on_expr ~init:acc method on_pair acc tap e1 e2 = let acc = match tap with | Some (t1, t2) -> let acc = this#on_targ acc t1 in let acc = this#on_targ acc t2 in acc | None -> acc in let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_cast acc _ e = this#on_expr acc e method on_expression_tree acc (et : expression_tree) = let acc = this#on_hint acc et.et_hint in let acc = this#on_block acc et.et_splices in let acc = this#on_expr acc et.et_virtualized_expr in let acc = this#on_expr acc et.et_runtime_expr in acc method on_unop acc _ e = this#on_expr acc e method on_binop acc _ e1 e2 = let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_pipe acc _id e1 e2 = let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_eif acc e1 e2 e3 = let acc = this#on_expr acc e1 in let acc = match e2 with | None -> acc | Some e -> this#on_expr acc e in let acc = this#on_expr acc e3 in acc method on_is acc e _ = this#on_expr acc e method on_as acc e _ _ = this#on_expr acc e method on_upcast acc e _ = this#on_expr acc e method on_omitted acc = acc method on_class_id acc (_, _, cid) = this#on_class_id_ acc cid method on_class_id_ acc = function | CIexpr e -> this#on_expr acc e | _ -> acc method on_new acc cid el unpacked_element = let acc = this#on_class_id acc cid in let acc = List.fold_left el ~f:this#on_expr ~init:acc in let acc = Option.value_map unpacked_element ~default:acc ~f:(this#on_expr acc) in acc method on_efun acc ef = this#on_block acc ef.ef_fun.f_body.fb_ast method on_lfun acc f _ = this#on_block acc f.f_body.fb_ast method on_record acc _ fl = List.fold_left fl ~f:this#on_field ~init:acc method on_xml acc _ attrl el = let acc = List.fold_left attrl ~init:acc ~f:(fun acc attr -> match attr with | Xhp_simple { xs_expr = e; _ } | Xhp_spread e -> this#on_expr acc e) in let acc = List.fold_left el ~f:this#on_expr ~init:acc in acc method on_param_kind acc _ = acc method on_clone acc e = this#on_expr acc e method on_field acc (e1, e2) = let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_afield acc = function | AFvalue e -> this#on_expr acc e | AFkvalue (e1, e2) -> let acc = this#on_expr acc e1 in let acc = this#on_expr acc e2 in acc method on_hint acc _ = acc method on_type_hint acc _ = acc method on_targ acc _ = acc method on_fun_ acc f = let acc = this#on_func_body acc f.f_body in let acc = match hint_of_type_hint f.f_ret with | Some h -> this#on_hint acc h | None -> acc in acc method on_func_body acc fb = this#on_block acc fb.fb_ast method on_method_ acc m = let acc = this#on_id acc m.m_name in let acc = this#on_func_body acc m.m_body in acc method on_class_ acc c = let acc = this#on_id acc c.c_name in let acc = List.fold_left c.c_extends ~f:this#on_hint ~init:acc in let acc = List.fold_left c.c_uses ~f:this#on_hint ~init:acc in let acc = List.fold_left c.c_implements ~f:this#on_hint ~init:acc in let acc = List.fold_left c.c_typeconsts ~f:this#on_class_typeconst_def ~init:acc in let acc = List.fold_left c.c_consts ~f:this#on_class_c_const ~init:acc in let acc = List.fold_left c.c_vars ~f:this#on_class_var ~init:acc in let acc = List.fold_left c.c_uses ~f:this#on_class_use ~init:acc in let acc = List.fold_left c.c_reqs ~f:this#on_class_req ~init:acc in let acc = List.fold_left c.c_methods ~f:this#on_method_ ~init:acc in acc method on_fun_def acc f = let acc = this#on_id acc f.fd_name in this#on_fun_ acc f.fd_fun method on_class_typeconst_def acc t = let acc = this#on_id acc t.c_tconst_name in match t.c_tconst_kind with | TCAbstract { c_atc_as_constraint; c_atc_super_constraint; c_atc_default } -> let acc = match c_atc_as_constraint with | Some cstr -> this#on_hint acc cstr | None -> acc in let acc = match c_atc_super_constraint with | Some cstr -> this#on_hint acc cstr | None -> acc in (match c_atc_default with | Some d -> this#on_hint acc d | None -> acc) | TCConcrete { c_tc_type } -> this#on_hint acc c_tc_type method on_class_c_const acc c_const = let acc = match c_const.cc_type with | Some h -> this#on_hint acc h | None -> acc in let acc = this#on_id acc c_const.cc_id in let acc = match c_const.cc_kind with | CCConcrete e -> this#on_expr acc e | CCAbstract (Some default) -> this#on_expr acc default | CCAbstract None -> acc in acc method on_readonly_expr acc e = let acc = this#on_expr acc e in acc method on_class_var acc c_var = let acc = this#on_id acc c_var.cv_id in let acc = match hint_of_type_hint c_var.cv_type with | Some h -> this#on_hint acc h | None -> acc in let acc = match c_var.cv_expr with | Some e -> this#on_expr acc e | None -> acc in acc method on_class_use acc h = this#on_hint acc h method on_class_req acc (h, _) = this#on_hint acc h method on_gconst acc g = let acc = this#on_id acc g.cst_name in let acc = this#on_expr acc g.cst_value in let acc = match g.cst_type with | Some h -> this#on_hint acc h | None -> acc in acc method on_enum_class_label acc opt_sid name = let acc = match opt_sid with | Some sid -> this#on_id acc sid | None -> acc in this#on_string acc name method on_function_ptr_id acc fpi = match fpi with | FP_id sid -> this#on_id acc sid | FP_class_const (cid, _) -> this#on_class_id acc cid method on_et_splice acc e = this#on_expr acc e method on_typedef acc t = let acc = this#on_id acc t.t_name in let acc = this#on_hint acc t.t_kind in let acc = match t.t_as_constraint with | Some c -> this#on_hint acc c | None -> acc in let acc = match t.t_super_constraint with | Some c -> this#on_hint acc c | None -> acc in acc method on_def acc = function | Fun f -> this#on_fun_def acc f | Class c -> this#on_class_ acc c | Stmt s -> this#on_stmt acc s | Typedef t -> this#on_typedef acc t | Constant g -> this#on_gconst acc g | Namespace (_, p) -> this#on_program acc p | NamespaceUse _ | SetNamespaceEnv _ | FileAttributes _ | SetModule _ | Module _ -> acc method on_program acc p = let acc = List.fold_left p ~init:acc ~f:this#on_def in acc end end
OCaml
hhvm/hphp/hack/src/naming/nast_eval.ml
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude open Aast (* this should never be exposed / thrown outside of this module; translate * it into a result type first *) exception Not_static_exn of Pos.t let rec static_string_exn = function | (_, _, Binop { bop = Ast_defs.Dot; lhs; rhs }) -> let s1 = static_string_exn lhs in let s2 = static_string_exn rhs in s1 ^ s2 | (_, _, String s) -> s | (_, p, _) -> raise (Not_static_exn p) let static_string (expr : Nast.expr) = try Ok (static_string_exn expr) with | Not_static_exn p -> Error p
OCaml Interface
hhvm/hphp/hack/src/naming/nast_eval.mli
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude val static_string : Nast.expr -> (string, Pos.t) result
TOML
hhvm/hphp/hack/src/naming/cargo/elaborate_namespaces/Cargo.toml
# @generated by autocargo [package] name = "elaborate_namespaces_visitor" version = "0.0.0" edition = "2021" [lib] path = "../../elaborate_namespaces_visitor.rs" [dependencies] core_utils_rust = { version = "0.0.0", path = "../../../utils/core" } hash = { version = "0.0.0", path = "../../../utils/hash" } lazy_static = "1.4" namespaces_rust = { version = "0.0.0", path = "../../../parser/cargo/namespaces" } naming_special_names_rust = { version = "0.0.0", path = "../.." } oxidized = { version = "0.0.0", path = "../../../oxidized" }
TOML
hhvm/hphp/hack/src/naming/cargo/elab_ffi/Cargo.toml
# @generated by autocargo [package] name = "elab_ffi" version = "0.0.0" edition = "2021" [lib] path = "../../elab_ffi.rs" test = false doctest = false crate-type = ["lib", "staticlib"] [dependencies] elab = { version = "0.0.0", path = "../../../elab" } ocamlrep_ocamlpool = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" } oxidized = { version = "0.0.0", path = "../../../oxidized" } relative_path = { version = "0.0.0", path = "../../../utils/rust/relative_path" }
TOML
hhvm/hphp/hack/src/naming/cargo/naming_attributes/Cargo.toml
# @generated by autocargo [package] name = "naming_attributes_rust" version = "0.0.0" edition = "2021" [lib] path = "../../naming_attributes.rs" [dependencies] oxidized = { version = "0.0.0", path = "../../../oxidized" }
TOML
hhvm/hphp/hack/src/naming/names_rust/Cargo.toml
# @generated by autocargo [package] name = "names" version = "0.0.0" edition = "2021" [lib] path = "names.rs" [dependencies] anyhow = "1.0.71" crossbeam = "0.8" hh24_types = { version = "0.0.0", path = "../../utils/hh24_types" } oxidized = { version = "0.0.0", path = "../../oxidized" } oxidized_by_ref = { version = "0.0.0", path = "../../oxidized_by_ref" } rand = { version = "0.8", features = ["small_rng"] } relative_path = { version = "0.0.0", path = "../../utils/rust/relative_path" } rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype", "limits"] } serde = { version = "1.0.176", features = ["derive", "rc"] } typing_deps_hash = { version = "0.0.0", path = "../../deps/cargo/typing_deps_hash" }
Rust
hhvm/hphp/hack/src/naming/names_rust/datatypes.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::collections::BTreeMap; use std::collections::BTreeSet; use std::path::PathBuf; use oxidized::file_info::Mode; use oxidized::file_info::NameType; use relative_path::Prefix; use relative_path::RelativePath; use rusqlite::types::FromSql; use rusqlite::types::FromSqlError; use rusqlite::types::FromSqlResult; use rusqlite::types::ValueRef; #[derive(Debug, Default)] pub struct SaveResult { pub files_added: usize, pub symbols_added: usize, pub collisions: BTreeMap<(NameType, String), BTreeSet<RelativePath>>, pub checksum: hh24_types::Checksum, } impl SaveResult { pub fn add_collision( &mut self, kind: NameType, name: String, path1: &RelativePath, path2: &RelativePath, ) { let paths = self.collisions.entry((kind, name)).or_default(); paths.insert(path1.clone()); paths.insert(path2.clone()); } } pub(crate) struct SqlitePrefix { pub value: Prefix, } pub(crate) struct SqlitePathBuf { pub value: PathBuf, } impl FromSql for SqlitePrefix { fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { match value { ValueRef::Integer(i) => match Prefix::try_from(i as usize) { Ok(value) => Ok(SqlitePrefix { value }), Err(_) => Err(FromSqlError::OutOfRange(i)), }, _ => Err(FromSqlError::InvalidType), } } } impl FromSql for SqlitePathBuf { fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { match value.as_str() { Ok(s) => Ok(SqlitePathBuf { value: PathBuf::from(s), }), _ => Err(FromSqlError::InvalidType), } } } /// This uses NonZeroU64 instead of i64 (used elsewhere in sqlite) just as a bit-packing optimization #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] pub struct FileInfoId(std::num::NonZeroU64); impl FileInfoId { pub fn last_insert_rowid(conn: &rusqlite::Connection) -> Self { Self::from_i64(conn.last_insert_rowid()) } fn from_i64(i: i64) -> Self { Self(std::num::NonZeroU64::new(i as u64).expect("SQLite autoincrement indices start at 1")) } } impl rusqlite::ToSql for FileInfoId { fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> { Ok(rusqlite::types::ToSqlOutput::from(self.0.get() as i64)) } } impl FromSql for FileInfoId { fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { Ok(Self::from_i64(value.as_i64()?)) } } pub(crate) mod convert { use super::*; #[allow(unused)] pub fn mode_to_i64(mode: Option<Mode>) -> Option<i64> { mode.map(|mode| match mode { Mode::Mhhi => 0, Mode::Mstrict => 1, }) } #[allow(unused)] pub fn prefix_to_i64(prefix: Prefix) -> i64 { match prefix { Prefix::Root => 0, Prefix::Hhi => 1, Prefix::Dummy => 2, Prefix::Tmp => 3, } } #[allow(unused)] pub fn name_to_hash(dep_type: typing_deps_hash::DepType, name: &str) -> i64 { // It happens that hash1 only ever returns 64bit numbers with the high bit 0 // (for convenience of interop with ocaml). Therefore, u64/i64 will both // interpret the same bit pattern as the same positive integer. When we store // in sqlite, it will also be stored as a positive integer. typing_deps_hash::hash1(dep_type, name.as_bytes()) as i64 } }
Rust
hhvm/hphp/hack/src/naming/names_rust/names.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod datatypes; mod naming_sqlite; mod summary; pub use datatypes::FileInfoId; pub use datatypes::SaveResult; pub use naming_sqlite::Names; pub use summary::DeclSummary; pub use summary::FileSummary; pub use summary::SymbolRow;
Rust
hhvm/hphp/hack/src/naming/names_rust/naming_sqlite.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::path::Path; use anyhow::Context; use hh24_types::Checksum; use hh24_types::DeclHash; use hh24_types::ToplevelCanonSymbolHash; use hh24_types::ToplevelSymbolHash; use oxidized::file_info::NameType; use relative_path::RelativePath; use rusqlite::params; use rusqlite::Connection; use rusqlite::OptionalExtension; pub struct Names { conn: rusqlite::Connection, } impl Names { pub fn from_file(path: impl AsRef<Path>) -> anyhow::Result<Self> { let path = path.as_ref(); let mut conn = Connection::open(path)?; Self::create_tables(&mut conn)?; Self::create_indices(&mut conn)?; Ok(Self { conn }) } pub fn from_file_readonly(path: impl AsRef<Path>) -> anyhow::Result<Self> { use rusqlite::OpenFlags; let path = path.as_ref(); let conn = Connection::open_with_flags( path, OpenFlags::SQLITE_OPEN_READ_ONLY | OpenFlags::SQLITE_OPEN_NO_MUTEX, )?; let this = Self { conn }; this.pragma_fast_but_not_durable()?; Ok(this) } pub fn new_in_memory() -> anyhow::Result<Self> { let mut conn = Connection::open_in_memory()?; Self::create_tables(&mut conn)?; Self::create_indices(&mut conn)?; Ok(Self { conn }) } pub fn from_connection(mut conn: Connection) -> anyhow::Result<Self> { Self::create_tables(&mut conn)?; Self::create_indices(&mut conn)?; Ok(Self { conn }) } pub fn backup(&self, path: &Path) -> anyhow::Result<()> { self.conn.backup(rusqlite::DatabaseName::Main, path, None)?; Ok(()) } /// These pragmas make things faster at the expense of write safety... /// * journal_mode=OFF -- no rollback possible: the ROLLBACK TRANSACTION command won't work /// * synchronous=OFF -- sqlite will return immediately after handing off writes to the OS, so data will be lost upon power-loss /// * temp_store=MEMORY -- temporary tables and indices kept in memory pub fn pragma_fast_but_not_durable(&self) -> anyhow::Result<()> { self.conn.execute_batch( "PRAGMA journal_mode = OFF; PRAGMA synchronous = OFF; PRAGMA temp_store = MEMORY;", )?; Ok(()) } /// This does a sql "BEGIN EXCLUSIVE TRANSACTION". /// (an 'exclusive' transaction is one that acquires a write lock immediately rather than lazily). /// Then, once you call transaction.end() or drop it, "END TRANSACTION". /// The main reason to use transactions is for speed. /// (Note: if you opened naming-sqlite with "from_file_non_durable" then it /// doesn't support ROLLBACK TRANSACTION). pub fn transaction(&self) -> anyhow::Result<Transaction<'_>> { Transaction::new(&self.conn) } fn create_tables(conn: &mut Connection) -> anyhow::Result<()> { conn.execute( " CREATE TABLE IF NOT EXISTS NAMING_SYMBOLS ( HASH INTEGER PRIMARY KEY NOT NULL, CANON_HASH INTEGER NOT NULL, DECL_HASH INTEGER NOT NULL, FLAGS INTEGER NOT NULL, FILE_INFO_ID INTEGER NOT NULL );", params![], )?; conn.execute( " CREATE TABLE IF NOT EXISTS NAMING_SYMBOLS_OVERFLOW ( HASH INTEGER KEY NOT NULL, CANON_HASH INTEGER NOT NULL, DECL_HASH INTEGER NOT NULL, FLAGS INTEGER NOT NULL, FILE_INFO_ID INTEGER NOT NULL );", params![], )?; conn.execute( " CREATE TABLE IF NOT EXISTS NAMING_FILE_INFO ( FILE_INFO_ID INTEGER PRIMARY KEY AUTOINCREMENT, FILE_DIGEST TEXT, PATH_PREFIX_TYPE INTEGER NOT NULL, PATH_SUFFIX TEXT NOT NULL, TYPE_CHECKER_MODE INTEGER, DECL_HASH INTEGER, CLASSES TEXT, CONSTS TEXT, FUNS TEXT, TYPEDEFS TEXT, MODULES TEXT );", params![], )?; conn.execute( " CREATE TABLE IF NOT EXISTS CHECKSUM ( ID INTEGER PRIMARY KEY, CHECKSUM_VALUE INTEGER NOT NULL ); ", params![], )?; conn.execute( "INSERT OR IGNORE INTO CHECKSUM (ID, CHECKSUM_VALUE) VALUES (0, 0);", params![], )?; // This table contains a single dummy value and is here only to satisfy // hh_server and hh_single_type_check. conn.execute( " CREATE TABLE IF NOT EXISTS NAMING_LOCAL_CHANGES( ID INTEGER PRIMARY KEY, LOCAL_CHANGES BLOB NOT NULL, BASE_CONTENT_VERSION TEXT );", params![], )?; // The blob here is Relative_path.Map.empty as an OCaml-marshaled blob. // The base_content_version (computed from the unix timestamp and a // random ID) needs only be unique. conn.execute( " INSERT OR IGNORE INTO NAMING_LOCAL_CHANGES VALUES(0,X'8495a6be0000000100000000000000000000000040',?);", params![format!( "{}-{}", std::time::SystemTime::now() .duration_since(std::time::SystemTime::UNIX_EPOCH) .expect("SystemTime::now() before UNIX_EPOCH") .as_secs(), { use rand::distributions::DistString; rand::distributions::Alphanumeric.sample_string(&mut rand::thread_rng(), 10) }, )], )?; Ok(()) } pub fn create_indices(conn: &mut Connection) -> anyhow::Result<()> { conn.execute( "CREATE UNIQUE INDEX IF NOT EXISTS FILE_INFO_PATH_IDX ON NAMING_FILE_INFO (PATH_SUFFIX, PATH_PREFIX_TYPE);", params![], )?; conn.execute( "CREATE INDEX IF NOT EXISTS TYPES_CANON ON NAMING_SYMBOLS (CANON_HASH);", params![], )?; Ok(()) } pub fn get_checksum(&self) -> anyhow::Result<Checksum> { Ok(self .conn .prepare_cached("SELECT CHECKSUM_VALUE FROM CHECKSUM")? .query_row(params![], |row| row.get(0))?) } pub fn set_checksum(&self, checksum: Checksum) -> anyhow::Result<()> { self.conn .prepare_cached("REPLACE INTO CHECKSUM (ID, CHECKSUM_VALUE) VALUES (0, ?);")? .execute(params![checksum])?; Ok(()) } // helper for `save_file_summary`/`build` pub fn insert_file_summary( &self, path: &RelativePath, summary: &crate::FileSummary, save_result: &mut crate::SaveResult, ) -> anyhow::Result<()> { let file_info_id = self.insert_file_info_and_get_file_id(path, summary)?; save_result.files_added += 1; self.insert_symbols(path, file_info_id, summary.funs(), save_result)?; self.insert_symbols(path, file_info_id, summary.consts(), save_result)?; self.insert_symbols(path, file_info_id, summary.classes(), save_result)?; self.insert_symbols(path, file_info_id, summary.typedefs(), save_result)?; self.insert_symbols(path, file_info_id, summary.modules(), save_result)?; Ok(()) } // private helper for insert_file_summary fn insert_symbols<'a>( &self, path: &RelativePath, file_id: crate::FileInfoId, items: impl Iterator<Item = &'a crate::DeclSummary>, save_result: &mut crate::SaveResult, ) -> anyhow::Result<()> { for item in items { self.try_insert_symbol(path, file_id, item.clone(), save_result) .with_context(|| { format!( "Failed to insert {:?} {} (defined in {path})", item.name_type, item.symbol ) })? } Ok(()) } // private helper for insert_symbols fn try_insert_symbol( &self, path: &RelativePath, file_info_id: crate::FileInfoId, item: crate::DeclSummary, save_result: &mut crate::SaveResult, ) -> anyhow::Result<()> { let mut insert_statement = self.conn.prepare_cached( "INSERT INTO NAMING_SYMBOLS (HASH, CANON_HASH, DECL_HASH, FLAGS, FILE_INFO_ID) VALUES (?, ?, ?, ?, ?);", )?; let mut insert_overflow_statement = self.conn.prepare_cached( "INSERT INTO NAMING_SYMBOLS_OVERFLOW (HASH, CANON_HASH, DECL_HASH, FLAGS, FILE_INFO_ID) VALUES (?, ?, ?, ?, ?);", )?; let mut delete_statement = self.conn.prepare_cached( "DELETE FROM NAMING_SYMBOLS WHERE HASH = ? AND FILE_INFO_ID = ?", )?; let symbol_hash = ToplevelSymbolHash::new(item.name_type, &item.symbol); let canon_hash = ToplevelCanonSymbolHash::new(item.name_type, item.symbol.clone()); let decl_hash = item.hash; let kind = item.name_type; if let Some(old) = self.get_row(symbol_hash)? { assert_eq!(symbol_hash, old.hash); assert_eq!(canon_hash, old.canon_hash); // check if new entry appears first alphabetically if path < &old.path { // delete old row from naming_symbols table delete_statement.execute(params![symbol_hash, old.file_info_id])?; // insert old row into overflow table insert_overflow_statement.execute(params![ symbol_hash, canon_hash, old.decl_hash, old.kind, old.file_info_id ])?; // insert new row into naming_symbols table insert_statement.execute(params![ symbol_hash, canon_hash, decl_hash, kind, file_info_id ])?; save_result .checksum .addremove(symbol_hash, old.decl_hash, &old.path); // remove old save_result.checksum.addremove(symbol_hash, decl_hash, path); // add new save_result.add_collision(kind, item.symbol, &old.path, path); } else { // insert new row into overflow table insert_overflow_statement.execute(params![ symbol_hash, canon_hash, decl_hash, kind, file_info_id ])?; save_result.add_collision(kind, item.symbol, &old.path, path); } } else { // No collision. Insert as you normally would insert_statement.execute(params![ symbol_hash, canon_hash, decl_hash, kind, file_info_id ])?; save_result.checksum.addremove(symbol_hash, decl_hash, path); save_result.symbols_added += 1; } Ok(()) } /// Gets all overflow rows in the reverse naming table for a given symbol hash, /// and joins with the forward naming table to resolve filenames. pub fn get_overflow_rows_unordered( &self, symbol_hash: ToplevelSymbolHash, ) -> anyhow::Result<Vec<crate::SymbolRow>> { let select_statement = " SELECT NAMING_SYMBOLS_OVERFLOW.HASH, NAMING_SYMBOLS_OVERFLOW.CANON_HASH, NAMING_SYMBOLS_OVERFLOW.DECL_HASH, NAMING_SYMBOLS_OVERFLOW.FLAGS, NAMING_SYMBOLS_OVERFLOW.FILE_INFO_ID, NAMING_FILE_INFO.PATH_PREFIX_TYPE, NAMING_FILE_INFO.PATH_SUFFIX FROM NAMING_SYMBOLS_OVERFLOW LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS_OVERFLOW.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS_OVERFLOW.HASH = ? "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let mut rows = select_statement.query(params![symbol_hash])?; let mut result = vec![]; while let Some(row) = rows.next()? { let prefix: crate::datatypes::SqlitePrefix = row.get(5)?; let suffix: crate::datatypes::SqlitePathBuf = row.get(6)?; let path = RelativePath::make(prefix.value, suffix.value); result.push(crate::SymbolRow { hash: row.get(0)?, canon_hash: row.get(1)?, decl_hash: row.get(2)?, kind: row.get(3)?, file_info_id: row.get(4)?, path, }); } Ok(result) } /// Gets the winning entry for a symbol from the reverse naming table, /// and joins with forward-naming-table to get filename. pub fn get_row( &self, symbol_hash: ToplevelSymbolHash, ) -> anyhow::Result<Option<crate::SymbolRow>> { let select_statement = " SELECT NAMING_SYMBOLS.HASH, NAMING_SYMBOLS.CANON_HASH, NAMING_SYMBOLS.DECL_HASH, NAMING_SYMBOLS.FLAGS, NAMING_SYMBOLS.FILE_INFO_ID, NAMING_FILE_INFO.PATH_PREFIX_TYPE, NAMING_FILE_INFO.PATH_SUFFIX FROM NAMING_SYMBOLS LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS.HASH = ? "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let result = select_statement .query_row(params![symbol_hash], |row| { let prefix: crate::datatypes::SqlitePrefix = row.get(5)?; let suffix: crate::datatypes::SqlitePathBuf = row.get(6)?; let path = RelativePath::make(prefix.value, suffix.value); Ok(crate::SymbolRow { hash: row.get(0)?, canon_hash: row.get(1)?, decl_hash: row.get(2)?, kind: row.get(3)?, file_info_id: row.get(4)?, path, }) }) .optional(); Ok(result?) } /// This looks up the reverse naming table by hash, to fetch the decl-hash pub fn get_decl_hash( &self, symbol_hash: ToplevelSymbolHash, ) -> anyhow::Result<Option<DeclHash>> { let result = self .conn .prepare_cached("SELECT DECL_HASH FROM NAMING_SYMBOLS WHERE HASH = ?")? .query_row(params![symbol_hash], |row| row.get(0)) .optional(); Ok(result?) } /// Looks up reverse-naming-table winner by symbol hash. /// Similar to get_path_by_symbol_hash, but includes the name kind. pub fn get_filename( &self, symbol_hash: ToplevelSymbolHash, ) -> anyhow::Result<Option<(RelativePath, NameType)>> { let select_statement = " SELECT NAMING_FILE_INFO.PATH_PREFIX_TYPE, NAMING_FILE_INFO.PATH_SUFFIX, NAMING_SYMBOLS.FLAGS FROM NAMING_SYMBOLS LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS.HASH = ? LIMIT 1 "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let result = select_statement .query_row(params![symbol_hash], |row| { let prefix: crate::datatypes::SqlitePrefix = row.get(0)?; let suffix: crate::datatypes::SqlitePathBuf = row.get(1)?; let kind: NameType = row.get(2)?; Ok((RelativePath::make(prefix.value, suffix.value), kind)) }) .optional(); Ok(result?) } /// Looks up reverse-naming-table winner by symbol hash. /// Similar to get_filename, but discards the name kind pub fn get_path_by_symbol_hash( &self, symbol_hash: ToplevelSymbolHash, ) -> anyhow::Result<Option<RelativePath>> { match self.get_filename(symbol_hash)? { Some((path, _kind)) => Ok(Some(path)), None => Ok(None), } } /// Looks up reverse-naming-table winner by case-insensitive symbol hash. pub fn get_path_case_insensitive( &self, symbol_hash: ToplevelCanonSymbolHash, ) -> anyhow::Result<Option<RelativePath>> { let select_statement = " SELECT NAMING_FILE_INFO.PATH_PREFIX_TYPE, NAMING_FILE_INFO.PATH_SUFFIX FROM NAMING_SYMBOLS LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS.CANON_HASH = ? "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let result = select_statement .query_row(params![symbol_hash], |row| { let prefix: crate::datatypes::SqlitePrefix = row.get(0)?; let suffix: crate::datatypes::SqlitePathBuf = row.get(1)?; Ok(RelativePath::make(prefix.value, suffix.value)) }) .optional(); Ok(result?) } /// This function shouldn't really exist. /// It searches the reverse-naming-table by case-insensitive hash. /// Then looks up the forward-naming-table entry for that winner. /// Then it iterates the string type names stored in that forward-naming-table entry, /// comparing them one by one until it finds one whose case-insensitive hash /// matches what was asked for. pub fn get_type_name_case_insensitive( &self, symbol_hash: ToplevelCanonSymbolHash, ) -> anyhow::Result<Option<String>> { let select_statement = " SELECT NAMING_FILE_INFO.CLASSES, NAMING_FILE_INFO.TYPEDEFS FROM NAMING_SYMBOLS LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS.CANON_HASH = ? LIMIT 1 "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let names_opt = select_statement .query_row(params![symbol_hash], |row| { let classes: Option<String> = row.get(0)?; let typedefs: Option<String> = row.get(1)?; Ok((classes, typedefs)) }) .optional()?; if let Some((classes, typedefs)) = names_opt { for class in classes.as_deref().unwrap_or_default().split_terminator('|') { if symbol_hash == ToplevelCanonSymbolHash::from_type(class.to_owned()) { return Ok(Some(class.to_owned())); } } for typedef in typedefs .as_deref() .unwrap_or_default() .split_terminator('|') { if symbol_hash == ToplevelCanonSymbolHash::from_type(typedef.to_owned()) { return Ok(Some(typedef.to_owned())); } } } Ok(None) } /// This function shouldn't really exist. /// It searches the reverse-naming-table by case-insensitive hash. /// Then looks up the forward-naming-table entry for that winner. /// Then it iterates the string fun names stored in that forward-naming-table entry, /// comparing them one by one until it finds one whose case-insensitive hash /// matches what was asked for. pub fn get_fun_name_case_insensitive( &self, symbol_hash: ToplevelCanonSymbolHash, ) -> anyhow::Result<Option<String>> { let select_statement = " SELECT NAMING_FILE_INFO.FUNS FROM NAMING_SYMBOLS LEFT JOIN NAMING_FILE_INFO ON NAMING_SYMBOLS.FILE_INFO_ID = NAMING_FILE_INFO.FILE_INFO_ID WHERE NAMING_SYMBOLS.CANON_HASH = ? LIMIT 1 "; let mut select_statement = self.conn.prepare_cached(select_statement)?; let names_opt = select_statement .query_row(params![symbol_hash], |row| { let funs: Option<String> = row.get(0)?; Ok(funs) }) .optional()?; if let Some(funs) = names_opt { for fun in funs.as_deref().unwrap_or_default().split_terminator('|') { if symbol_hash == ToplevelCanonSymbolHash::from_fun(fun.to_owned()) { return Ok(Some(fun.to_owned())); } } } Ok(None) } /// This function will return an empty list if the path doesn't exist in the forward naming table pub fn get_symbol_hashes_for_winners_and_losers( &self, path: &RelativePath, ) -> anyhow::Result<Vec<(ToplevelSymbolHash, crate::FileInfoId)>> { // The NAMING_FILE_INFO table stores e.g. "Classname1|Classname2|Classname3". This // helper turns it into a vec of (ToplevelSymbolHash,file_info_id) pairs fn split( s: Option<String>, f: impl Fn(&str) -> ToplevelSymbolHash, file_info_id: crate::FileInfoId, ) -> Vec<(ToplevelSymbolHash, crate::FileInfoId)> { match s { None => vec![], Some(s) => s .split_terminator('|') .map(|name| (f(name), file_info_id)) .collect(), } // s.split_terminator yields an empty list for an empty string; // s.split would have yielded a singleton list, which we don't want. } let mut results = vec![]; self.conn .prepare_cached( "SELECT CLASSES, CONSTS, FUNS, TYPEDEFS, MODULES, FILE_INFO_ID FROM NAMING_FILE_INFO WHERE PATH_PREFIX_TYPE = ? AND PATH_SUFFIX = ?", )? .query_row(params![path.prefix() as u8, path.path_str()], |row| { let file_info_id: crate::FileInfoId = row.get(5)?; results.extend(split(row.get(0)?, ToplevelSymbolHash::from_type, file_info_id)); results.extend(split(row.get(1)?, ToplevelSymbolHash::from_const, file_info_id)); results.extend(split(row.get(2)?, ToplevelSymbolHash::from_fun, file_info_id)); results.extend(split(row.get(3)?, ToplevelSymbolHash::from_type, file_info_id)); results.extend(split(row.get(4)?, ToplevelSymbolHash::from_module, file_info_id)); Ok(()) }) .optional()?; Ok(results) } /// This inserts an item into the forward naming table. fn insert_file_info_and_get_file_id( &self, path_rel: &RelativePath, file_summary: &crate::FileSummary, ) -> anyhow::Result<crate::FileInfoId> { let prefix_type = path_rel.prefix() as u8; // TODO(ljw): shouldn't this use prefix_to_i64? let suffix = path_rel.path().to_str().unwrap(); let type_checker_mode = crate::datatypes::convert::mode_to_i64(file_summary.mode); let file_decls_hash = file_summary.file_decls_hash; let file_digest = match &file_summary.file_digest { Some(digest) => digest, None => "", }; self.conn .prepare_cached( "INSERT INTO NAMING_FILE_INFO( FILE_DIGEST, PATH_PREFIX_TYPE, PATH_SUFFIX, TYPE_CHECKER_MODE, DECL_HASH, CLASSES, CONSTS, FUNS, TYPEDEFS, MODULES ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10);", )? .execute(params![ file_digest, prefix_type, suffix, type_checker_mode, file_decls_hash, Self::join_with_pipe(file_summary.classes()), Self::join_with_pipe(file_summary.consts()), Self::join_with_pipe(file_summary.funs()), Self::join_with_pipe(file_summary.typedefs()), Self::join_with_pipe(file_summary.modules()), ])?; let file_info_id = crate::FileInfoId::last_insert_rowid(&self.conn); Ok(file_info_id) } fn join_with_pipe<'a>(symbols: impl Iterator<Item = &'a crate::DeclSummary>) -> Option<String> { let s = symbols .map(|summary| summary.symbol.as_str()) .collect::<Vec<_>>() .join("|"); if s.is_empty() { None } else { Some(s) } } /// This updates the forward naming table. /// It will replace the existing entry (preserving file_info_id) if file was present, /// or add a new entry (with new file_info_id) otherwise. /// It returns the file_info_id. /// Note: it never deletes a row. /// TODO(ljw): reconcile with existing delete() and insert_file_info_and_get_file_id() pub fn fwd_update( &self, path: &RelativePath, file_summary: Option<&crate::FileSummary>, ) -> anyhow::Result<crate::FileInfoId> { let file_info_id_opt = self .conn .prepare_cached( "SELECT FILE_INFO_ID FROM NAMING_FILE_INFO WHERE PATH_PREFIX_TYPE = ? AND PATH_SUFFIX = ?", )? .query_row(params![path.prefix() as u8, path.path_str()], |row| { row.get::<usize, crate::FileInfoId>(0) }) .optional()?; let file_info_id = match file_info_id_opt { Some(file_info_id) => file_info_id, None => { self.conn .prepare_cached("INSERT INTO NAMING_FILE_INFO(PATH_PREFIX_TYPE,PATH_SUFFIX) VALUES (?1, ?2);")? .execute(params![ path.prefix() as u8, path.path_str(), ])?; crate::FileInfoId::last_insert_rowid(&self.conn) } }; let _a = file_summary.and_then(|fs| Self::join_with_pipe(fs.classes())); self.conn .prepare_cached( " UPDATE NAMING_FILE_INFO SET TYPE_CHECKER_MODE=?, DECL_HASH=?, CLASSES=?, CONSTS=?, FUNS=?, TYPEDEFS=?, MODULES=? WHERE FILE_INFO_ID=? ", )? .execute(params![ crate::datatypes::convert::mode_to_i64(file_summary.and_then(|fs| fs.mode)), file_summary.map(|fs| fs.file_decls_hash), file_summary.and_then(|fs| Self::join_with_pipe(fs.classes())), file_summary.and_then(|fs| Self::join_with_pipe(fs.consts())), file_summary.and_then(|fs| Self::join_with_pipe(fs.funs())), file_summary.and_then(|fs| Self::join_with_pipe(fs.typedefs())), file_summary.and_then(|fs| Self::join_with_pipe(fs.modules())), file_info_id, ])?; Ok(file_info_id) } /// This removes an entry from the forward naming table. /// TODO(ljw): reconcile with delete. pub fn fwd_delete(&self, file_info_id: crate::FileInfoId) -> anyhow::Result<()> { self.conn .prepare_cached("DELETE FROM NAMING_FILE_INFO WHERE FILE_INFO_ID = ?")? .execute(params![file_info_id])?; Ok(()) } /// This updates the reverse naming-table NAMING_SYMBOLS and NAMING_SYMBOLS_OVERFLOW /// by removing all old entries, then inserting the new entries. /// TODO(ljw): remove previous implementations of insert_file_summary. pub fn rev_update( &self, symbol_hash: ToplevelSymbolHash, winner: Option<&crate::SymbolRow>, overflow: &[&crate::SymbolRow], ) -> anyhow::Result<()> { self.conn .prepare("DELETE FROM NAMING_SYMBOLS WHERE HASH = ?")? .execute(params![symbol_hash])?; self.conn .prepare("DELETE FROM NAMING_SYMBOLS_OVERFLOW WHERE HASH = ?")? .execute(params![symbol_hash])?; if let Some(symbol) = winner { self.conn.prepare("INSERT INTO NAMING_SYMBOLS (HASH, CANON_HASH, DECL_HASH, FLAGS, FILE_INFO_ID) VALUES (?,?,?,?,?)")? .execute(params![ symbol.hash, symbol.canon_hash, symbol.decl_hash, symbol.kind, symbol.file_info_id ])?; } for symbol in overflow { self.conn.prepare("INSERT INTO NAMING_SYMBOLS_OVERFLOW (HASH, CANON_HASH, DECL_HASH, FLAGS, FILE_INFO_ID) VALUES (?,?,?,?,?)")? .execute(params![ symbol.hash, symbol.canon_hash, symbol.decl_hash, symbol.kind, symbol.file_info_id ])?; } Ok(()) } /// Wrapper around `build` (see its documentation); this wrapper is for when you /// want to pass file summaries as an iterator rather than send them over a channel. pub fn build_from_iterator( path: impl AsRef<Path>, file_summaries: impl IntoIterator<Item = (RelativePath, crate::FileSummary)>, ) -> anyhow::Result<crate::SaveResult> { Self::build(path, |tx| { file_summaries.into_iter().try_for_each(|x| Ok(tx.send(x)?)) }) } /// Build a naming table at `path` (its containing directory will be created if necessary) /// out of the information provided in `collect_file_summaries`. The naming table will be /// built on a background thread while `collect_file_summaries` is run. Once /// all file summaries have been sent on the `Sender` , drop it (usually by /// letting it go out of scope as `collect_file_summaries` terminates) to /// allow building to continue. /// If this function errors, the naming-table at `path` will be left in an indeterminate state. pub fn build( path: impl AsRef<Path>, collect_file_summaries: impl FnOnce( crossbeam::channel::Sender<(RelativePath, crate::FileSummary)>, ) -> anyhow::Result<()>, ) -> anyhow::Result<crate::SaveResult> { let path = path.as_ref(); std::fs::create_dir_all( path.parent() .ok_or_else(|| anyhow::anyhow!("Invalid output path: {}", path.display()))?, )?; let mut conn = Connection::open(path)?; // The upshot of these commands is they're the fastest way we've found to write // millions of rows into sqlite. They avoid sqlite having to acquire locks each // row, and avoid it facing the overhead of recoverability in case of failure. // The idea of a "transaction" here is a bit odd, because we're non-recoverable, // in case of error, but it's part of the magic sauce of helping sqlite go fast // (since it avoids the overhead of starting a fresh transaction once per row). conn.execute_batch( "PRAGMA journal_mode = OFF; PRAGMA synchronous = OFF; PRAGMA cache_size = 1000000; PRAGMA locking_mode = EXCLUSIVE; PRAGMA temp_store = MEMORY; BEGIN TRANSACTION;", )?; Self::create_tables(&mut conn)?; let mut names = Self { conn }; let save_result = crossbeam::thread::scope(|scope| -> anyhow::Result<_> { let (tx, rx) = crossbeam::channel::unbounded(); // Write to the db serially, but concurrently with parsing let names = &mut names; let db_thread = scope.spawn(move |_| -> anyhow::Result<_> { let mut save_result = crate::SaveResult::default(); while let Ok((path, summary)) = rx.recv() { names.insert_file_summary(&path, &summary, &mut save_result)?; } Ok(save_result) }); // Parse files (in parallel, if the caller chooses) collect_file_summaries(tx)?; db_thread.join().unwrap() }) .unwrap()?; names.set_checksum(save_result.checksum)?; // Another part of the magic sauce for sqlite speed is to create indices in // one go at the end, rather than having them updated once per row. let mut conn = names.conn; Self::create_indices(&mut conn)?; conn.execute("END TRANSACTION", params![])?; conn.close().map_err(|(_conn, e)| e)?; Ok(save_result) } /// Close the connection. If the close fails, returns Err(conn, err) /// so the caller can try again, report what went wrong, etc. /// drop() has the same flushing behavior as close(), but without error handling. pub fn close(self) -> Result<(), (rusqlite::Connection, rusqlite::Error)> { self.conn.close() } } /// This token is for a transaction. When you construct it, /// it does sql command "BEGIN EXCLUSIVE TRANSACTION". /// When you call end() or drop it, it does sql command "END TRANSACTION". /// (There's also a similar rusqlite::Transaction, but it takes &mut /// ownership of the connection, which makes it awkward to work with /// all our methods.) pub struct Transaction<'a> { conn: Option<&'a rusqlite::Connection>, } impl<'a> Transaction<'a> { fn new(conn: &'a rusqlite::Connection) -> anyhow::Result<Self> { conn.execute_batch("BEGIN EXCLUSIVE TRANSACTION;")?; Ok(Self { conn: Some(conn) }) } pub fn end(mut self) -> anyhow::Result<()> { if let Some(conn) = self.conn.take() { conn.execute_batch("END TRANSACTION;")?; } Ok(()) } } impl<'a> Drop for Transaction<'a> { fn drop(&mut self) { if let Some(conn) = self.conn.take() { let _ignore = conn.execute_batch("END TRANSACTION;"); } } }
Rust
hhvm/hphp/hack/src/naming/names_rust/summary.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use hh24_types::DeclHash; use hh24_types::FileDeclsHash; use hh24_types::ToplevelCanonSymbolHash; use hh24_types::ToplevelSymbolHash; use oxidized::file_info; use oxidized::file_info::NameType; use oxidized_by_ref::direct_decl_parser::Decl; use oxidized_by_ref::direct_decl_parser::ParsedFileWithHashes; use relative_path::RelativePath; use serde::Deserialize; use serde::Serialize; type FileDigest = String; /// Similar to `oxidized::file_info::FileInfo`, but containing only the /// information which is necessary to populate the naming table (i.e., omitting /// positions). Includes hashes of individual decls. #[derive(Clone, Debug, Hash, Serialize, Deserialize)] pub struct FileSummary { pub mode: Option<file_info::Mode>, pub file_decls_hash: FileDeclsHash, pub decls: Vec<DeclSummary>, pub file_digest: Option<FileDigest>, } impl FileSummary { pub fn new<'a>(parsed_file: &ParsedFileWithHashes<'a>) -> Self { Self { mode: parsed_file.mode, file_decls_hash: parsed_file.file_decls_hash, decls: parsed_file .iter() .map(|&(symbol, decl, hash)| DeclSummary { name_type: decl.kind(), symbol: symbol.to_owned(), hash, }) .collect(), file_digest: None, } } pub fn example_symbol(&self) -> Option<String> { self.decls.first().map(|decl| &decl.symbol).cloned() } pub fn decl_hashes(&self) -> impl Iterator<Item = (ToplevelSymbolHash, DeclHash)> + '_ { self.decls .iter() .map(|decl| (decl.symbol_hash(), decl.hash)) } pub fn symbols_of_kind(&self, kind: NameType) -> impl Iterator<Item = &DeclSummary> + '_ { self.decls.iter().filter(move |decl| decl.name_type == kind) } pub fn classes(&self) -> impl Iterator<Item = &DeclSummary> + '_ { self.symbols_of_kind(NameType::Class) } pub fn funs(&self) -> impl Iterator<Item = &DeclSummary> + '_ { self.symbols_of_kind(NameType::Fun) } pub fn consts(&self) -> impl Iterator<Item = &DeclSummary> + '_ { self.symbols_of_kind(NameType::Const) } pub fn typedefs(&self) -> impl Iterator<Item = &DeclSummary> + '_ { self.symbols_of_kind(NameType::Typedef) } pub fn modules(&self) -> impl Iterator<Item = &DeclSummary> + '_ { self.symbols_of_kind(NameType::Module) } } #[derive(Clone, Debug, Hash, Serialize, Deserialize)] pub struct DeclSummary { pub name_type: file_info::NameType, pub symbol: String, pub hash: DeclHash, } impl DeclSummary { pub fn symbol_hash(&self) -> ToplevelSymbolHash { ToplevelSymbolHash::new(self.name_type, &self.symbol) } } /// This is what each row looks like in NAMING_SYMBOLS and NAMING_SYMBOLS_OVERFLOW, /// i.e. the reverse naming table. When this struct is used for reading from the /// database, we generally join NAMING_FILE_INFO to populate 'path' since there's very /// little you can do with a row without turning file_info_id into a pathname; /// when used for writing, we generally ignore 'path'. /// This structure is a bit like DeclSummary. The difference is that SymbolRow /// can be reconstructed from out of the reverse-naming-table (hence can be used /// by algorithms that want to retrieve then write-back stuff from the table), /// while DeclSummary can't. #[derive(Clone, Debug)] pub struct SymbolRow { pub hash: ToplevelSymbolHash, pub canon_hash: ToplevelCanonSymbolHash, pub decl_hash: DeclHash, pub kind: NameType, pub file_info_id: crate::FileInfoId, pub path: RelativePath, } impl SymbolRow { /// This method walks the Decl structure to construct a hash for it pub fn new( path: RelativePath, file_info_id: crate::FileInfoId, name: &str, decl: &Decl<'_>, decl_hash: DeclHash, ) -> Self { let kind = decl.kind(); Self { hash: ToplevelSymbolHash::new(kind, name), canon_hash: ToplevelCanonSymbolHash::new(kind, name.to_owned()), kind, decl_hash, file_info_id, path, } } }
Rust
hhvm/hphp/hack/src/naming/rust/naming_types.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated <<SignedSource::*O*zOeWoEQle#+L!plEphiEmie@IsG>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep, )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[repr(u8)] pub enum KindOfType { TClass, TTypedef, } impl TrivialDrop for KindOfType {} arena_deserializer::impl_deserialize_in_arena!(KindOfType); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep, )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[repr(C, u8)] pub enum NameKind { #[rust_to_ocaml(name = "Type_kind")] TypeKind(KindOfType), #[rust_to_ocaml(name = "Fun_kind")] FunKind, #[rust_to_ocaml(name = "Const_kind")] ConstKind, #[rust_to_ocaml(name = "Module_kind")] ModuleKind, }
Rust
hhvm/hphp/hack/src/naming/rust/naming_types_lib.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod naming_types; pub use naming_types::*;
TOML
hhvm/hphp/hack/src/naming/rust/naming_types/Cargo.toml
# @generated by autocargo [package] name = "naming_types" version = "0.0.0" edition = "2021" [lib] path = "../naming_types_lib.rs" [dependencies] arena_deserializer = { version = "0.0.0", path = "../../../utils/arena_deserializer" } arena_trait = { version = "0.0.0", path = "../../../arena_trait" } eq_modulo_pos = { version = "0.0.0", path = "../../../utils/eq_modulo_pos" } no_pos_hash = { version = "0.0.0", path = "../../../utils/no_pos_hash" } ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" } serde = { version = "1.0.176", features = ["derive", "rc"] }
hhvm/hphp/hack/src/ocamlrep_marshal/dune
(data_only_dirs cargo) (library (name ocamlrep_marshal_ffi) (modules ocamlrep_marshal_ffi) (wrapped false) (c_library_flags -lpthread) (foreign_archives ocamlrep_marshal_ffi_bindings)) (rule (targets libocamlrep_marshal_ffi_bindings.a) (deps (source_tree %{workspace_root}/hack/src)) (locks cargo) (action (run %{workspace_root}/hack/scripts/invoke_cargo.sh ocamlrep_marshal_ffi_bindings ocamlrep_marshal_ffi_bindings)))
OCaml
hhvm/hphp/hack/src/ocamlrep_marshal/ocamlrep_marshal_ffi.ml
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) external to_string : 'a -> Marshal.extern_flags list -> string = "ocamlrep_marshal_output_value_to_string" external from_string : string -> int -> 'a = "ocamlrep_marshal_input_value_from_string"
Rust
hhvm/hphp/hack/src/ocamlrep_marshal/ocamlrep_marshal_ffi_bindings.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use ocamlrep::FromOcamlRep; type OcamlValue = usize; #[no_mangle] unsafe extern "C" fn ocamlrep_marshal_output_value_to_string( v: OcamlValue, flags: OcamlValue, ) -> OcamlValue { ocamlrep_ocamlpool::catch_unwind(|| { let v = ocamlrep::Value::from_bits(v); let flags = ocamlrep_marshal::ExternFlags::from_ocaml(flags).unwrap(); let mut cursor = std::io::Cursor::new(vec![]); ocamlrep_marshal::output_value(&mut cursor, v, flags).unwrap(); ocamlrep_ocamlpool::to_ocaml(&cursor.into_inner()) }) } #[no_mangle] unsafe extern "C" fn ocamlrep_marshal_input_value_from_string( str: OcamlValue, ofs: OcamlValue, ) -> OcamlValue { ocamlrep_ocamlpool::catch_unwind(|| { let offset = usize::from_ocaml(ofs).unwrap(); let str = ocamlrep::bytes_from_ocamlrep(ocamlrep::Value::from_bits(str)).unwrap(); let str = &str[offset..]; let pool = ocamlrep_ocamlpool::Pool::new(); ocamlrep_marshal::input_value(str, &pool).to_bits() }) }
TOML
hhvm/hphp/hack/src/ocamlrep_marshal/cargo/ocamlrep_marshal_ffi_bindings/Cargo.toml
# @generated by autocargo [package] name = "ocamlrep_marshal_ffi_bindings" version = "0.0.0" edition = "2021" [lib] path = "../../ocamlrep_marshal_ffi_bindings.rs" test = false doctest = false crate-type = ["lib", "staticlib"] [dependencies] ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" } ocamlrep_marshal = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" } ocamlrep_ocamlpool = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" }
OCaml Interface
hhvm/hphp/hack/src/options/buildOptions.mli
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) (** * Where we look for system-wide configuration files. * * Possible values include: * - "/etc": most linux systems * - "/usr/local/etc": MacOS homebrew *) val system_config_path : string (** * Where to look for hackfmt. * * Possible values include: * - "/usr/local/bin/hackfmt": manual builds, Facebook * - "/usr/bin/hackfmt": most linux binary builds * - "/usr/local/Cellar/hhvm/VERSION/bin/hackfmt": MacOS homebrew *) val default_hackfmt_path : string
OCaml
hhvm/hphp/hack/src/options/declParserOptions.ml
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { auto_namespace_map: (string * string) list; disable_xhp_element_mangling: bool; interpret_soft_types_as_like_types: bool; allow_new_attribute_syntax: bool; enable_xhp_class_modifier: bool; everything_sdt: bool; php5_compat_mode: bool; hhvm_compat_mode: bool; keep_user_attributes: bool; } [@@deriving show] let from_parser_options popt = let open GlobalOptions in { auto_namespace_map = popt.po_auto_namespace_map; disable_xhp_element_mangling = popt.po_disable_xhp_element_mangling; interpret_soft_types_as_like_types = popt.po_interpret_soft_types_as_like_types; allow_new_attribute_syntax = popt.po_allow_new_attribute_syntax; enable_xhp_class_modifier = popt.po_enable_xhp_class_modifier; everything_sdt = popt.tco_everything_sdt; php5_compat_mode = false; hhvm_compat_mode = false; keep_user_attributes = popt.po_keep_user_attributes; } let default = from_parser_options ParserOptions.default
OCaml Interface
hhvm/hphp/hack/src/options/declParserOptions.mli
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { auto_namespace_map: (string * string) list; disable_xhp_element_mangling: bool; interpret_soft_types_as_like_types: bool; allow_new_attribute_syntax: bool; enable_xhp_class_modifier: bool; everything_sdt: bool; php5_compat_mode: bool; hhvm_compat_mode: bool; keep_user_attributes: bool; } [@@deriving show] val default : t val from_parser_options : ParserOptions.t -> t
OCaml
hhvm/hphp/hack/src/options/discover.ml
module C = Configurator.V1 let () = let filename = "buildOptions.generated.ml" in C.main ~name:"build_options" (fun (_ : C.t) -> try let sysconfdir = Sys.getenv "CMAKE_INSTALL_FULL_SYSCONFDIR" and bindir = Sys.getenv "CMAKE_INSTALL_FULL_BINDIR" in C.Flags.write_lines filename [ "let system_config_path = \"" ^ sysconfdir ^ "\""; "let default_hackfmt_path = \"" ^ bindir ^ "/hackfmt\""; ] with | Not_found -> C.Flags.write_lines filename [])
hhvm/hphp/hack/src/options/dune
(library (name global_options) (wrapped false) (modules globalOptions) (libraries collections custom_error_types package_info saved_state_rollouts utils_find) (preprocess (pps ppx_deriving.std))) (library (name saved_state_rollouts) (wrapped false) (modules saved_state_rollouts) (libraries utils_core) (preprocess (pps ppx_deriving.std))) (executable (name discover) (modules discover) (libraries dune.configurator) (preprocess (pps ppx_deriving.std))) (rule (targets buildOptions.generated.ml) (action (run ./discover.exe))) (rule (target buildOptions.fb.ml) (action (copy# facebook/buildOptions.ml buildOptions.fb.ml))) (library (name build_options) (wrapped false) (modules buildOptions) (libraries (select buildOptions.ml from (facebook -> buildOptions.fb.ml) (-> buildOptions.generated.ml))) (preprocess (pps ppx_deriving.std))) (library (name glean_options) (wrapped false) (modules gleanOptions) (libraries global_options) (preprocess (pps ppx_deriving.std))) (library (name parser_options) (wrapped false) (modules parserOptions) (libraries global_options) (preprocess (pps ppx_deriving.std))) (library (name decl_parser_options) (wrapped false) (modules declParserOptions) (libraries global_options parser_options) (preprocess (pps ppx_deriving.std))) (library (name symbol_write_options) (wrapped false) (modules symbolWriteOptions) (libraries global_options) (preprocess (pps ppx_deriving.std))) (library (name typechecker_options) (wrapped false) (modules typecheckerOptions) (libraries global_options) (preprocess (pps ppx_deriving.std)))
OCaml
hhvm/hphp/hack/src/options/gleanOptions.ml
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) [@@@warning "-33"] open Hh_prelude [@@@warning "+33"] type t = GlobalOptions.t [@@deriving show] let reponame t = t.GlobalOptions.glean_reponame let default = GlobalOptions.default
OCaml
hhvm/hphp/hack/src/options/globalOptions.ml
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) [@@@warning "-33"] open Hh_prelude [@@@warning "+33"] (* NOTE: this file is in the middle of a large refactoring. Please try to avoid changes other than adding a field to struct `t`, updating `default` value and `make` functions Encapsulation and helpers better fit in the respective modules: e.g., TypecheckerOptions for tco_* fields ParserOptions for po_*fields etc. *) type saved_state_loading = { saved_state_manifold_api_key: string option; log_saved_state_age_and_distance: bool; use_manifold_cython_client: bool; } [@@deriving show, eq] let default_saved_state_loading = { saved_state_manifold_api_key = None; log_saved_state_age_and_distance = false; use_manifold_cython_client = false; } type saved_state = { loading: saved_state_loading; rollouts: Saved_state_rollouts.t; project_metadata_w_flags: bool; } [@@deriving show, eq] let default_saved_state = { loading = default_saved_state_loading; rollouts = Saved_state_rollouts.default; project_metadata_w_flags = true; } let with_saved_state_manifold_api_key saved_state_manifold_api_key ss = { ss with loading = { ss.loading with saved_state_manifold_api_key } } let with_use_manifold_cython_client use_manifold_cython_client ss = { ss with loading = { ss.loading with use_manifold_cython_client } } let with_log_saved_state_age_and_distance log_saved_state_age_and_distance ss = { ss with loading = { ss.loading with log_saved_state_age_and_distance } } (** Naming conventions for fields in this struct: - tco_<feature/flag/setting> - type checker option - po_<feature/flag/setting> - parser option - so_<feature/flag/setting> - server option *) type t = { tco_saved_state: saved_state; tco_experimental_features: SSet.t; tco_migration_flags: SSet.t; tco_num_local_workers: int option; tco_max_typechecker_worker_memory_mb: int option; tco_defer_class_declaration_threshold: int option; tco_locl_cache_capacity: int; tco_locl_cache_node_threshold: int; so_naming_sqlite_path: string option; po_auto_namespace_map: (string * string) list; po_codegen: bool; po_deregister_php_stdlib: bool; po_disallow_toplevel_requires: bool; po_allow_unstable_features: bool; tco_log_large_fanouts_threshold: int option; tco_log_inference_constraints: bool; tco_language_feature_logging: bool; tco_timeout: int; tco_disallow_invalid_arraykey: bool; tco_disallow_byref_dynamic_calls: bool; tco_disallow_byref_calls: bool; code_agnostic_fixme: bool; allowed_fixme_codes_strict: ISet.t; log_levels: int SMap.t; po_disable_lval_as_an_expression: bool; tco_remote_old_decls_no_limit: bool; tco_fetch_remote_old_decls: bool; tco_populate_member_heaps: bool; tco_skip_hierarchy_checks: bool; tco_skip_tast_checks: bool; tco_like_type_hints: bool; tco_union_intersection_type_hints: bool; tco_coeffects: bool; tco_coeffects_local: bool; tco_strict_contexts: bool; tco_like_casts: bool; tco_check_xhp_attribute: bool; tco_check_redundant_generics: bool; tco_disallow_unresolved_type_variables: bool; tco_custom_error_config: Custom_error_config.t; po_enable_class_level_where_clauses: bool; po_disable_legacy_soft_typehints: bool; po_allowed_decl_fixme_codes: ISet.t; po_allow_new_attribute_syntax: bool; tco_const_static_props: bool; po_disable_legacy_attribute_syntax: bool; tco_const_attribute: bool; po_const_default_func_args: bool; po_const_default_lambda_args: bool; po_disallow_silence: bool; po_abstract_static_props: bool; po_parser_errors_only: bool; tco_check_attribute_locations: bool; glean_reponame: string; symbol_write_index_inherited_members: bool; symbol_write_ownership: bool; symbol_write_root_path: string; symbol_write_hhi_path: string; symbol_write_ignore_paths: string list; symbol_write_index_paths: string list; symbol_write_index_paths_file: string option; symbol_write_index_paths_file_output: string option; symbol_write_include_hhi: bool; symbol_write_sym_hash_in: string option; symbol_write_exclude_out: string option; symbol_write_referenced_out: string option; symbol_write_sym_hash_out: bool; po_disallow_func_ptrs_in_constants: bool; tco_error_php_lambdas: bool; tco_disallow_discarded_nullable_awaitables: bool; po_enable_xhp_class_modifier: bool; po_disable_xhp_element_mangling: bool; po_disable_xhp_children_declarations: bool; po_disable_hh_ignore_error: int; po_keep_user_attributes: bool; tco_is_systemlib: bool; tco_higher_kinded_types: bool; tco_method_call_inference: bool; tco_report_pos_from_reason: bool; tco_typecheck_sample_rate: float; tco_enable_sound_dynamic: bool; tco_pessimise_builtins: bool; tco_enable_no_auto_dynamic: bool; tco_skip_check_under_dynamic: bool; tco_ifc_enabled: string list; tco_global_access_check_enabled: bool; po_interpret_soft_types_as_like_types: bool; tco_enable_strict_string_concat_interp: bool; tco_ignore_unsafe_cast: bool; tco_no_parser_readonly_check: bool; tco_enable_expression_trees: bool; tco_enable_modules: bool; tco_allowed_expression_tree_visitors: string list; tco_math_new_code: bool; tco_typeconst_concrete_concrete_error: bool; tco_enable_strict_const_semantics: int; tco_strict_wellformedness: int; tco_meth_caller_only_public_visibility: bool; tco_require_extends_implements_ancestors: bool; tco_strict_value_equality: bool; tco_enforce_sealed_subclasses: bool; tco_everything_sdt: bool; tco_explicit_consistent_constructors: int; tco_require_types_class_consts: int; tco_type_printer_fuel: int; tco_specify_manifold_api_key: bool; tco_profile_top_level_definitions: bool; tco_allow_all_files_for_module_declarations: bool; tco_allowed_files_for_module_declarations: string list; tco_record_fine_grained_dependencies: bool; tco_loop_iteration_upper_bound: int option; tco_expression_tree_virtualize_functions: bool; tco_substitution_mutation: bool; tco_use_type_alias_heap: bool; tco_populate_dead_unsafe_cast_heap: bool; po_disallow_static_constants_in_default_func_args: bool; tco_load_hack_64_distc_saved_state: bool; tco_rust_elab: bool; dump_tast_hashes: bool; tco_autocomplete_mode: bool; tco_package_info: PackageInfo.t; po_unwrap_concurrent: bool; tco_log_exhaustivity_check: bool; } [@@deriving eq, show] let default = { tco_saved_state = default_saved_state; tco_experimental_features = SSet.empty; tco_migration_flags = SSet.empty; tco_num_local_workers = None; tco_max_typechecker_worker_memory_mb = None; tco_defer_class_declaration_threshold = None; tco_locl_cache_capacity = 30; tco_locl_cache_node_threshold = 10_000; so_naming_sqlite_path = None; po_auto_namespace_map = []; po_codegen = false; po_disallow_toplevel_requires = false; po_deregister_php_stdlib = false; po_allow_unstable_features = false; tco_log_large_fanouts_threshold = None; tco_log_inference_constraints = false; tco_language_feature_logging = false; tco_timeout = 0; tco_disallow_invalid_arraykey = true; tco_disallow_byref_dynamic_calls = false; tco_disallow_byref_calls = true; code_agnostic_fixme = false; allowed_fixme_codes_strict = ISet.empty; log_levels = SMap.empty; po_disable_lval_as_an_expression = true; tco_remote_old_decls_no_limit = false; tco_fetch_remote_old_decls = false; tco_populate_member_heaps = true; tco_skip_hierarchy_checks = false; tco_skip_tast_checks = false; tco_like_type_hints = false; tco_union_intersection_type_hints = false; tco_coeffects = true; tco_coeffects_local = true; tco_strict_contexts = true; tco_like_casts = false; tco_check_xhp_attribute = false; tco_check_redundant_generics = false; tco_disallow_unresolved_type_variables = false; tco_custom_error_config = Custom_error_config.empty; po_enable_class_level_where_clauses = false; po_disable_legacy_soft_typehints = true; po_allowed_decl_fixme_codes = ISet.empty; po_allow_new_attribute_syntax = false; tco_const_static_props = false; po_disable_legacy_attribute_syntax = false; tco_const_attribute = false; po_const_default_func_args = false; po_const_default_lambda_args = false; po_disallow_silence = false; po_abstract_static_props = false; po_parser_errors_only = false; tco_check_attribute_locations = true; glean_reponame = "www.autocomplete"; symbol_write_index_inherited_members = true; symbol_write_ownership = false; symbol_write_root_path = "www"; symbol_write_hhi_path = "hhi"; symbol_write_ignore_paths = []; symbol_write_index_paths = []; symbol_write_index_paths_file = None; symbol_write_index_paths_file_output = None; symbol_write_include_hhi = false; symbol_write_sym_hash_in = None; symbol_write_exclude_out = None; symbol_write_referenced_out = None; symbol_write_sym_hash_out = false; po_disallow_func_ptrs_in_constants = false; tco_error_php_lambdas = false; tco_disallow_discarded_nullable_awaitables = false; po_enable_xhp_class_modifier = true; po_disable_xhp_element_mangling = true; po_disable_xhp_children_declarations = true; po_disable_hh_ignore_error = 0; po_keep_user_attributes = false; tco_is_systemlib = false; tco_higher_kinded_types = false; tco_method_call_inference = false; tco_report_pos_from_reason = false; tco_typecheck_sample_rate = 1.0; tco_enable_sound_dynamic = false; tco_pessimise_builtins = false; tco_enable_no_auto_dynamic = false; tco_skip_check_under_dynamic = false; tco_ifc_enabled = []; tco_global_access_check_enabled = false; po_interpret_soft_types_as_like_types = false; tco_enable_strict_string_concat_interp = false; tco_ignore_unsafe_cast = false; tco_no_parser_readonly_check = false; tco_enable_expression_trees = false; tco_enable_modules = false; tco_allowed_expression_tree_visitors = []; tco_math_new_code = false; tco_typeconst_concrete_concrete_error = false; tco_enable_strict_const_semantics = 0; tco_strict_wellformedness = 0; tco_meth_caller_only_public_visibility = true; tco_require_extends_implements_ancestors = false; tco_strict_value_equality = false; tco_enforce_sealed_subclasses = false; tco_everything_sdt = false; tco_explicit_consistent_constructors = 0; tco_require_types_class_consts = 0; tco_type_printer_fuel = 100; tco_specify_manifold_api_key = false; tco_profile_top_level_definitions = false; tco_allow_all_files_for_module_declarations = true; tco_allowed_files_for_module_declarations = []; tco_record_fine_grained_dependencies = false; tco_loop_iteration_upper_bound = None; tco_expression_tree_virtualize_functions = false; tco_substitution_mutation = false; tco_use_type_alias_heap = false; tco_populate_dead_unsafe_cast_heap = false; po_disallow_static_constants_in_default_func_args = false; tco_load_hack_64_distc_saved_state = false; tco_rust_elab = false; dump_tast_hashes = false; tco_autocomplete_mode = false; tco_package_info = PackageInfo.empty; po_unwrap_concurrent = false; tco_log_exhaustivity_check = false; } let set ?tco_saved_state ?po_deregister_php_stdlib ?po_disallow_toplevel_requires ?tco_log_large_fanouts_threshold ?tco_log_inference_constraints ?tco_experimental_features ?tco_migration_flags ?tco_num_local_workers ?tco_max_typechecker_worker_memory_mb ?tco_defer_class_declaration_threshold ?tco_locl_cache_capacity ?tco_locl_cache_node_threshold ?so_naming_sqlite_path ?po_auto_namespace_map ?po_codegen ?tco_language_feature_logging ?tco_timeout ?tco_disallow_invalid_arraykey ?tco_disallow_byref_dynamic_calls ?tco_disallow_byref_calls ?code_agnostic_fixme ?allowed_fixme_codes_strict ?log_levels ?po_disable_lval_as_an_expression ?tco_remote_old_decls_no_limit ?tco_fetch_remote_old_decls ?tco_populate_member_heaps ?tco_skip_hierarchy_checks ?tco_skip_tast_checks ?tco_like_type_hints ?tco_union_intersection_type_hints ?tco_coeffects ?tco_coeffects_local ?tco_strict_contexts ?tco_like_casts ?tco_check_xhp_attribute ?tco_check_redundant_generics ?tco_disallow_unresolved_type_variables ?tco_custom_error_config ?po_enable_class_level_where_clauses ?po_disable_legacy_soft_typehints ?po_allowed_decl_fixme_codes ?po_allow_new_attribute_syntax ?tco_const_static_props ?po_disable_legacy_attribute_syntax ?tco_const_attribute ?po_const_default_func_args ?po_const_default_lambda_args ?po_disallow_silence ?po_abstract_static_props ?po_parser_errors_only ?tco_check_attribute_locations ?glean_reponame ?symbol_write_index_inherited_members ?symbol_write_ownership ?symbol_write_root_path ?symbol_write_hhi_path ?symbol_write_ignore_paths ?symbol_write_index_paths ?symbol_write_index_paths_file ?symbol_write_index_paths_file_output ?symbol_write_include_hhi ?symbol_write_sym_hash_in ?symbol_write_exclude_out ?symbol_write_referenced_out ?symbol_write_sym_hash_out ?po_disallow_func_ptrs_in_constants ?tco_error_php_lambdas ?tco_disallow_discarded_nullable_awaitables ?po_enable_xhp_class_modifier ?po_disable_xhp_element_mangling ?po_disable_xhp_children_declarations ?po_disable_hh_ignore_error ?po_keep_user_attributes ?po_allow_unstable_features ?tco_is_systemlib ?tco_higher_kinded_types ?tco_method_call_inference ?tco_report_pos_from_reason ?tco_typecheck_sample_rate ?tco_enable_sound_dynamic ?tco_pessimise_builtins ?tco_enable_no_auto_dynamic ?tco_skip_check_under_dynamic ?tco_ifc_enabled ?tco_global_access_check_enabled ?po_interpret_soft_types_as_like_types ?tco_enable_strict_string_concat_interp ?tco_ignore_unsafe_cast ?tco_no_parser_readonly_check ?tco_enable_expression_trees ?tco_enable_modules ?tco_allowed_expression_tree_visitors ?tco_math_new_code ?tco_typeconst_concrete_concrete_error ?tco_enable_strict_const_semantics ?tco_strict_wellformedness ?tco_meth_caller_only_public_visibility ?tco_require_extends_implements_ancestors ?tco_strict_value_equality ?tco_enforce_sealed_subclasses ?tco_everything_sdt ?tco_explicit_consistent_constructors ?tco_require_types_class_consts ?tco_type_printer_fuel ?tco_specify_manifold_api_key ?tco_profile_top_level_definitions ?tco_allow_all_files_for_module_declarations ?tco_allowed_files_for_module_declarations ?tco_record_fine_grained_dependencies ?tco_loop_iteration_upper_bound ?tco_expression_tree_virtualize_functions ?tco_substitution_mutation ?tco_use_type_alias_heap ?tco_populate_dead_unsafe_cast_heap ?po_disallow_static_constants_in_default_func_args ?tco_load_hack_64_distc_saved_state ?tco_rust_elab ?dump_tast_hashes ?tco_autocomplete_mode ?tco_package_info ?po_unwrap_concurrent ?tco_log_exhaustivity_check options = let setting setting option = match setting with | None -> option | Some value -> value in let setting_opt setting option = match setting with | None -> option | Some _ -> setting in { tco_saved_state = setting tco_saved_state options.tco_saved_state; tco_experimental_features = setting tco_experimental_features options.tco_experimental_features; tco_migration_flags = setting tco_migration_flags options.tco_migration_flags; tco_num_local_workers = setting_opt tco_num_local_workers options.tco_num_local_workers; tco_max_typechecker_worker_memory_mb = setting_opt tco_max_typechecker_worker_memory_mb options.tco_max_typechecker_worker_memory_mb; tco_defer_class_declaration_threshold = setting_opt tco_defer_class_declaration_threshold options.tco_defer_class_declaration_threshold; tco_locl_cache_capacity = setting tco_locl_cache_capacity options.tco_locl_cache_capacity; tco_locl_cache_node_threshold = setting tco_locl_cache_node_threshold options.tco_locl_cache_node_threshold; so_naming_sqlite_path = setting_opt so_naming_sqlite_path options.so_naming_sqlite_path; po_auto_namespace_map = setting po_auto_namespace_map options.po_auto_namespace_map; po_codegen = setting po_codegen options.po_codegen; code_agnostic_fixme = setting code_agnostic_fixme options.code_agnostic_fixme; allowed_fixme_codes_strict = setting allowed_fixme_codes_strict options.allowed_fixme_codes_strict; po_deregister_php_stdlib = setting po_deregister_php_stdlib options.po_deregister_php_stdlib; po_disallow_toplevel_requires = setting po_disallow_toplevel_requires options.po_disallow_toplevel_requires; po_allow_unstable_features = setting po_allow_unstable_features options.po_allow_unstable_features; tco_log_large_fanouts_threshold = setting_opt tco_log_large_fanouts_threshold options.tco_log_large_fanouts_threshold; tco_log_inference_constraints = setting tco_log_inference_constraints options.tco_log_inference_constraints; tco_language_feature_logging = setting tco_language_feature_logging options.tco_language_feature_logging; tco_timeout = setting tco_timeout options.tco_timeout; tco_disallow_invalid_arraykey = setting tco_disallow_invalid_arraykey options.tco_disallow_invalid_arraykey; tco_disallow_byref_dynamic_calls = setting tco_disallow_byref_dynamic_calls options.tco_disallow_byref_dynamic_calls; tco_disallow_byref_calls = setting tco_disallow_byref_calls options.tco_disallow_byref_calls; log_levels = setting log_levels options.log_levels; po_disable_lval_as_an_expression = setting po_disable_lval_as_an_expression options.po_disable_lval_as_an_expression; tco_remote_old_decls_no_limit = setting tco_remote_old_decls_no_limit options.tco_remote_old_decls_no_limit; tco_fetch_remote_old_decls = setting tco_fetch_remote_old_decls options.tco_fetch_remote_old_decls; tco_populate_member_heaps = setting tco_populate_member_heaps options.tco_populate_member_heaps; tco_skip_hierarchy_checks = setting tco_skip_hierarchy_checks options.tco_skip_hierarchy_checks; tco_skip_tast_checks = setting tco_skip_tast_checks options.tco_skip_tast_checks; tco_like_type_hints = setting tco_like_type_hints options.tco_like_type_hints; tco_union_intersection_type_hints = setting tco_union_intersection_type_hints options.tco_union_intersection_type_hints; tco_coeffects = setting tco_coeffects options.tco_coeffects; tco_coeffects_local = setting tco_coeffects_local options.tco_coeffects_local; tco_strict_contexts = setting tco_strict_contexts options.tco_strict_contexts; tco_like_casts = setting tco_like_casts options.tco_like_casts; tco_check_xhp_attribute = setting tco_check_xhp_attribute options.tco_check_xhp_attribute; tco_check_redundant_generics = setting tco_check_redundant_generics options.tco_check_redundant_generics; tco_disallow_unresolved_type_variables = setting tco_disallow_unresolved_type_variables options.tco_disallow_unresolved_type_variables; tco_custom_error_config = setting tco_custom_error_config options.tco_custom_error_config; po_enable_class_level_where_clauses = setting po_enable_class_level_where_clauses options.po_enable_class_level_where_clauses; po_disable_legacy_soft_typehints = setting po_disable_legacy_soft_typehints options.po_disable_legacy_soft_typehints; po_allowed_decl_fixme_codes = setting po_allowed_decl_fixme_codes options.po_allowed_decl_fixme_codes; po_allow_new_attribute_syntax = setting po_allow_new_attribute_syntax options.po_allow_new_attribute_syntax; tco_const_static_props = setting tco_const_static_props options.tco_const_static_props; po_disable_legacy_attribute_syntax = setting po_disable_legacy_attribute_syntax options.po_disable_legacy_attribute_syntax; tco_const_attribute = setting tco_const_attribute options.tco_const_attribute; po_const_default_func_args = setting po_const_default_func_args options.po_const_default_func_args; po_const_default_lambda_args = setting po_const_default_lambda_args options.po_const_default_lambda_args; po_disallow_silence = setting po_disallow_silence options.po_disallow_silence; po_abstract_static_props = setting po_abstract_static_props options.po_abstract_static_props; po_parser_errors_only = setting po_parser_errors_only options.po_parser_errors_only; tco_check_attribute_locations = setting tco_check_attribute_locations options.tco_check_attribute_locations; glean_reponame = setting glean_reponame options.glean_reponame; symbol_write_index_inherited_members = setting symbol_write_index_inherited_members options.symbol_write_index_inherited_members; symbol_write_ownership = setting symbol_write_ownership options.symbol_write_ownership; symbol_write_root_path = setting symbol_write_root_path options.symbol_write_root_path; symbol_write_hhi_path = setting symbol_write_hhi_path options.symbol_write_hhi_path; symbol_write_ignore_paths = setting symbol_write_ignore_paths options.symbol_write_ignore_paths; symbol_write_index_paths = setting symbol_write_index_paths options.symbol_write_index_paths; symbol_write_index_paths_file = setting_opt symbol_write_index_paths_file options.symbol_write_index_paths_file; symbol_write_index_paths_file_output = setting_opt symbol_write_index_paths_file_output options.symbol_write_index_paths_file_output; symbol_write_include_hhi = setting symbol_write_include_hhi options.symbol_write_include_hhi; symbol_write_sym_hash_in = setting_opt symbol_write_sym_hash_in options.symbol_write_sym_hash_in; symbol_write_exclude_out = setting_opt symbol_write_exclude_out options.symbol_write_exclude_out; symbol_write_referenced_out = setting_opt symbol_write_referenced_out options.symbol_write_referenced_out; symbol_write_sym_hash_out = setting symbol_write_sym_hash_out options.symbol_write_sym_hash_out; po_disallow_func_ptrs_in_constants = setting po_disallow_func_ptrs_in_constants options.po_disallow_func_ptrs_in_constants; tco_error_php_lambdas = setting tco_error_php_lambdas options.tco_error_php_lambdas; tco_disallow_discarded_nullable_awaitables = setting tco_disallow_discarded_nullable_awaitables options.tco_disallow_discarded_nullable_awaitables; po_enable_xhp_class_modifier = setting po_enable_xhp_class_modifier options.po_enable_xhp_class_modifier; po_disable_xhp_element_mangling = setting po_disable_xhp_element_mangling options.po_disable_xhp_element_mangling; po_disable_xhp_children_declarations = setting po_disable_xhp_children_declarations options.po_disable_xhp_children_declarations; po_disable_hh_ignore_error = setting po_disable_hh_ignore_error options.po_disable_hh_ignore_error; po_keep_user_attributes = setting po_keep_user_attributes options.po_keep_user_attributes; tco_is_systemlib = setting tco_is_systemlib options.tco_is_systemlib; tco_higher_kinded_types = setting tco_higher_kinded_types options.tco_higher_kinded_types; tco_method_call_inference = setting tco_method_call_inference options.tco_method_call_inference; tco_report_pos_from_reason = setting tco_report_pos_from_reason options.tco_report_pos_from_reason; tco_typecheck_sample_rate = setting tco_typecheck_sample_rate options.tco_typecheck_sample_rate; tco_enable_sound_dynamic = setting tco_enable_sound_dynamic options.tco_enable_sound_dynamic; tco_pessimise_builtins = setting tco_pessimise_builtins options.tco_pessimise_builtins; tco_enable_no_auto_dynamic = setting tco_enable_no_auto_dynamic options.tco_enable_no_auto_dynamic; tco_skip_check_under_dynamic = setting tco_skip_check_under_dynamic options.tco_skip_check_under_dynamic; tco_ifc_enabled = setting tco_ifc_enabled options.tco_ifc_enabled; tco_global_access_check_enabled = setting tco_global_access_check_enabled options.tco_global_access_check_enabled; po_interpret_soft_types_as_like_types = setting po_interpret_soft_types_as_like_types options.po_interpret_soft_types_as_like_types; tco_enable_strict_string_concat_interp = setting tco_enable_strict_string_concat_interp options.tco_enable_strict_string_concat_interp; tco_ignore_unsafe_cast = setting tco_ignore_unsafe_cast options.tco_ignore_unsafe_cast; tco_no_parser_readonly_check = setting tco_no_parser_readonly_check options.tco_no_parser_readonly_check; tco_enable_expression_trees = setting tco_enable_expression_trees options.tco_enable_expression_trees; tco_enable_modules = setting tco_enable_modules options.tco_enable_modules; tco_allowed_expression_tree_visitors = setting tco_allowed_expression_tree_visitors options.tco_allowed_expression_tree_visitors; tco_math_new_code = setting tco_math_new_code options.tco_math_new_code; tco_typeconst_concrete_concrete_error = setting tco_typeconst_concrete_concrete_error options.tco_typeconst_concrete_concrete_error; tco_enable_strict_const_semantics = setting tco_enable_strict_const_semantics options.tco_enable_strict_const_semantics; tco_strict_wellformedness = setting tco_strict_wellformedness options.tco_strict_wellformedness; tco_meth_caller_only_public_visibility = setting tco_meth_caller_only_public_visibility options.tco_meth_caller_only_public_visibility; tco_require_extends_implements_ancestors = setting tco_require_extends_implements_ancestors options.tco_require_extends_implements_ancestors; tco_strict_value_equality = setting tco_strict_value_equality options.tco_strict_value_equality; tco_enforce_sealed_subclasses = setting tco_enforce_sealed_subclasses options.tco_enforce_sealed_subclasses; tco_everything_sdt = setting tco_everything_sdt options.tco_everything_sdt; tco_explicit_consistent_constructors = setting tco_explicit_consistent_constructors options.tco_explicit_consistent_constructors; tco_require_types_class_consts = setting tco_require_types_class_consts options.tco_require_types_class_consts; tco_type_printer_fuel = setting tco_type_printer_fuel options.tco_type_printer_fuel; tco_specify_manifold_api_key = setting tco_specify_manifold_api_key options.tco_specify_manifold_api_key; tco_profile_top_level_definitions = setting tco_profile_top_level_definitions options.tco_profile_top_level_definitions; tco_allow_all_files_for_module_declarations = setting tco_allow_all_files_for_module_declarations options.tco_allow_all_files_for_module_declarations; tco_allowed_files_for_module_declarations = setting tco_allowed_files_for_module_declarations options.tco_allowed_files_for_module_declarations; tco_record_fine_grained_dependencies = setting tco_record_fine_grained_dependencies options.tco_record_fine_grained_dependencies; tco_loop_iteration_upper_bound = setting tco_loop_iteration_upper_bound options.tco_loop_iteration_upper_bound; tco_expression_tree_virtualize_functions = setting tco_expression_tree_virtualize_functions options.tco_expression_tree_virtualize_functions; tco_substitution_mutation = setting tco_substitution_mutation options.tco_substitution_mutation; tco_use_type_alias_heap = setting tco_use_type_alias_heap options.tco_use_type_alias_heap; tco_populate_dead_unsafe_cast_heap = setting tco_populate_dead_unsafe_cast_heap options.tco_populate_dead_unsafe_cast_heap; po_disallow_static_constants_in_default_func_args = setting po_disallow_static_constants_in_default_func_args options.po_disallow_static_constants_in_default_func_args; tco_load_hack_64_distc_saved_state = setting tco_load_hack_64_distc_saved_state options.tco_load_hack_64_distc_saved_state; tco_rust_elab = setting tco_rust_elab options.tco_rust_elab; dump_tast_hashes = setting dump_tast_hashes options.dump_tast_hashes; tco_autocomplete_mode = setting tco_autocomplete_mode options.tco_autocomplete_mode; tco_package_info = setting tco_package_info options.tco_package_info; po_unwrap_concurrent = setting po_unwrap_concurrent options.po_unwrap_concurrent; tco_log_exhaustivity_check = setting tco_log_exhaustivity_check options.tco_log_exhaustivity_check; } let so_naming_sqlite_path t = t.so_naming_sqlite_path let allowed_fixme_codes_strict t = t.allowed_fixme_codes_strict let code_agnostic_fixme t = t.code_agnostic_fixme
OCaml Interface
hhvm/hphp/hack/src/options/globalOptions.mli
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type saved_state_loading = { saved_state_manifold_api_key: string option; (** A string from hh.conf. The API key is used for saved state downloads when we call out to manifold *) log_saved_state_age_and_distance: bool; (** Collects the age of a saved state (in seconds) and distance (in globalrevs) for telemetry *) use_manifold_cython_client: bool; (** Required for Hedwig support for saved state downloads *) } val default_saved_state_loading : saved_state_loading type saved_state = { loading: saved_state_loading; rollouts: Saved_state_rollouts.t; project_metadata_w_flags: bool; } [@@deriving show, eq] val default_saved_state : saved_state val with_saved_state_manifold_api_key : string option -> saved_state -> saved_state val with_use_manifold_cython_client : bool -> saved_state -> saved_state val with_log_saved_state_age_and_distance : bool -> saved_state -> saved_state (** Naming conventions for fieds: - tco_<feature/flag/setting> - type checker option - po_<feature/flag/setting> - parser option - so_<feature/flag/setting> - server option *) type t = { tco_saved_state: saved_state; (* Set of experimental features, in lowercase. *) tco_experimental_features: SSet.t; (* Set of opt-in migration behavior flags, in lowercase. *) tco_migration_flags: SSet.t; (* If set to 0, only the type check delegate's logic will be used. If the delegate fails to type check, the typing check service as a whole will fail. *) tco_num_local_workers: int option; (* If set, typechecker workers will quit after they exceed this limit *) tco_max_typechecker_worker_memory_mb: int option; (* If set, defers class declarations after N lazy declarations; if not set, always lazily declares classes not already in cache. *) tco_defer_class_declaration_threshold: int option; (* Whether the Eden prefetch hook should be invoked *) (* The capacity of the localization cache for large types *) tco_locl_cache_capacity: int; (* The number of nodes a type has to exceed to enter the localization cache *) tco_locl_cache_node_threshold: int; (* Enables the reverse naming table to fall back to SQLite for queries. *) so_naming_sqlite_path: string option; (* Namespace aliasing map *) po_auto_namespace_map: (string * string) list; (* Are we emitting bytecode? *) po_codegen: bool; (* Flag for disabling functions in HHI files with the __PHPStdLib attribute *) po_deregister_php_stdlib: bool; (* Flag to disallow `require`, `require_once` etc as toplevel statements *) po_disallow_toplevel_requires: bool; (* Allows enabling unstable features via the __EnableUnstableFeatures attribute *) po_allow_unstable_features: bool; tco_log_large_fanouts_threshold: int option; (* Print types of size bigger than 1000 after performing a type union. *) tco_log_inference_constraints: bool; (* * Flag to enable logging of statistics regarding use of language features. * Currently used for lambdas. *) tco_language_feature_logging: bool; (* * If non-zero, give up type checking a class or function after this many seconds *) tco_timeout: int; (* * Flag to disallow using values that get casted to array keys at runtime; * like bools, floats, or null; as array keys. *) tco_disallow_invalid_arraykey: bool; (* * Produces an error if an arguments is passed by reference to dynamically * called function [e.g. $foo(&$bar)]. *) tco_disallow_byref_dynamic_calls: bool; (* * Produces an error if an arguments is passed by reference in any form * [e.g. foo(&$bar)]. *) tco_disallow_byref_calls: bool; (* HH_FIXME should silence *any* error, not just the one specified by code *) code_agnostic_fixme: bool; (* Error codes for which we allow HH_FIXMEs in strict mode *) allowed_fixme_codes_strict: ISet.t; (* Initial hh_log_level settings *) log_levels: int SMap.t; (* Flag to disable using lvals as expressions. *) po_disable_lval_as_an_expression: bool; (* Flag to fetch old decls from remote decl store *) tco_remote_old_decls_no_limit: bool; (* Don't limit amount of remote old decls fetched *) tco_fetch_remote_old_decls: bool; (* Populate the member signature heaps. If disabled, instead load lazily from shallow classes. *) tco_populate_member_heaps: bool; (* Skip checks on hierarchy e.g. overrides, require extend, etc. Set to true only for debugging purposes! *) tco_skip_hierarchy_checks: bool; (* Skip checks implemented with TAST visitors. Set to true only for debugging purposes! *) tco_skip_tast_checks: bool; (* Enables like type hints *) tco_like_type_hints: bool; (* Enables union and intersection type hints *) tco_union_intersection_type_hints: bool; (* Enables checking of coeffects *) tco_coeffects: bool; (* Enables checking of coeffects for local operations (not calls) *) tco_coeffects_local: bool; (* Internal (for tests-only): whether any type can appear in a context list * or only types defined in the appropriate Context namespace *) tco_strict_contexts: bool; (* Enables like casts *) tco_like_casts: bool; (* static check xhp required attribute *) tco_check_xhp_attribute: bool; (* Check redundant generics in return types *) tco_check_redundant_generics: bool; (* * Flag to produce an error whenever the TAST contains unresolved type variables *) tco_disallow_unresolved_type_variables: bool; (* * Allows additional error messages to be added to typing errors via config *) tco_custom_error_config: Custom_error_config.t; (* Enable class-level where clauses, i.e. class base<T> where T = int {} *) po_enable_class_level_where_clauses: bool; (* Disable legacy soft typehint syntax (@int) and only allow the __Soft attribute. *) po_disable_legacy_soft_typehints: bool; (* Set of error codes disallowed in decl positions *) po_allowed_decl_fixme_codes: ISet.t; (* Enable @ attribute syntax *) po_allow_new_attribute_syntax: bool; (* Enable const static properties *) tco_const_static_props: bool; (* Disable <<...>> attribute syntax *) po_disable_legacy_attribute_syntax: bool; (* Allow <<__Const>> attribute *) tco_const_attribute: bool; (* Statically check default function arguments *) po_const_default_func_args: bool; (* Statically check default lambda arguments. Subset of default_func_args *) po_const_default_lambda_args: bool; (* Flag to disable the error suppression operator *) po_disallow_silence: bool; (* Static properties can be abstract *) po_abstract_static_props: bool; (* Ignore all errors except those that can influence the shape of syntax tree * (skipping post parse error checks) *) po_parser_errors_only: bool; tco_check_attribute_locations: bool; (* Reponame used for glean connection, default to "www.autocomplete" *) glean_reponame: string; (* Path prefix to use for files relative to the repository root when writing symbol info to JSON *) symbol_write_index_inherited_members: bool; (* Index inherited members information from folded decls *) symbol_write_ownership: bool; (* include fact ownership information, for creating incremental databases. *) symbol_write_root_path: string; (* Path prefix to use for hhi files when writing symbol info to JSON *) symbol_write_hhi_path: string; (* Filepaths to ignore when writing symbol info to JSON, relative to path prefix, eg: root|foo.php *) symbol_write_ignore_paths: string list; (* When set, write indexing data for these filepaths only. Relative to repository root, eg: bar.php for root|bar.php *) symbol_write_index_paths: string list; (* A file which contains a list of Relative_path.t (one per line) to index *) symbol_write_index_paths_file: string option; (* Write the list of Relative_path.t to this file instead of indexing. Useful for sharding *) symbol_write_index_paths_file_output: string option; (* Write symbol indexing data for hhi files *) symbol_write_include_hhi: bool; (* Use symbols hash table for incremental indexing *) symbol_write_sym_hash_in: string option; (* Path to file containing units to exclude *) symbol_write_exclude_out: string option; (* Path to file containing referenced files *) symbol_write_referenced_out: string option; (* Generate symbols hash table *) symbol_write_sym_hash_out: bool; (* Flag to disallow HH\fun and HH\class_meth in constants and constant initializers *) po_disallow_func_ptrs_in_constants: bool; (* Flag to report an error on php style anonymous functions *) tco_error_php_lambdas: bool; (* Flag to error on using discarded nullable awaitables *) tco_disallow_discarded_nullable_awaitables: bool; (* Enable the new style xhp class. * Old style: class :name {} * New style: xhp class name {} *) po_enable_xhp_class_modifier: bool; (* * Flag to disable the old stype xhp element mangling. `<something/>` would otherwise be resolved as `xhp_something` * The new style `xhp class something {}` does not do this style of mangling, thus we need a way to disable it on the * 'lookup side'. *) po_disable_xhp_element_mangling: bool; (* Disable `children (foo|bar+|pcdata)` declarations as they can be implemented without special syntax *) po_disable_xhp_children_declarations: bool; (* Disable HH_IGNORE_ERROR comments, either raising an error if 1 or treating them as normal comments if 2. *) po_disable_hh_ignore_error: int; (* Parse all user attributes rather than only the ones needed for typing *) po_keep_user_attributes: bool; (* Enable features used to typecheck systemlib *) tco_is_systemlib: bool; (* Controls if higher-kinded types are supported *) tco_higher_kinded_types: bool; (* Controls if method-call inference is supported *) tco_method_call_inference: bool; (* If set, then positions derived from reason information are tainted, and primary errors * with such positions are flagged *) tco_report_pos_from_reason: bool; (* Type check this proportion of all files. Default is 1.0. * DO NOT set to any other value except for testing purposes. *) tco_typecheck_sample_rate: float; (* Experimental implementation of a "sound" dynamic type *) tco_enable_sound_dynamic: bool; (* Under sound dynamic, introduce like-types for built-in operations e.g. on Vector. This is done anyway if everything_sdt=true *) tco_pessimise_builtins: bool; (* Allow use of attribute <<__NoAutoDynamic>> *) tco_enable_no_auto_dynamic: bool; (* Skip second check of method under dynamic assumptions *) tco_skip_check_under_dynamic: bool; (* Enable ifc on the specified list of path prefixes (a list containing the empty string would denote all files, an empty list denotes no files) *) tco_ifc_enabled: string list; (* Enable global access checker to check global writes and reads *) tco_global_access_check_enabled: bool; (* <<__Soft>> T -> ~T *) po_interpret_soft_types_as_like_types: bool; (* Restricts string concatenation and interpolation to arraykeys *) tco_enable_strict_string_concat_interp: bool; (* Ignores unsafe_cast and retains the original type of the expression *) tco_ignore_unsafe_cast: bool; (* Disable parser-based readonly checking *) tco_no_parser_readonly_check: bool; (* Enable expression trees via unstable features flag *) tco_enable_expression_trees: bool; (* Enable unstable feature: modules *) tco_enable_modules: bool; (* Allowed expression tree visitors when not enabled via unstable features flag *) tco_allowed_expression_tree_visitors: string list; (* Use a new error code for math operations: addition, subtraction, division, multiplication, exponentiation *) tco_math_new_code: bool; (* Raise an error when a concrete type constant is overridden by a concrete type constant in a child class. *) tco_typeconst_concrete_concrete_error: bool; (* When the value is 1, raises a 4734 error when an inherited constant comes from a conflicting * hierarchy, but not if the constant is locally defined. When the value is 2, raises a conflict * any time two parents declare concrete constants with the same name, matching HHVM * -vEval.TraitConstantInterfaceBehavior=1 *) tco_enable_strict_const_semantics: int; (* Different levels here raise previously missing well-formedness errors (see Typing_type_wellformedness) *) tco_strict_wellformedness: int; (* meth_caller can only reference public methods *) tco_meth_caller_only_public_visibility: bool; (* Consider `require extends` and `require implements` as ancestors when checking a class *) tco_require_extends_implements_ancestors: bool; (* Emit an error when "==" or "!=" is used to compare values that are incompatible types *) tco_strict_value_equality: bool; (* All member of the __Sealed whitelist should be subclasses*) tco_enforce_sealed_subclasses: bool; (* All classes are implcitly marked <<__SupportDynamicType>> *) tco_everything_sdt: bool; (* Raises an error when a classish is declared <<__ConsistentConstruct>> but lacks an * explicit constructor declaration. 0 does not raise, 1 raises for traits, 2 raises * for all classish *) tco_explicit_consistent_constructors: int; (* Raises an error when a class constant is missing a type. 0 does not raise, 1 raises * for abstract class constants, 2 raises for all. *) tco_require_types_class_consts: int; (* Sets the amount of fuel that the type printer can use to display an * individual type. More of a type is printed as the value increases. *) tco_type_printer_fuel: int; (* allows saved_state_loader to shell out to hg to find globalrev and timestamp of revisions *) tco_specify_manifold_api_key: bool; (* Measures and reports the time it takes to typecheck each top-level definition. *) tco_profile_top_level_definitions: bool; tco_allow_all_files_for_module_declarations: bool; tco_allowed_files_for_module_declarations: string list; (* If enabled, the type checker records more fine-grained dependencies than usual, for example between individual methods. *) tco_record_fine_grained_dependencies: bool; (* When set, uses the given number of iterations while typechecking loops *) tco_loop_iteration_upper_bound: int option; (* When enabled, wrap function types in Expression Trees in user defined virtual function types *) tco_expression_tree_virtualize_functions: bool; (* When set, mutates generic entities by substituting type parameters and typechecks the mutated program *) tco_substitution_mutation: bool; tco_use_type_alias_heap: bool; (* Dead UNSAFE_CAST codemod stashes patches through a TAST visitor in shared heap. This is only needed in dead UNSAFE_CAST removal mode. This option controls whether the heap will be populated or not. *) tco_populate_dead_unsafe_cast_heap: bool; po_disallow_static_constants_in_default_func_args: bool; tco_load_hack_64_distc_saved_state: bool; (* Produce variations of methods and functions in TASTs that are cheked under dynamic assumptions. *) (* Use the Rust implementation of naming elaboration and NAST checks. *) tco_rust_elab: bool; dump_tast_hashes: bool; (** Dump tast hashes in /tmp/hh_server/tast_hashes *) tco_autocomplete_mode: bool; (** Are we running in autocomplete mode ? *) tco_package_info: PackageInfo.t; (** Information used to determine which package a module belongs to during typechecking. *) po_unwrap_concurrent: bool; (** Replace concurrent blocks with their bodies in the AST *) tco_log_exhaustivity_check: bool; (** Instrument the existing exhaustivity lint (for strict switch statements) *) } [@@deriving eq, show] val set : ?tco_saved_state:saved_state -> ?po_deregister_php_stdlib:bool -> ?po_disallow_toplevel_requires:bool -> ?tco_log_large_fanouts_threshold:int -> ?tco_log_inference_constraints:bool -> ?tco_experimental_features:SSet.t -> ?tco_migration_flags:SSet.t -> ?tco_num_local_workers:int -> ?tco_max_typechecker_worker_memory_mb:int -> ?tco_defer_class_declaration_threshold:int -> ?tco_locl_cache_capacity:int -> ?tco_locl_cache_node_threshold:int -> ?so_naming_sqlite_path:string -> ?po_auto_namespace_map:(string * string) list -> ?po_codegen:bool -> ?tco_language_feature_logging:bool -> ?tco_timeout:int -> ?tco_disallow_invalid_arraykey:bool -> ?tco_disallow_byref_dynamic_calls:bool -> ?tco_disallow_byref_calls:bool -> ?code_agnostic_fixme:bool -> ?allowed_fixme_codes_strict:ISet.t -> ?log_levels:int SMap.t -> ?po_disable_lval_as_an_expression:bool -> ?tco_remote_old_decls_no_limit:bool -> ?tco_fetch_remote_old_decls:bool -> ?tco_populate_member_heaps:bool -> ?tco_skip_hierarchy_checks:bool -> ?tco_skip_tast_checks:bool -> ?tco_like_type_hints:bool -> ?tco_union_intersection_type_hints:bool -> ?tco_coeffects:bool -> ?tco_coeffects_local:bool -> ?tco_strict_contexts:bool -> ?tco_like_casts:bool -> ?tco_check_xhp_attribute:bool -> ?tco_check_redundant_generics:bool -> ?tco_disallow_unresolved_type_variables:bool -> ?tco_custom_error_config:Custom_error_config.t -> ?po_enable_class_level_where_clauses:bool -> ?po_disable_legacy_soft_typehints:bool -> ?po_allowed_decl_fixme_codes:ISet.t -> ?po_allow_new_attribute_syntax:bool -> ?tco_const_static_props:bool -> ?po_disable_legacy_attribute_syntax:bool -> ?tco_const_attribute:bool -> ?po_const_default_func_args:bool -> ?po_const_default_lambda_args:bool -> ?po_disallow_silence:bool -> ?po_abstract_static_props:bool -> ?po_parser_errors_only:bool -> ?tco_check_attribute_locations:bool -> ?glean_reponame:string -> ?symbol_write_index_inherited_members:bool -> ?symbol_write_ownership:bool -> ?symbol_write_root_path:string -> ?symbol_write_hhi_path:string -> ?symbol_write_ignore_paths:string list -> ?symbol_write_index_paths:string list -> ?symbol_write_index_paths_file:string -> ?symbol_write_index_paths_file_output:string -> ?symbol_write_include_hhi:bool -> ?symbol_write_sym_hash_in:string -> ?symbol_write_exclude_out:string -> ?symbol_write_referenced_out:string -> ?symbol_write_sym_hash_out:bool -> ?po_disallow_func_ptrs_in_constants:bool -> ?tco_error_php_lambdas:bool -> ?tco_disallow_discarded_nullable_awaitables:bool -> ?po_enable_xhp_class_modifier:bool -> ?po_disable_xhp_element_mangling:bool -> ?po_disable_xhp_children_declarations:bool -> ?po_disable_hh_ignore_error:int -> ?po_keep_user_attributes:bool -> ?po_allow_unstable_features:bool -> ?tco_is_systemlib:bool -> ?tco_higher_kinded_types:bool -> ?tco_method_call_inference:bool -> ?tco_report_pos_from_reason:bool -> ?tco_typecheck_sample_rate:float -> ?tco_enable_sound_dynamic:bool -> ?tco_pessimise_builtins:bool -> ?tco_enable_no_auto_dynamic:bool -> ?tco_skip_check_under_dynamic:bool -> ?tco_ifc_enabled:string list -> ?tco_global_access_check_enabled:bool -> ?po_interpret_soft_types_as_like_types:bool -> ?tco_enable_strict_string_concat_interp:bool -> ?tco_ignore_unsafe_cast:bool -> ?tco_no_parser_readonly_check:bool -> ?tco_enable_expression_trees:bool -> ?tco_enable_modules:bool -> ?tco_allowed_expression_tree_visitors:string list -> ?tco_math_new_code:bool -> ?tco_typeconst_concrete_concrete_error:bool -> ?tco_enable_strict_const_semantics:int -> ?tco_strict_wellformedness:int -> ?tco_meth_caller_only_public_visibility:bool -> ?tco_require_extends_implements_ancestors:bool -> ?tco_strict_value_equality:bool -> ?tco_enforce_sealed_subclasses:bool -> ?tco_everything_sdt:bool -> ?tco_explicit_consistent_constructors:int -> ?tco_require_types_class_consts:int -> ?tco_type_printer_fuel:int -> ?tco_specify_manifold_api_key:bool -> ?tco_profile_top_level_definitions:bool -> ?tco_allow_all_files_for_module_declarations:bool -> ?tco_allowed_files_for_module_declarations:string list -> ?tco_record_fine_grained_dependencies:bool -> ?tco_loop_iteration_upper_bound:int option -> ?tco_expression_tree_virtualize_functions:bool -> ?tco_substitution_mutation:bool -> ?tco_use_type_alias_heap:bool -> ?tco_populate_dead_unsafe_cast_heap:bool -> ?po_disallow_static_constants_in_default_func_args:bool -> ?tco_load_hack_64_distc_saved_state:bool -> ?tco_rust_elab:bool -> ?dump_tast_hashes:bool -> ?tco_autocomplete_mode:bool -> ?tco_package_info:PackageInfo.t -> ?po_unwrap_concurrent:bool -> ?tco_log_exhaustivity_check:bool -> t -> t val default : t (* NOTE: set/getters for tco_* options moved to TypecheckerOptions *) (* NOTE: set/getters for po_* options moved to ParserOptions *) val so_naming_sqlite_path : t -> string option val allowed_fixme_codes_strict : t -> ISet.t val code_agnostic_fixme : t -> bool (* NOTE: set/getters for tco_* options moved to TypecheckerOptions *) (* NOTE: set/getters for po_* options moved to ParserOptions *)
OCaml
hhvm/hphp/hack/src/options/parserOptions.ml
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) [@@@warning "-33"] open Hh_prelude [@@@warning "+33"] type t = GlobalOptions.t [@@deriving show] let auto_namespace_map po = po.GlobalOptions.po_auto_namespace_map let with_auto_namespace_map po m = { po with GlobalOptions.po_auto_namespace_map = m } let codegen po = po.GlobalOptions.po_codegen let with_codegen po b = { po with GlobalOptions.po_codegen = b } let deregister_php_stdlib po = po.GlobalOptions.po_deregister_php_stdlib let disallow_toplevel_requires po = po.GlobalOptions.po_disallow_toplevel_requires let default = GlobalOptions.default let const_default_func_args po = po.GlobalOptions.po_const_default_func_args let with_const_default_func_args po b = { po with GlobalOptions.po_const_default_func_args = b } let const_default_lambda_args po = po.GlobalOptions.po_const_default_lambda_args let with_const_default_lambda_args po b = { po with GlobalOptions.po_const_default_lambda_args = b } let with_disable_lval_as_an_expression po b = { po with GlobalOptions.po_disable_lval_as_an_expression = b } let disable_lval_as_an_expression po = po.GlobalOptions.po_disable_lval_as_an_expression let enable_class_level_where_clauses po = po.GlobalOptions.po_enable_class_level_where_clauses let disable_legacy_soft_typehints po = po.GlobalOptions.po_disable_legacy_soft_typehints let with_disable_legacy_soft_typehints po b = { po with GlobalOptions.po_disable_legacy_soft_typehints = b } let allowed_decl_fixme_codes po = po.GlobalOptions.po_allowed_decl_fixme_codes let allow_new_attribute_syntax po = po.GlobalOptions.po_allow_new_attribute_syntax let with_allow_new_attribute_syntax po b = { po with GlobalOptions.po_allow_new_attribute_syntax = b } let disable_legacy_attribute_syntax po = po.GlobalOptions.po_disable_legacy_attribute_syntax let with_disable_legacy_attribute_syntax po b = { po with GlobalOptions.po_disable_legacy_attribute_syntax = b } let disallow_silence po = po.GlobalOptions.po_disallow_silence let const_static_props po = po.GlobalOptions.tco_const_static_props let with_const_static_props po b = { po with GlobalOptions.tco_const_static_props = b } let abstract_static_props po = po.GlobalOptions.po_abstract_static_props let with_abstract_static_props po b = { po with GlobalOptions.po_abstract_static_props = b } let parser_errors_only po = po.GlobalOptions.po_parser_errors_only let with_parser_errors_only po b = { po with GlobalOptions.po_parser_errors_only = b } let disallow_func_ptrs_in_constants po = po.GlobalOptions.po_disallow_func_ptrs_in_constants let with_disallow_func_ptrs_in_constants po b = { po with GlobalOptions.po_disallow_func_ptrs_in_constants = b } let disable_xhp_element_mangling po = po.GlobalOptions.po_disable_xhp_element_mangling let with_disable_xhp_element_mangling po b = { po with GlobalOptions.po_disable_xhp_element_mangling = b } let with_keep_user_attributes po b = { po with GlobalOptions.po_keep_user_attributes = b } let allow_unstable_features po = po.GlobalOptions.po_allow_unstable_features let with_allow_unstable_features po b = { po with GlobalOptions.po_allow_unstable_features = b } let disable_xhp_children_declarations po = po.GlobalOptions.po_disable_xhp_children_declarations let with_disable_xhp_children_declarations po b = { po with GlobalOptions.po_disable_xhp_children_declarations = b } let enable_xhp_class_modifier po = po.GlobalOptions.po_enable_xhp_class_modifier let with_enable_xhp_class_modifier po b = { po with GlobalOptions.po_enable_xhp_class_modifier = b } let disable_hh_ignore_error po = po.GlobalOptions.po_disable_hh_ignore_error let interpret_soft_types_as_like_types po = po.GlobalOptions.po_interpret_soft_types_as_like_types let with_interpret_soft_types_as_like_types po b = { po with GlobalOptions.po_interpret_soft_types_as_like_types = b } let with_everything_sdt po b = { po with GlobalOptions.tco_everything_sdt = b } let with_disallow_static_constants_in_default_func_args po b = { po with GlobalOptions.po_disallow_static_constants_in_default_func_args = b; } let make ~auto_namespace_map ~codegen ~disable_lval_as_an_expression ~enable_class_level_where_clauses ~disable_legacy_soft_typehints ~allow_new_attribute_syntax ~disable_legacy_attribute_syntax ~const_default_func_args ~const_default_lambda_args ~disallow_silence ~const_static_props ~abstract_static_props ~disallow_func_ptrs_in_constants ~enable_xhp_class_modifier ~disable_xhp_element_mangling ~allow_unstable_features ~disable_xhp_children_declarations ~disable_hh_ignore_error ~interpret_soft_types_as_like_types ~is_systemlib = GlobalOptions. { default with po_auto_namespace_map = auto_namespace_map; po_codegen = codegen; po_disable_lval_as_an_expression = disable_lval_as_an_expression; po_enable_class_level_where_clauses = enable_class_level_where_clauses; po_disable_legacy_soft_typehints = disable_legacy_soft_typehints; po_allow_new_attribute_syntax = allow_new_attribute_syntax; po_disable_legacy_attribute_syntax = disable_legacy_attribute_syntax; po_const_default_func_args = const_default_func_args; po_const_default_lambda_args = const_default_lambda_args; po_disallow_silence = disallow_silence; tco_const_static_props = const_static_props; po_abstract_static_props = abstract_static_props; po_disallow_func_ptrs_in_constants = disallow_func_ptrs_in_constants; po_enable_xhp_class_modifier = enable_xhp_class_modifier; po_disable_xhp_element_mangling = disable_xhp_element_mangling; po_allow_unstable_features = allow_unstable_features; po_disable_xhp_children_declarations = disable_xhp_children_declarations; po_disable_hh_ignore_error = disable_hh_ignore_error; po_interpret_soft_types_as_like_types = interpret_soft_types_as_like_types; tco_is_systemlib = is_systemlib; } (* Changes here need to be synchronized with rust_parser_errors_ffi.rs *) type ffi_t = bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool * bool let to_rust_ffi_t po ~hhvm_compat_mode ~hhi_mode ~codegen = ( hhvm_compat_mode, hhi_mode, codegen, disable_lval_as_an_expression po, disable_legacy_soft_typehints po, const_static_props po, disable_legacy_attribute_syntax po, const_default_func_args po, abstract_static_props po, disallow_func_ptrs_in_constants po, enable_xhp_class_modifier po, disable_xhp_element_mangling po, disable_xhp_children_declarations po, const_default_lambda_args po, allow_unstable_features po, interpret_soft_types_as_like_types po, po.GlobalOptions.tco_is_systemlib, po.GlobalOptions.po_disallow_static_constants_in_default_func_args )
OCaml
hhvm/hphp/hack/src/options/saved_state_rollouts.ml
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = { dummy_one: bool; dummy_two: bool; dummy_three: bool; no_ancestor_edges: bool; (** Whether the depgraph contains the transitive closure of extends edges. *) } [@@deriving eq, show] (* The names of these should be exactly the capitalized flag names. For example for a flag named my_flag use the enum value My_flag *) type flag = | Dummy_one | Dummy_two | Dummy_three | No_ancestor_edges [@@deriving show { with_path = false }] type flag_name = string (** This module allows to handle the config flag 'ss_force', which can have the following values: 'prod' or 'candidate' or 'prod_with_flag_on:my_flag_name' where 'my_flag_name' is a saved state flag from this module. This is useful to force using (or creating) the production or candidate saved state, or for using/creating an alternative candidate saved state (with 'prod_with_flag_on:my_flag_name') *) module ForcedFlags : sig (** Type to represent the possible values of config flag 'ss_force' *) type t (** Parse value of config flag 'ss_force' *) val parse : force_flag_value:string option -> t option (** Return the forced value of the current rollout flag, if any. Returning None means there is no forcing. *) val rollout_flag_value : t option -> bool option (** Whether a specific flag is forced to be on. *) val is_forced : flag_name -> t option -> bool end = struct type additional_forced_flag = flag_name option type t = | Prod of additional_forced_flag | Candidate let force_flag_name : flag_name = "ss_force" let parse ~(force_flag_value : string option) : t option = Option.bind force_flag_value ~f:(function | "production" | "prod" -> Some (Prod None) | "candidate" -> Some Candidate | forced -> let invalid () = Hh_logger.warn "Invalid value for flag %s: %s" force_flag_name forced; None in (match String.split forced ~on:':' with | [forced; forced_flag] -> (match forced with | "prod_with_flag_on" | "production_with_flag_on" -> Some (Prod (Some forced_flag)) | _ -> invalid ()) | _ -> invalid ())) let rollout_flag_value (force : t option) : bool option = Option.map force ~f:(function | Prod _ -> false | Candidate -> true) let is_forced (flag_name : flag_name) (force : t option) : bool = match force with | Some (Prod (Some forced)) -> String.equal forced flag_name | _ -> false end let flag_name flag = String.lowercase (show_flag flag) (* We need to guarantee that for all flag combinations, there is an available saved state corresponding to that combination. There are however an exponential number of flag combinations: 2^n where n is the total number of flags. What follows allows restricting the number of possible combinations per www revision to just two (one for the production saved state, one for the candidate saved state), by allowing only one flag to be rolled out at a time (per www revision). We do so by specifying a rollout order for the flags, in this function. Just like at the butcher, where each customer takes a ticket with a number to enter the queue, each new flag gets assigned a number by the developer adding the flag below. Then for each www revision, .hhconfig specifies which flag can be rolled out for that revision, using the following flag: current_saved_state_rollout_flag_index = N That flag is the equivalent of the counter at the butcher calling customers to be served. It means that for all www revisions with this value N in .hhconfig, only the flag assigned number N will get its value from JustKnob, while the other flags' values are determined by their order: * flags whose order is lower than the current flag index are considered to have been already rolled out and therefore have their values set to true, * flags whose order is greater are yet to be rollout and therefore have their values set to false. *) let rollout_order = (* This needs to be specified manually instead of using ppx_enum because we want the indices to stay consistent when we remove flags. When adding a flag here, do follow these two rules: * The chosen number should be different from than any other assigned number. * The chosen number should be greater than the current value for current_saved_state_rollout_flag_index in .hhconfig. It's ok to reassign numbers to flags that haven't yet been rolled out if you want your new flag to be rolled out first. *) function | Dummy_one -> 0 | Dummy_two -> 1 | Dummy_three -> 2 | No_ancestor_edges -> 3 let make ~current_rolled_out_flag_idx ~(deactivate_saved_state_rollout : bool) ~(get_default : flag_name -> bool) ~(force_flag_value : string option) = let force_prod_or_candidate = ForcedFlags.parse ~force_flag_value in let get_flag_value flag = let i = rollout_order flag in let flag_name = flag_name flag in if Int.equal current_rolled_out_flag_idx i then ForcedFlags.rollout_flag_value force_prod_or_candidate |> Option.value ~default: ((not deactivate_saved_state_rollout) && get_default flag_name) else if Int.(current_rolled_out_flag_idx < i) then (* This flag will be rolled out next, so return false unless forced. *) ForcedFlags.is_forced flag_name force_prod_or_candidate else (* This flag has already been rolled out *) true in { dummy_one = get_flag_value Dummy_one; dummy_two = get_flag_value Dummy_two; dummy_three = get_flag_value Dummy_three; no_ancestor_edges = get_flag_value No_ancestor_edges; } let default : t = make ~current_rolled_out_flag_idx:Int.min_value ~deactivate_saved_state_rollout:false ~get_default:(fun _ -> false) ~force_flag_value:None let output t = let print_flag flag value = Printf.eprintf "%s = %b\n" (flag_name flag) value in let { dummy_one; dummy_two; dummy_three; no_ancestor_edges } = t in print_flag Dummy_one dummy_one; print_flag Dummy_two dummy_two; print_flag Dummy_three dummy_three; print_flag No_ancestor_edges no_ancestor_edges; () let to_bit_array_string t : string = let s : bool -> string = function | true -> "1" | false -> "0" in let { dummy_one; dummy_two; dummy_three; no_ancestor_edges } = t in s dummy_one ^ s dummy_two ^ s dummy_three ^ s no_ancestor_edges
OCaml Interface
hhvm/hphp/hack/src/options/saved_state_rollouts.mli
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type flag_name = string type t = { dummy_one: bool; (** Some documentation for dummy_one *) dummy_two: bool; (** Some documentation for dummy_two *) dummy_three: bool; (** Some documentation for dummy_three *) no_ancestor_edges: bool; (** Whether the depgraph contains the transitive closure of extends edges. *) } [@@deriving eq, show] val default : t val make : current_rolled_out_flag_idx:int -> deactivate_saved_state_rollout:bool -> get_default:(flag_name -> bool) -> force_flag_value:string option -> t val output : t -> unit val to_bit_array_string : t -> string
OCaml
hhvm/hphp/hack/src/options/symbolWriteOptions.ml
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) [@@@warning "-33"] open Hh_prelude [@@@warning "+33"] type t = GlobalOptions.t [@@deriving show] let root_path t = t.GlobalOptions.symbol_write_root_path let hhi_path t = t.GlobalOptions.symbol_write_hhi_path let ignore_paths t = t.GlobalOptions.symbol_write_ignore_paths let index_paths t = t.GlobalOptions.symbol_write_index_paths let include_hhi t = t.GlobalOptions.symbol_write_include_hhi let inherited_members t = t.GlobalOptions.symbol_write_index_inherited_members let ownership t = t.GlobalOptions.symbol_write_ownership let sym_hash_in t = t.GlobalOptions.symbol_write_sym_hash_in let sym_exclude_out t = t.GlobalOptions.symbol_write_exclude_out let referenced_out t = t.GlobalOptions.symbol_write_referenced_out let sym_hash_out t = t.GlobalOptions.symbol_write_sym_hash_out let default = GlobalOptions.default
OCaml
hhvm/hphp/hack/src/options/typecheckerOptions.ml
(* * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = GlobalOptions.t [@@deriving eq, show] let num_local_workers t = t.GlobalOptions.tco_num_local_workers let max_typechecker_worker_memory_mb t = t.GlobalOptions.tco_max_typechecker_worker_memory_mb let defer_class_declaration_threshold t = t.GlobalOptions.tco_defer_class_declaration_threshold let language_feature_logging t = t.GlobalOptions.tco_language_feature_logging let experimental_feature_enabled t feature = SSet.mem feature t.GlobalOptions.tco_experimental_features let migration_flag_enabled t flag = SSet.mem flag t.GlobalOptions.tco_migration_flags let log_inference_constraints t = t.GlobalOptions.tco_log_inference_constraints let default = GlobalOptions.default (* TYPECHECKER-SPECIFIC OPTIONS *) (** * Insist on instantiations for all generic types, even in non-strict files *) let experimental_generics_arity = "generics_arity" (** * Forbid casting nullable values, since they have unexpected semantics. For * example, casting `null` to an int results in `0`, which may or may not be * what you were expecting. *) let experimental_forbid_nullable_cast = "forbid_nullable_cast" (* * Allow typechecker to do global inference and infer IFC flows * with the <<InferFlows>> flag *) let experimental_infer_flows = "ifc_infer_flows" (* * Disallow static memoized functions in non-final classes *) let experimental_disallow_static_memoized = "disallow_static_memoized" (** * Enable abstract const type with default syntax, i.e. * abstract const type T as num = int; *) let experimental_abstract_type_const_with_default = "abstract_type_const_with_default" let experimental_supportdynamic_type_hint = "supportdynamic_type_hint" let experimental_always_pessimise_return = "always_pessimise_return" let experimental_consider_type_const_enforceable = "experimental_consider_type_const_enforceable" let experimental_all = List.fold_right ~f:SSet.add ~init:SSet.empty [ experimental_generics_arity; experimental_forbid_nullable_cast; experimental_disallow_static_memoized; experimental_abstract_type_const_with_default; experimental_infer_flows; experimental_supportdynamic_type_hint; experimental_always_pessimise_return; experimental_consider_type_const_enforceable; ] let experimental_from_flags ~disallow_static_memoized = if disallow_static_memoized then SSet.singleton experimental_disallow_static_memoized else SSet.empty let enable_experimental t feature = SSet.add feature t.GlobalOptions.tco_experimental_features let migration_flags_all = List.fold_right ~init:SSet.empty ~f:SSet.add [] let timeout t = t.GlobalOptions.tco_timeout let disallow_invalid_arraykey t = t.GlobalOptions.tco_disallow_invalid_arraykey let disallow_byref_dynamic_calls t = t.GlobalOptions.tco_disallow_byref_dynamic_calls let disallow_byref_calls t = t.GlobalOptions.tco_disallow_byref_calls let log_levels t = t.GlobalOptions.log_levels let remote_old_decls_no_limit t = t.GlobalOptions.tco_remote_old_decls_no_limit let fetch_remote_old_decls t = t.GlobalOptions.tco_fetch_remote_old_decls let populate_member_heaps t = t.GlobalOptions.tco_populate_member_heaps let skip_hierarchy_checks t = t.GlobalOptions.tco_skip_hierarchy_checks let skip_tast_checks t = t.GlobalOptions.tco_skip_tast_checks let call_coeffects t = t.GlobalOptions.tco_coeffects let local_coeffects t = t.GlobalOptions.tco_coeffects_local let any_coeffects t = call_coeffects t || local_coeffects t let strict_contexts t = t.GlobalOptions.tco_strict_contexts (* Fully enable IFC on the tcopt *) let enable_ifc t = GlobalOptions.{ t with tco_ifc_enabled = ["/"] } let ifc_enabled t = t.GlobalOptions.tco_ifc_enabled let enable_global_access_check t = GlobalOptions.{ t with tco_global_access_check_enabled = true } let global_access_check_enabled t = t.GlobalOptions.tco_global_access_check_enabled let like_type_hints t = t.GlobalOptions.tco_like_type_hints let like_casts t = t.GlobalOptions.tco_like_casts let check_xhp_attribute t = t.GlobalOptions.tco_check_xhp_attribute let check_redundant_generics t = t.GlobalOptions.tco_check_redundant_generics let disallow_unresolved_type_variables t = t.GlobalOptions.tco_disallow_unresolved_type_variables let custom_error_config t = t.GlobalOptions.tco_custom_error_config let const_static_props t = t.GlobalOptions.tco_const_static_props let const_attribute t = t.GlobalOptions.tco_const_attribute let check_attribute_locations t = t.GlobalOptions.tco_check_attribute_locations let error_php_lambdas t = t.GlobalOptions.tco_error_php_lambdas let disallow_discarded_nullable_awaitables t = t.GlobalOptions.tco_disallow_discarded_nullable_awaitables let is_systemlib t = t.GlobalOptions.tco_is_systemlib let higher_kinded_types t = t.GlobalOptions.tco_higher_kinded_types let method_call_inference t = t.GlobalOptions.tco_method_call_inference let report_pos_from_reason t = t.GlobalOptions.tco_report_pos_from_reason let enable_sound_dynamic t = t.GlobalOptions.tco_enable_sound_dynamic let enable_no_auto_dynamic t = t.GlobalOptions.tco_enable_no_auto_dynamic let skip_check_under_dynamic t = t.GlobalOptions.tco_skip_check_under_dynamic let interpret_soft_types_as_like_types t = t.GlobalOptions.po_interpret_soft_types_as_like_types let enable_strict_string_concat_interp t = t.GlobalOptions.tco_enable_strict_string_concat_interp let ignore_unsafe_cast t = t.GlobalOptions.tco_ignore_unsafe_cast let set_tco_no_parser_readonly_check t b = GlobalOptions.{ t with tco_no_parser_readonly_check = b } let tco_no_parser_readonly_check t = t.GlobalOptions.tco_no_parser_readonly_check let set_tco_enable_expression_trees t b = GlobalOptions.{ t with tco_enable_expression_trees = b } let expression_trees_enabled t = t.GlobalOptions.tco_enable_expression_trees let enable_modules t = t.GlobalOptions.tco_enable_modules let set_modules t b = GlobalOptions.{ t with tco_enable_modules = b } let allowed_expression_tree_visitors t = t.GlobalOptions.tco_allowed_expression_tree_visitors let math_new_code t = t.GlobalOptions.tco_math_new_code let typeconst_concrete_concrete_error t = t.GlobalOptions.tco_typeconst_concrete_concrete_error let enable_strict_const_semantics t = t.GlobalOptions.tco_enable_strict_const_semantics let strict_wellformedness t = t.GlobalOptions.tco_strict_wellformedness let meth_caller_only_public_visibility t = t.GlobalOptions.tco_meth_caller_only_public_visibility let require_extends_implements_ancestors t = t.GlobalOptions.tco_require_extends_implements_ancestors let strict_value_equality t = t.GlobalOptions.tco_strict_value_equality let enforce_sealed_subclasses t = t.GlobalOptions.tco_enforce_sealed_subclasses let everything_sdt t = t.GlobalOptions.tco_everything_sdt let pessimise_builtins t = enable_sound_dynamic t && (everything_sdt t || t.GlobalOptions.tco_pessimise_builtins) let explicit_consistent_constructors t = t.GlobalOptions.tco_explicit_consistent_constructors let require_types_class_consts t = t.GlobalOptions.tco_require_types_class_consts let type_printer_fuel t = t.GlobalOptions.tco_type_printer_fuel let log_saved_state_age_and_distance t = GlobalOptions.(t.tco_saved_state.loading.log_saved_state_age_and_distance) let specify_manifold_api_key t = t.GlobalOptions.tco_specify_manifold_api_key let saved_state t = t.GlobalOptions.tco_saved_state let saved_state_loading t = GlobalOptions.(t.tco_saved_state.loading) let saved_state_rollouts t = GlobalOptions.(t.tco_saved_state.rollouts) let dummy_one t = GlobalOptions.(t.tco_saved_state.rollouts).Saved_state_rollouts.dummy_one let profile_top_level_definitions t = t.GlobalOptions.tco_profile_top_level_definitions let allow_all_files_for_module_declarations t = t.GlobalOptions.tco_allow_all_files_for_module_declarations let allowed_files_for_module_declarations t = t.GlobalOptions.tco_allowed_files_for_module_declarations let record_fine_grained_dependencies t = t.GlobalOptions.tco_record_fine_grained_dependencies let loop_iteration_upper_bound t = t.GlobalOptions.tco_loop_iteration_upper_bound let typecheck_sample_rate t = t.GlobalOptions.tco_typecheck_sample_rate let log_fanout t ~fanout_cardinal = match t.GlobalOptions.tco_log_large_fanouts_threshold with | None -> false | Some threshold -> Int.(fanout_cardinal >= threshold) let substitution_mutation t = t.GlobalOptions.tco_substitution_mutation let use_type_alias_heap t = t.GlobalOptions.tco_use_type_alias_heap let populate_dead_unsafe_cast_heap t = t.GlobalOptions.tco_populate_dead_unsafe_cast_heap let load_hack_64_distc_saved_state t = t.GlobalOptions.tco_load_hack_64_distc_saved_state let rust_elab t = t.GlobalOptions.tco_rust_elab let locl_cache_capacity t = t.GlobalOptions.tco_locl_cache_capacity let locl_cache_node_threshold t = t.GlobalOptions.tco_locl_cache_node_threshold let dump_tast_hashes t = t.GlobalOptions.dump_tast_hashes let tco_autocomplete_mode t = t.GlobalOptions.tco_autocomplete_mode let set_tco_autocomplete_mode t = { t with GlobalOptions.tco_autocomplete_mode = true } let package_info t = t.GlobalOptions.tco_package_info let tco_log_exhaustivity_check t = t.GlobalOptions.tco_log_exhaustivity_check
TOML
hhvm/hphp/hack/src/oxidized/Cargo.toml
# @generated by autocargo [package] name = "oxidized" version = "0.0.0" edition = "2021" [lib] path = "lib.rs" [dependencies] anyhow = "1.0.71" arena_deserializer = { version = "0.0.0", path = "../utils/arena_deserializer" } arena_trait = { version = "0.0.0", path = "../arena_trait" } bitflags = "1.3" bstr = { version = "1.4.0", features = ["serde", "std", "unicode"] } bumpalo = { version = "3.11.1", features = ["collections"] } eq_modulo_pos = { version = "0.0.0", path = "../utils/eq_modulo_pos" } file_info = { version = "0.0.0", path = "../deps/rust/file_info" } hash = { version = "0.0.0", path = "../utils/hash" } hh24_types = { version = "0.0.0", path = "../utils/hh24_types" } hh_autoimport_rust = { version = "0.0.0", path = "../parser/cargo/hh_autoimport" } hh_hash = { version = "0.0.0", path = "../utils/hh_hash" } itertools = "0.10.3" naming_types = { version = "0.0.0", path = "../naming/rust/naming_types" } no_pos_hash = { version = "0.0.0", path = "../utils/no_pos_hash" } ocamlrep = { version = "0.1.0", git = "https://github.com/facebook/ocamlrep/", branch = "main" } parser_core_types = { version = "0.0.0", path = "../parser/cargo/core_types" } rc_pos = { version = "0.0.0", path = "../utils/rust/pos" } relative_path = { version = "0.0.0", path = "../utils/rust/relative_path" } rust_to_ocaml_attr = { version = "0.0.0", path = "../rust_to_ocaml/rust_to_ocaml_attr" } serde = { version = "1.0.176", features = ["derive", "rc"] } serde_json = { version = "1.0.100", features = ["float_roundtrip", "unbounded_depth"] } thiserror = "1.0.43" [dev-dependencies] pretty_assertions = { version = "1.2", features = ["alloc"], default-features = false }
Text
hhvm/hphp/hack/src/oxidized/copy_types.txt
aast_defs::Abstraction aast_defs::ConstraintKind aast_defs::EmitId aast_defs::EnvAnnot aast_defs::FuncReactive aast_defs::FunKind aast_defs::ImportFlavor aast_defs::KvcKind aast_defs::NsKind aast_defs::OgNullFlavor aast_defs::ParamMutability aast_defs::PropOrMethod aast_defs::ReadonlyKind aast_defs::ReifyKind aast_defs::RequireKind aast_defs::Tprim aast_defs::TypedefVisibility aast_defs::Uop aast_defs::Variance aast_defs::VcKind aast_defs::Visibility aast_defs::XhpAttrTag aast_defs::XhpChildOp aast::Abstraction aast::ConstraintKind aast::EmitId aast::EnvAnnot aast::FuncReactive aast::FunKind aast::ImportFlavor aast::KvcKind aast::NsKind aast::OgNullFlavor aast::ParamMutability aast::PropOrMethod aast::ReadonlyKind aast::ReifyKind aast::RequireKind aast::TypedefVisibility aast::Uop aast::Variance aast::VcKind aast::Visibility aast::XhpAttrTag aast::XhpChildOp ast_defs::Abstraction ast_defs::ClassishKind ast_defs::ConstraintKind ast_defs::FunKind ast_defs::OgNullFlavor ast_defs::PropOrMethod ast_defs::ReadonlyKind ast_defs::ReifyKind ast_defs::Tprim ast_defs::TypedefVisibility ast_defs::Uop ast_defs::Variance ast_defs::Visibility decl_defs::SourceType error_codes::Init error_codes::Naming error_codes::NastCheck error_codes::Parsing error_codes::Typing error_codes::GlobalAccessCheck errors::ErrorCode errors::Format errors::NameContext errors::Phase errors::NamingError errors::NastCheckError nast_check_error::Verb naming_error::Visibility naming_error::ReturnOnlyHint naming_error::UnsupportedFeature name_context::NameContext package::PackageRelationship patt_binding_ty::PattBindingTy patt_locl_ty::Prim patt_error::Primary patt_error::Callback patt_error::ReasonsCallback file_info::Mode file_info::NameType map_reduce_ffi::MapReducer naming_types::KindOfType naming_types::NameKind saved_state_rollouts::Flag search_types::SiKind search_types::AutocompleteType search_types::SiComplete tast::CheckStatus type_counter::Category type_counter::LoggedType typing_defs::ClassConstKind typing_defs_core::ConsistentKind typing_defs_core::DestructureKind typing_defs_core::Enforcement typing_defs_core::FunTparamsKind typing_defs_core::ParamMode typing_defs_core::ShapeKind typing_defs_core::ValKind typing_reason::ArgPosition typing_reason::BlameSource user_error::Severity xhp_attribute::Tag xhp_attribute::XhpAttribute
Rust
hhvm/hphp/hack/src/oxidized/lib.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. #![feature(box_patterns)] #![feature(drain_filter)] #[macro_use] extern crate rust_to_ocaml_attr; pub use file_info; pub use file_info::prim_defs; pub use naming_types; pub use pos::file_pos; pub use pos::file_pos_large; pub use pos::file_pos_small; pub use pos::pos_span_raw; pub use pos::pos_span_tiny; pub use rc_pos as pos; mod manual; pub use manual::aast; pub use manual::aast_defs_impl; pub use manual::aast_impl; pub use manual::ast_defs_impl; pub use manual::custom_error_config_impl; pub use manual::direct_decl_parser; pub use manual::global_options_impl; pub use manual::i_map; pub use manual::i_set; pub use manual::ident; pub use manual::internal_type_set; pub use manual::lazy; pub use manual::local_id; pub use manual::local_id_map::LocalIdMap; pub use manual::method_flags; pub use manual::namespace_env_impl; pub use manual::prop_flags; pub use manual::s_map; pub use manual::s_set; pub use manual::saved_state_rollouts_impl; pub use manual::scoured_comments_impl; pub use manual::shallow_decl_defs_impl; pub use manual::shape_map; pub use manual::symbol_name; pub use manual::t_shape_map; pub use manual::tany_sentinel; pub use manual::typing_defs_flags; pub use manual::typing_env; pub use manual::typing_logic; pub use manual::typing_reason_impl; pub use manual::typing_set; mod stubs; pub use stubs::opaque_digest; mod impl_gen; pub use impl_gen::*; pub mod aast_visitor; mod asts; pub use asts::ast; pub use asts::nast; mod gen; pub use gen::aast_defs; pub use gen::ast_defs; pub use gen::custom_error; pub use gen::custom_error_config; pub use gen::decl_defs; pub use gen::decl_parser_options; pub use gen::decl_reference; pub use gen::error_codes; pub use gen::error_message; pub use gen::errors; pub use gen::full_fidelity_parser_env; pub use gen::global_options; pub use gen::map_reduce_ffi; pub use gen::message; pub use gen::name_context; pub use gen::namespace_env; pub use gen::naming_error; pub use gen::naming_phase_error; pub use gen::nast_check_error; pub use gen::package; pub use gen::package_info; pub use gen::parser_options; pub use gen::parsing_error; pub use gen::patt_binding_ty; pub use gen::patt_error; pub use gen::patt_locl_ty; pub use gen::patt_name; pub use gen::patt_string; pub use gen::patt_var; pub use gen::pos_or_decl; pub use gen::quickfix; pub use gen::saved_state_rollouts; pub use gen::scoured_comments; pub use gen::search_types; pub use gen::shallow_decl_defs; pub use gen::tast; pub use gen::tast_hashes; pub use gen::tast_with_dynamic; pub use gen::type_counter; pub use gen::type_parameter_env; pub use gen::typechecker_options; pub use gen::typing_defs; pub use gen::typing_defs_core; pub use gen::typing_inference_env; pub use gen::typing_kinding_defs; pub use gen::typing_reason; pub use gen::typing_tyvar_occurrences; pub use gen::user_error; pub use gen::validation_err; pub use gen::xhp_attribute;
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/mod.rs
// Copyright (c) 2019, Facebook, Inc. // All rights reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod node; mod node_impl; mod node_impl_gen; mod node_mut; mod node_mut_impl_gen; mod type_params; mod visitor; mod visitor_mut; pub use node::Node; pub use node_mut::NodeMut; pub use type_params::Params; pub use type_params_defaults::AstParams; pub use visitor::visit; pub use visitor::Visitor; pub use visitor_mut::visit as visit_mut; pub use visitor_mut::VisitorMut; mod type_params_defaults { pub struct P<Context, Error, Ex, En>(std::marker::PhantomData<(Context, Error, Ex, En)>); impl<C, E, Ex, En> super::type_params::Params for P<C, E, Ex, En> { type Context = C; type Error = E; type Ex = Ex; type En = En; } pub type AstParams<Context, Error> = P<Context, Error, (), ()>; } #[cfg(test)] mod tests { use node::Node; use node_mut::NodeMut; use pretty_assertions::assert_eq; use visitor::Visitor; use visitor_mut::VisitorMut; use super::*; use crate::aast::*; #[test] fn simple() { impl<'ast> Visitor<'ast> for usize { type Params = type_params_defaults::P<(), (), (), ()>; fn object(&mut self) -> &mut dyn Visitor<'ast, Params = Self::Params> { self } fn visit_expr(&mut self, c: &mut (), p: &Expr<(), ()>) -> Result<(), ()> { *self += 1; p.recurse(c, self) } } let expr = Expr((), crate::pos::Pos::NONE, Expr_::Null); let mut v: usize = 0; v.visit_expr(&mut (), &expr).unwrap(); assert_eq!(v, 1); let mut v: usize = 0; visitor::visit(&mut v, &mut (), &expr).unwrap(); assert_eq!(v, 1); } #[test] fn simple_mut() { impl<'ast> VisitorMut<'ast> for () { type Params = type_params_defaults::P<(), (), (), ()>; fn object(&mut self) -> &mut dyn VisitorMut<'ast, Params = Self::Params> { self } fn visit_expr_(&mut self, c: &mut (), p: &mut Expr_<(), ()>) -> Result<(), ()> { *p = Expr_::Null; p.recurse(c, self) } } let mut expr = Expr((), crate::pos::Pos::NONE, Expr_::True); let mut v = (); v.visit_expr(&mut (), &mut expr).unwrap(); match expr.2 { Expr_::Null => {} e => panic!("Expect Expr_::Null, but got {:?}", e), } let mut expr = Expr((), crate::pos::Pos::NONE, Expr_::True); let mut v = (); visitor_mut::visit(&mut v, &mut (), &mut expr).unwrap(); match expr.2 { Expr_::Null => {} e => panic!("Expect Expr_::Null, but got {:?}", e), } } #[test] fn local_map_id() { use std::collections::BTreeMap; use crate::aast::*; use crate::local_id::LocalId; use crate::LocalIdMap; impl<'ast> Visitor<'ast> for u8 { type Params = type_params_defaults::P<(), (), u8, ()>; fn object(&mut self) -> &mut dyn Visitor<'ast, Params = Self::Params> { self } fn visit_ex( &mut self, _: &mut (), p: &u8, ) -> Result<(), <Self::Params as Params>::Error> { Ok(*self += p) } } let mut map: BTreeMap<LocalId, (Pos, u8)> = BTreeMap::new(); map.insert((0, "".into()), (Pos::NONE, 1)); map.insert((1, "".into()), (Pos::NONE, 3)); map.insert((2, "".into()), (Pos::NONE, 5)); let stmt_ = Stmt_::AssertEnv(Box::new((EnvAnnot::Join, LocalIdMap(map)))); let mut s = 0u8; visitor::visit(&mut s, &mut (), &stmt_).unwrap(); assert_eq!(9, s); } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/node.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<564a20aaccfb840fa9b957b355382b86>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_variables)] use super::type_params::Params; use super::visitor::Visitor; pub trait Node<P: Params> { fn accept<'node>( &'node self, ctx: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.recurse(ctx, v) } fn recurse<'node>( &'node self, ctx: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(()) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/node_impl.rs
// Copyright (c) 2019, Facebook, Inc. // All rights reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::collections::BTreeMap; use std::sync::Arc; use itertools::Either; use super::node::Node; use super::node_mut::NodeMut; use super::type_params::Params; use super::visitor::Visitor; use super::visitor_mut::VisitorMut; use crate::pos::Pos; macro_rules! leaf_node { ($ty:ty) => { impl<P: Params> Node<P> for $ty {} impl<P: Params> NodeMut<P> for $ty {} }; } leaf_node!(bool); leaf_node!(isize); leaf_node!(String); leaf_node!(bstr::BString); leaf_node!(crate::pos::Pos); leaf_node!(crate::file_info::Mode); leaf_node!(crate::namespace_env::Env); impl<P: Params, T> Node<P> for &T where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { (*self).accept(c, v) } } impl<P: Params, T> NodeMut<P> for &mut T where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { (*self).accept(c, v) } } impl<P: Params, L, R> Node<P> for Either<L, R> where L: Node<P>, R: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Either::Left(i) => i.accept(c, v), Either::Right(i) => i.accept(c, v), } } } impl<P: Params, L, R> NodeMut<P> for Either<L, R> where L: NodeMut<P>, R: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Either::Left(i) => i.accept(c, v), Either::Right(i) => i.accept(c, v), } } } impl<P: Params, T> Node<P> for &[T] where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for i in *self { i.accept(c, v)?; }) } } impl<P: Params, T> Node<P> for Vec<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for i in self { i.accept(c, v)?; }) } } impl<P: Params, T> NodeMut<P> for Vec<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for i in self { i.accept(c, v)?; }) } } impl<P: Params, T> Node<P> for Option<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(match self { Some(t) => t.accept(c, v)?, _ => {} }) } } impl<P: Params, T> NodeMut<P> for Option<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(match self { Some(t) => t.accept(c, v)?, _ => {} }) } } impl<P: Params, T> Node<P> for crate::lazy::Lazy<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params, T> NodeMut<P> for crate::lazy::Lazy<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params, K, V> Node<P> for BTreeMap<K, V> where V: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for value in self.values() { value.accept(c, v)?; }) } } impl<P: Params, K, V> NodeMut<P> for BTreeMap<K, V> where V: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for value in self.values_mut() { value.accept(c, v)?; }) } } impl<P: Params, T> Node<P> for Arc<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.as_ref().accept(c, v) } } impl<P: Params, T> NodeMut<P> for Arc<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(if let Some(x) = Arc::get_mut(self) { x.accept(c, v)?; }) } } impl<P: Params, T> Node<P> for std::rc::Rc<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.as_ref().accept(c, v) } } impl<P: Params, T> NodeMut<P> for std::rc::Rc<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(if let Some(x) = std::rc::Rc::get_mut(self) { x.accept(c, v)?; }) } } impl<P: Params, T> Node<P> for Box<T> where T: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.as_ref().accept(c, v) } } impl<P: Params, T> NodeMut<P> for Box<T> where T: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.as_mut().accept(c, v) } } impl<P: Params, T1, T2> Node<P> for (T1, T2) where T1: Node<P>, T2: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params, T1, T2, T3> Node<P> for (T1, T2, T3) where T1: Node<P>, T2: Node<P>, T3: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params, T1, T2, T3, T4> Node<P> for (T1, T2, T3, T4) where T1: Node<P>, T2: Node<P>, T3: Node<P>, T4: Node<P>, { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v)?; self.3.accept(c, v) } } impl<P: Params, T1, T2> NodeMut<P> for (T1, T2) where T1: NodeMut<P>, T2: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params, T1, T2, T3> NodeMut<P> for (T1, T2, T3) where T1: NodeMut<P>, T2: NodeMut<P>, T3: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params, T1, T2, T3, T4> NodeMut<P> for (T1, T2, T3, T4) where T1: NodeMut<P>, T2: NodeMut<P>, T3: NodeMut<P>, T4: NodeMut<P>, { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v)?; self.3.accept(c, v) } } impl<P: Params> Node<P> for crate::LocalIdMap<(Pos, P::Ex)> { fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for (key, value) in self.0.iter() { key.accept(c, v)?; v.visit_ex(c, &value.1)?; }) } } /// `NodeMut` implementation doesn't visit keys, /// mutating key requires re-constructing the underlaying map. /// There will be extra perf cost even keys are not mutated. /// Overriding its parent visit method can mutate keys economically. impl<P: Params> NodeMut<P> for crate::LocalIdMap<(Pos, P::Ex)> { fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(for value in self.0.values_mut() { v.visit_ex(c, &mut value.1)? }) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/node_impl_gen.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<6e0fca1a4e5337d8a6a4f923ea6e3bbb>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_imports)] #![allow(unused_variables)] use super::node::Node; use super::type_params::Params; use super::visitor::Visitor; use crate::aast_defs::*; use crate::aast_defs::{self}; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::*; impl<P: Params> Node<P> for Abstraction { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_abstraction(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Abstraction::Concrete => Ok(()), Abstraction::Abstract => Ok(()), } } } impl<P: Params> Node<P> for Afield<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_afield(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Afield::AFvalue(a0) => a0.accept(c, v), Afield::AFkvalue(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for AsExpr<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_as_expr(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { AsExpr::AsV(a0) => a0.accept(c, v), AsExpr::AsKv(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } AsExpr::AwaitAsV(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } AsExpr::AwaitAsKv(a0, a1, a2) => { a0.accept(c, v)?; a1.accept(c, v)?; a2.accept(c, v) } } } } impl<P: Params> Node<P> for Binop<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_binop(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.bop.accept(c, v)?; self.lhs.accept(c, v)?; self.rhs.accept(c, v) } } impl<P: Params> Node<P> for Block<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_block(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> Node<P> for Bop { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_bop(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Bop::Plus => Ok(()), Bop::Minus => Ok(()), Bop::Star => Ok(()), Bop::Slash => Ok(()), Bop::Eqeq => Ok(()), Bop::Eqeqeq => Ok(()), Bop::Starstar => Ok(()), Bop::Diff => Ok(()), Bop::Diff2 => Ok(()), Bop::Ampamp => Ok(()), Bop::Barbar => Ok(()), Bop::Lt => Ok(()), Bop::Lte => Ok(()), Bop::Gt => Ok(()), Bop::Gte => Ok(()), Bop::Dot => Ok(()), Bop::Amp => Ok(()), Bop::Bar => Ok(()), Bop::Ltlt => Ok(()), Bop::Gtgt => Ok(()), Bop::Percent => Ok(()), Bop::Xor => Ok(()), Bop::Cmp => Ok(()), Bop::QuestionQuestion => Ok(()), Bop::Eq(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for CallExpr<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_call_expr(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.func.accept(c, v)?; self.targs.accept(c, v)?; self.args.accept(c, v)?; self.unpacked_arg.accept(c, v) } } impl<P: Params> Node<P> for CaptureLid<P::Ex> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_capture_lid(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.0)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for Case<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_case(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for Catch<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_catch(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> Node<P> for ClassAbstractTypeconst { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_abstract_typeconst(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.as_constraint.accept(c, v)?; self.super_constraint.accept(c, v)?; self.default.accept(c, v) } } impl<P: Params> Node<P> for ClassConcreteTypeconst { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_concrete_typeconst(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.c_tc_type.accept(c, v) } } impl<P: Params> Node<P> for ClassConst<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_const(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.type_.accept(c, v)?; self.id.accept(c, v)?; self.kind.accept(c, v)?; self.span.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> Node<P> for ClassConstKind<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_const_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassConstKind::CCAbstract(a0) => a0.accept(c, v), ClassConstKind::CCConcrete(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for ClassGetExpr<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_get_expr(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassGetExpr::CGstring(a0) => a0.accept(c, v), ClassGetExpr::CGexpr(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for ClassId<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_id(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.0)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> Node<P> for ClassId_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_id_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassId_::CIparent => Ok(()), ClassId_::CIself => Ok(()), ClassId_::CIstatic => Ok(()), ClassId_::CIexpr(a0) => a0.accept(c, v), ClassId_::CI(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for ClassReq { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_req(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for ClassTypeconst { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_typeconst(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassTypeconst::TCAbstract(a0) => a0.accept(c, v), ClassTypeconst::TCConcrete(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for ClassTypeconstDef<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_typeconst_def(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.name.accept(c, v)?; self.kind.accept(c, v)?; self.span.accept(c, v)?; self.doc_comment.accept(c, v)?; self.is_ctx.accept(c, v) } } impl<P: Params> Node<P> for ClassVar<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_var(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.final_.accept(c, v)?; self.xhp_attr.accept(c, v)?; self.abstract_.accept(c, v)?; self.readonly.accept(c, v)?; self.visibility.accept(c, v)?; self.type_.accept(c, v)?; self.id.accept(c, v)?; self.expr.accept(c, v)?; self.user_attributes.accept(c, v)?; self.doc_comment.accept(c, v)?; self.is_promoted_variadic.accept(c, v)?; self.is_static.accept(c, v)?; self.span.accept(c, v) } } impl<P: Params> Node<P> for Class_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; v.visit_en(c, &self.annotation)?; self.mode.accept(c, v)?; self.final_.accept(c, v)?; self.is_xhp.accept(c, v)?; self.has_xhp_keyword.accept(c, v)?; self.kind.accept(c, v)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.extends.accept(c, v)?; self.uses.accept(c, v)?; self.xhp_attr_uses.accept(c, v)?; self.xhp_category.accept(c, v)?; self.reqs.accept(c, v)?; self.implements.accept(c, v)?; self.where_constraints.accept(c, v)?; self.consts.accept(c, v)?; self.typeconsts.accept(c, v)?; self.vars.accept(c, v)?; self.methods.accept(c, v)?; self.xhp_children.accept(c, v)?; self.xhp_attrs.accept(c, v)?; self.namespace.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.docs_url.accept(c, v)?; self.enum_.accept(c, v)?; self.doc_comment.accept(c, v)?; self.emit_id.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v) } } impl<P: Params> Node<P> for ClassishKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_classish_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassishKind::Cclass(a0) => a0.accept(c, v), ClassishKind::Cinterface => Ok(()), ClassishKind::Ctrait => Ok(()), ClassishKind::Cenum => Ok(()), ClassishKind::CenumClass(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for CollectionTarg<P::Ex> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_collection_targ(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { CollectionTarg::CollectionTV(a0) => a0.accept(c, v), CollectionTarg::CollectionTKV(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for ConstraintKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_constraint_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ConstraintKind::ConstraintAs => Ok(()), ConstraintKind::ConstraintEq => Ok(()), ConstraintKind::ConstraintSuper => Ok(()), } } } impl<P: Params> Node<P> for Contexts { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_contexts(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for CtxRefinement { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ctx_refinement(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { CtxRefinement::CRexact(a0) => a0.accept(c, v), CtxRefinement::CRloose(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for CtxRefinementBounds { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ctx_refinement_bounds(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.lower.accept(c, v)?; self.upper.accept(c, v) } } impl<P: Params> Node<P> for Def<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_def(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Sid, Vec<Def<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } match self { Def::Fun(a0) => a0.accept(c, v), Def::Class(a0) => a0.accept(c, v), Def::Stmt(a0) => a0.accept(c, v), Def::Typedef(a0) => a0.accept(c, v), Def::Constant(a0) => a0.accept(c, v), Def::Namespace(a) => helper0(a, c, v), Def::NamespaceUse(a0) => a0.accept(c, v), Def::SetNamespaceEnv(a0) => a0.accept(c, v), Def::FileAttributes(a0) => a0.accept(c, v), Def::Module(a0) => a0.accept(c, v), Def::SetModule(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for DefaultCase<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_default_case(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for Efun<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_efun(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.fun.accept(c, v)?; self.use_.accept(c, v)?; self.closure_class_name.accept(c, v) } } impl<P: Params> Node<P> for EmitId { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_emit_id(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { EmitId::EmitId(a0) => a0.accept(c, v), EmitId::Anonymous => Ok(()), } } } impl<P: Params> Node<P> for Enum_ { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_enum_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.base.accept(c, v)?; self.constraint.accept(c, v)?; self.includes.accept(c, v) } } impl<P: Params> Node<P> for EnvAnnot { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_env_annot(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { EnvAnnot::Join => Ok(()), EnvAnnot::Refinement => Ok(()), } } } impl<P: Params> Node<P> for Expr<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expr(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.0)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> Node<P> for Expr_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expr_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<( Option<(Targ<Ex>, Targ<Ex>)>, Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper1<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper2<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<((Pos, VcKind), Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper3<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<( (Pos, KvcKind), Option<(Targ<Ex>, Targ<Ex>)>, Vec<Field<Ex, En>>, )>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper4<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Option<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper5<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Expr<Ex, En>, OgNullFlavor, PropOrMethod)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v) } #[inline] fn helper6<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ClassId<Ex, En>, ClassGetExpr<Ex, En>, PropOrMethod)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper7<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ClassId<Ex, En>, Pstring)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper8<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(FunctionPtrId<Ex, En>, Vec<Targ<Ex>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper9<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(String, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper10<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Hint, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper11<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ast_defs::Uop, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper12<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Lid, Expr<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper13<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Option<Expr<Ex, En>>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper14<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Hint)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper15<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Hint, bool)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper16<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Hint)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper17<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<( ClassId<Ex, En>, Vec<Targ<Ex>>, Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Ex, )>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v)?; v.visit_ex(c, &a.4) } #[inline] fn helper18<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Fun_<Ex, En>, Vec<CaptureLid<Ex>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper19<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ClassName, Vec<XhpAttribute<Ex, En>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper20<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ImportFlavor, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper21<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ClassName, Option<CollectionTarg<Ex>>, Vec<Afield<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper22<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(ClassName, Pstring)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper23<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Option<(Targ<Ex>, Targ<Ex>)>, Expr<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper24<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Option<ClassName>, String)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper25<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Ex, Ex, HoleSource)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; v.visit_ex(c, &a.1)?; v.visit_ex(c, &a.2)?; a.3.accept(c, v) } match self { Expr_::Darray(a) => helper0(a, c, v), Expr_::Varray(a) => helper1(a, c, v), Expr_::Shape(a0) => a0.accept(c, v), Expr_::ValCollection(a) => helper2(a, c, v), Expr_::KeyValCollection(a) => helper3(a, c, v), Expr_::Null => Ok(()), Expr_::This => Ok(()), Expr_::True => Ok(()), Expr_::False => Ok(()), Expr_::Omitted => Ok(()), Expr_::Invalid(a0) => a0.accept(c, v), Expr_::Id(a0) => a0.accept(c, v), Expr_::Lvar(a0) => a0.accept(c, v), Expr_::Dollardollar(a0) => a0.accept(c, v), Expr_::Clone(a0) => a0.accept(c, v), Expr_::ArrayGet(a) => helper4(a, c, v), Expr_::ObjGet(a) => helper5(a, c, v), Expr_::ClassGet(a) => helper6(a, c, v), Expr_::ClassConst(a) => helper7(a, c, v), Expr_::Call(a0) => a0.accept(c, v), Expr_::FunctionPointer(a) => helper8(a, c, v), Expr_::Int(a0) => a0.accept(c, v), Expr_::Float(a0) => a0.accept(c, v), Expr_::String(a0) => a0.accept(c, v), Expr_::String2(a0) => a0.accept(c, v), Expr_::PrefixedString(a) => helper9(a, c, v), Expr_::Yield(a0) => a0.accept(c, v), Expr_::Await(a0) => a0.accept(c, v), Expr_::ReadonlyExpr(a0) => a0.accept(c, v), Expr_::Tuple(a0) => a0.accept(c, v), Expr_::List(a0) => a0.accept(c, v), Expr_::Cast(a) => helper10(a, c, v), Expr_::Unop(a) => helper11(a, c, v), Expr_::Binop(a0) => a0.accept(c, v), Expr_::Pipe(a) => helper12(a, c, v), Expr_::Eif(a) => helper13(a, c, v), Expr_::Is(a) => helper14(a, c, v), Expr_::As(a) => helper15(a, c, v), Expr_::Upcast(a) => helper16(a, c, v), Expr_::New(a) => helper17(a, c, v), Expr_::Efun(a0) => a0.accept(c, v), Expr_::Lfun(a) => helper18(a, c, v), Expr_::Xml(a) => helper19(a, c, v), Expr_::Import(a) => helper20(a, c, v), Expr_::Collection(a) => helper21(a, c, v), Expr_::ExpressionTree(a0) => a0.accept(c, v), Expr_::Lplaceholder(a0) => a0.accept(c, v), Expr_::MethodCaller(a) => helper22(a, c, v), Expr_::Pair(a) => helper23(a, c, v), Expr_::ETSplice(a0) => a0.accept(c, v), Expr_::EnumClassLabel(a) => helper24(a, c, v), Expr_::Hole(a) => helper25(a, c, v), Expr_::Package(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for ExpressionTree<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expression_tree(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.hint.accept(c, v)?; self.splices.accept(c, v)?; self.function_pointers.accept(c, v)?; self.virtualized_expr.accept(c, v)?; self.runtime_expr.accept(c, v)?; self.dollardollar_pos.accept(c, v) } } impl<P: Params> Node<P> for Field<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_field(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for FileAttribute<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_file_attribute(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.namespace.accept(c, v) } } impl<P: Params> Node<P> for FinallyBlock<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_finally_block(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> Node<P> for FunDef<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_def(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.namespace.accept(c, v)?; self.file_attributes.accept(c, v)?; self.mode.accept(c, v)?; self.name.accept(c, v)?; self.fun.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v)?; self.tparams.accept(c, v)?; self.where_constraints.accept(c, v) } } impl<P: Params> Node<P> for FunKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { FunKind::FSync => Ok(()), FunKind::FAsync => Ok(()), FunKind::FGenerator => Ok(()), FunKind::FAsyncGenerator => Ok(()), } } } impl<P: Params> Node<P> for FunParam<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_param(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.annotation)?; self.type_hint.accept(c, v)?; self.is_variadic.accept(c, v)?; self.pos.accept(c, v)?; self.name.accept(c, v)?; self.expr.accept(c, v)?; self.readonly.accept(c, v)?; self.callconv.accept(c, v)?; self.user_attributes.accept(c, v)?; self.visibility.accept(c, v) } } impl<P: Params> Node<P> for Fun_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; self.readonly_this.accept(c, v)?; v.visit_en(c, &self.annotation)?; self.readonly_ret.accept(c, v)?; self.ret.accept(c, v)?; self.params.accept(c, v)?; self.ctxs.accept(c, v)?; self.unsafe_ctxs.accept(c, v)?; self.body.accept(c, v)?; self.fun_kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.external.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> Node<P> for FuncBody<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_func_body(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.fb_ast.accept(c, v) } } impl<P: Params> Node<P> for FunctionPtrId<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_function_ptr_id(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { FunctionPtrId::FPId(a0) => a0.accept(c, v), FunctionPtrId::FPClassConst(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for Gconst<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_gconst(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &self.annotation)?; self.mode.accept(c, v)?; self.name.accept(c, v)?; self.type_.accept(c, v)?; self.value.accept(c, v)?; self.namespace.accept(c, v)?; self.span.accept(c, v)?; self.emit_id.accept(c, v) } } impl<P: Params> Node<P> for HfParamInfo { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hf_param_info(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.kind.accept(c, v)?; self.readonlyness.accept(c, v) } } impl<P: Params> Node<P> for Hint { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for HintFun { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint_fun(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.is_readonly.accept(c, v)?; self.param_tys.accept(c, v)?; self.param_info.accept(c, v)?; self.variadic_ty.accept(c, v)?; self.ctxs.accept(c, v)?; self.return_ty.accept(c, v)?; self.is_readonly_return.accept(c, v) } } impl<P: Params> Node<P> for Hint_ { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Hint_::Hoption(a0) => a0.accept(c, v), Hint_::Hlike(a0) => a0.accept(c, v), Hint_::Hfun(a0) => a0.accept(c, v), Hint_::Htuple(a0) => a0.accept(c, v), Hint_::Happly(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hshape(a0) => a0.accept(c, v), Hint_::Haccess(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hsoft(a0) => a0.accept(c, v), Hint_::Hrefinement(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hany => Ok(()), Hint_::Herr => Ok(()), Hint_::Hmixed => Ok(()), Hint_::Hwildcard => Ok(()), Hint_::Hnonnull => Ok(()), Hint_::Habstr(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::HvecOrDict(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hprim(a0) => a0.accept(c, v), Hint_::Hthis => Ok(()), Hint_::Hdynamic => Ok(()), Hint_::Hnothing => Ok(()), Hint_::Hunion(a0) => a0.accept(c, v), Hint_::Hintersection(a0) => a0.accept(c, v), Hint_::HfunContext(a0) => a0.accept(c, v), Hint_::Hvar(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for HoleSource { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hole_source(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { HoleSource::Typing => Ok(()), HoleSource::UnsafeCast(a0) => a0.accept(c, v), HoleSource::UnsafeNonnullCast => Ok(()), HoleSource::EnforcedCast(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for Id { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_id(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for ImportFlavor { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_import_flavor(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ImportFlavor::Include => Ok(()), ImportFlavor::Require => Ok(()), ImportFlavor::IncludeOnce => Ok(()), ImportFlavor::RequireOnce => Ok(()), } } } impl<P: Params> Node<P> for KvcKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_kvc_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { KvcKind::Map => Ok(()), KvcKind::ImmMap => Ok(()), KvcKind::Dict => Ok(()), } } } impl<P: Params> Node<P> for Lid { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_lid(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for MdNameKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_md_name_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { MdNameKind::MDNameGlobal(a0) => a0.accept(c, v), MdNameKind::MDNamePrefix(a0) => a0.accept(c, v), MdNameKind::MDNameExact(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for Method_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_method_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; v.visit_en(c, &self.annotation)?; self.final_.accept(c, v)?; self.abstract_.accept(c, v)?; self.static_.accept(c, v)?; self.readonly_this.accept(c, v)?; self.visibility.accept(c, v)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.where_constraints.accept(c, v)?; self.params.accept(c, v)?; self.ctxs.accept(c, v)?; self.unsafe_ctxs.accept(c, v)?; self.body.accept(c, v)?; self.fun_kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.readonly_ret.accept(c, v)?; self.ret.accept(c, v)?; self.external.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> Node<P> for ModuleDef<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_module_def(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &self.annotation)?; self.name.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.span.accept(c, v)?; self.mode.accept(c, v)?; self.doc_comment.accept(c, v)?; self.exports.accept(c, v)?; self.imports.accept(c, v) } } impl<P: Params> Node<P> for NastShapeInfo { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_nast_shape_info(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.allows_unknown_fields.accept(c, v)?; self.field_map.accept(c, v) } } impl<P: Params> Node<P> for NsKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ns_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { NsKind::NSNamespace => Ok(()), NsKind::NSClass => Ok(()), NsKind::NSClassAndNamespace => Ok(()), NsKind::NSFun => Ok(()), NsKind::NSConst => Ok(()), } } } impl<P: Params> Node<P> for OgNullFlavor { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_og_null_flavor(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { OgNullFlavor::OGNullthrows => Ok(()), OgNullFlavor::OGNullsafe => Ok(()), } } } impl<P: Params> Node<P> for ParamKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_param_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ParamKind::Pinout(a0) => a0.accept(c, v), ParamKind::Pnormal => Ok(()), } } } impl<P: Params> Node<P> for PatRefinement { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pat_refinement(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.pos.accept(c, v)?; self.id.accept(c, v)?; self.hint.accept(c, v) } } impl<P: Params> Node<P> for PatVar { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pat_var(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.pos.accept(c, v)?; self.id.accept(c, v) } } impl<P: Params> Node<P> for Pattern { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pattern(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Pattern::PVar(a0) => a0.accept(c, v), Pattern::PRefinement(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for Program<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_program(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> Node<P> for PropOrMethod { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_prop_or_method(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { PropOrMethod::IsProp => Ok(()), PropOrMethod::IsMethod => Ok(()), } } } impl<P: Params> Node<P> for ReadonlyKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_readonly_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ReadonlyKind::Readonly => Ok(()), } } } impl<P: Params> Node<P> for Refinement { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_refinement(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Refinement::Rctx(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Refinement::Rtype(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for ReifyKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_reify_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ReifyKind::Erased => Ok(()), ReifyKind::SoftReified => Ok(()), ReifyKind::Reified => Ok(()), } } } impl<P: Params> Node<P> for RequireKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_require_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { RequireKind::RequireExtends => Ok(()), RequireKind::RequireImplements => Ok(()), RequireKind::RequireClass => Ok(()), } } } impl<P: Params> Node<P> for ShapeFieldInfo { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_shape_field_info(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.optional.accept(c, v)?; self.hint.accept(c, v)?; self.name.accept(c, v) } } impl<P: Params> Node<P> for ShapeFieldName { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_shape_field_name(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { ShapeFieldName::SFlitInt(a0) => a0.accept(c, v), ShapeFieldName::SFlitStr(a0) => a0.accept(c, v), ShapeFieldName::SFclassConst(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for Stmt<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for StmtMatch<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_match(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.expr.accept(c, v)?; self.arms.accept(c, v) } } impl<P: Params> Node<P> for StmtMatchArm<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_match_arm(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.pat.accept(c, v)?; self.body.accept(c, v) } } impl<P: Params> Node<P> for Stmt_<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Vec<(Option<Lid>, Expr<Ex, En>)>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper1<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Block<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper2<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Block<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper3<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper4<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<( Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Vec<Expr<Ex, En>>, Block<Ex, En>, )>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v) } #[inline] fn helper5<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, Vec<Case<Ex, En>>, Option<DefaultCase<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper6<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Expr<Ex, En>, AsExpr<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper7<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Block<Ex, En>, Vec<Catch<Ex, En>>, FinallyBlock<Ex, En>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper8<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(Lid, Hint, Option<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper9<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node Box<(EnvAnnot, LocalIdMap<(Pos, Ex)>)>, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } match self { Stmt_::Fallthrough => Ok(()), Stmt_::Expr(a0) => a0.accept(c, v), Stmt_::Break => Ok(()), Stmt_::Continue => Ok(()), Stmt_::Throw(a0) => a0.accept(c, v), Stmt_::Return(a0) => a0.accept(c, v), Stmt_::YieldBreak => Ok(()), Stmt_::Awaitall(a) => helper0(a, c, v), Stmt_::If(a) => helper1(a, c, v), Stmt_::Do(a) => helper2(a, c, v), Stmt_::While(a) => helper3(a, c, v), Stmt_::Using(a0) => a0.accept(c, v), Stmt_::For(a) => helper4(a, c, v), Stmt_::Switch(a) => helper5(a, c, v), Stmt_::Match(a0) => a0.accept(c, v), Stmt_::Foreach(a) => helper6(a, c, v), Stmt_::Try(a) => helper7(a, c, v), Stmt_::Noop => Ok(()), Stmt_::DeclareLocal(a) => helper8(a, c, v), Stmt_::Block(a0) => a0.accept(c, v), Stmt_::Markup(a0) => a0.accept(c, v), Stmt_::AssertEnv(a) => helper9(a, c, v), } } } impl<P: Params> Node<P> for Targ<P::Ex> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_targ(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.0)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for Tparam<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_tparam(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.variance.accept(c, v)?; self.name.accept(c, v)?; self.parameters.accept(c, v)?; self.constraints.accept(c, v)?; self.reified.accept(c, v)?; self.user_attributes.accept(c, v) } } impl<P: Params> Node<P> for Tprim { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_tprim(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Tprim::Tnull => Ok(()), Tprim::Tvoid => Ok(()), Tprim::Tint => Ok(()), Tprim::Tbool => Ok(()), Tprim::Tfloat => Ok(()), Tprim::Tstring => Ok(()), Tprim::Tresource => Ok(()), Tprim::Tnum => Ok(()), Tprim::Tarraykey => Ok(()), Tprim::Tnoreturn => Ok(()), } } } impl<P: Params> Node<P> for TypeHint<P::Ex> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_hint(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &self.0)?; self.1.accept(c, v) } } impl<P: Params> Node<P> for TypeRefinement { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_refinement(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { TypeRefinement::TRexact(a0) => a0.accept(c, v), TypeRefinement::TRloose(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for TypeRefinementBounds { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_refinement_bounds(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.lower.accept(c, v)?; self.upper.accept(c, v) } } impl<P: Params> Node<P> for Typedef<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_typedef(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &self.annotation)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.as_constraint.accept(c, v)?; self.super_constraint.accept(c, v)?; self.kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.mode.accept(c, v)?; self.vis.accept(c, v)?; self.namespace.accept(c, v)?; self.span.accept(c, v)?; self.emit_id.accept(c, v)?; self.is_ctx.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v)?; self.docs_url.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> Node<P> for TypedefVisibility { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_typedef_visibility(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { TypedefVisibility::Transparent => Ok(()), TypedefVisibility::Opaque => Ok(()), TypedefVisibility::OpaqueModule => Ok(()), TypedefVisibility::CaseType => Ok(()), } } } impl<P: Params> Node<P> for Uop { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_uop(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Uop::Utild => Ok(()), Uop::Unot => Ok(()), Uop::Uplus => Ok(()), Uop::Uminus => Ok(()), Uop::Uincr => Ok(()), Uop::Udecr => Ok(()), Uop::Upincr => Ok(()), Uop::Updecr => Ok(()), Uop::Usilence => Ok(()), } } } impl<P: Params> Node<P> for UserAttribute<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_user_attribute(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.name.accept(c, v)?; self.params.accept(c, v) } } impl<P: Params> Node<P> for UserAttributes<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_user_attributes(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> Node<P> for UsingStmt<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_using_stmt(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.is_block_scoped.accept(c, v)?; self.has_await.accept(c, v)?; self.exprs.accept(c, v)?; self.block.accept(c, v) } } impl<P: Params> Node<P> for Variance { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_variance(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Variance::Covariant => Ok(()), Variance::Contravariant => Ok(()), Variance::Invariant => Ok(()), } } } impl<P: Params> Node<P> for VcKind { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_vc_kind(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { VcKind::Vector => Ok(()), VcKind::ImmVector => Ok(()), VcKind::Vec => Ok(()), VcKind::Set => Ok(()), VcKind::ImmSet => Ok(()), VcKind::Keyset => Ok(()), } } } impl<P: Params> Node<P> for Visibility { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_visibility(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { Visibility::Private => Ok(()), Visibility::Public => Ok(()), Visibility::Protected => Ok(()), Visibility::Internal => Ok(()), } } } impl<P: Params> Node<P> for WhereConstraintHint { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_where_constraint_hint(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> Node<P> for XhpAttr<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v)?; self.3.accept(c, v) } } impl<P: Params> Node<P> for XhpAttrInfo { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr_info(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.like.accept(c, v)?; self.tag.accept(c, v)?; self.enum_values.accept(c, v) } } impl<P: Params> Node<P> for XhpAttrTag { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr_tag(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpAttrTag::Required => Ok(()), XhpAttrTag::LateInit => Ok(()), } } } impl<P: Params> Node<P> for XhpAttribute<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attribute(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpAttribute::XhpSimple(a0) => a0.accept(c, v), XhpAttribute::XhpSpread(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for XhpChild { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_child(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpChild::ChildName(a0) => a0.accept(c, v), XhpChild::ChildList(a0) => a0.accept(c, v), XhpChild::ChildUnary(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } XhpChild::ChildBinary(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> Node<P> for XhpChildOp { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_child_op(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpChildOp::ChildStar => Ok(()), XhpChildOp::ChildPlus => Ok(()), XhpChildOp::ChildQuestion => Ok(()), } } } impl<P: Params> Node<P> for XhpEnumValue { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_enum_value(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpEnumValue::XEVInt(a0) => a0.accept(c, v), XhpEnumValue::XEVString(a0) => a0.accept(c, v), } } } impl<P: Params> Node<P> for XhpSimple<P::Ex, P::En> { fn accept<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_simple(c, self) } fn recurse<'node>( &'node self, c: &mut P::Context, v: &mut dyn Visitor<'node, Params = P>, ) -> Result<(), P::Error> { self.name.accept(c, v)?; v.visit_ex(c, &self.type_)?; self.expr.accept(c, v) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/node_mut.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<ce75384299532973a96540a6d25d4b7b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_variables)] use super::type_params::Params; use super::visitor_mut::VisitorMut; pub trait NodeMut<P: Params> { fn accept<'node>( &'node mut self, ctx: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.recurse(ctx, v) } fn recurse<'node>( &'node mut self, ctx: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { Ok(()) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/node_mut_impl_gen.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<c29487fccaaf7af9e4ae42aed1d6fd58>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_imports)] #![allow(unused_variables)] use super::node_mut::NodeMut; use super::type_params::Params; use super::visitor_mut::VisitorMut; use crate::aast_defs::*; use crate::aast_defs::{self}; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::*; impl<P: Params> NodeMut<P> for Abstraction { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_abstraction(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Abstraction::Concrete => Ok(()), Abstraction::Abstract => Ok(()), } } } impl<P: Params> NodeMut<P> for Afield<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_afield(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Afield::AFvalue(a0) => a0.accept(c, v), Afield::AFkvalue(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for AsExpr<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_as_expr(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { AsExpr::AsV(a0) => a0.accept(c, v), AsExpr::AsKv(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } AsExpr::AwaitAsV(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } AsExpr::AwaitAsKv(a0, a1, a2) => { a0.accept(c, v)?; a1.accept(c, v)?; a2.accept(c, v) } } } } impl<P: Params> NodeMut<P> for Binop<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_binop(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.bop.accept(c, v)?; self.lhs.accept(c, v)?; self.rhs.accept(c, v) } } impl<P: Params> NodeMut<P> for Block<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_block(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> NodeMut<P> for Bop { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_bop(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Bop::Plus => Ok(()), Bop::Minus => Ok(()), Bop::Star => Ok(()), Bop::Slash => Ok(()), Bop::Eqeq => Ok(()), Bop::Eqeqeq => Ok(()), Bop::Starstar => Ok(()), Bop::Diff => Ok(()), Bop::Diff2 => Ok(()), Bop::Ampamp => Ok(()), Bop::Barbar => Ok(()), Bop::Lt => Ok(()), Bop::Lte => Ok(()), Bop::Gt => Ok(()), Bop::Gte => Ok(()), Bop::Dot => Ok(()), Bop::Amp => Ok(()), Bop::Bar => Ok(()), Bop::Ltlt => Ok(()), Bop::Gtgt => Ok(()), Bop::Percent => Ok(()), Bop::Xor => Ok(()), Bop::Cmp => Ok(()), Bop::QuestionQuestion => Ok(()), Bop::Eq(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for CallExpr<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_call_expr(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.func.accept(c, v)?; self.targs.accept(c, v)?; self.args.accept(c, v)?; self.unpacked_arg.accept(c, v) } } impl<P: Params> NodeMut<P> for CaptureLid<P::Ex> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_capture_lid(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.0)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for Case<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_case(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for Catch<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_catch(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassAbstractTypeconst { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_abstract_typeconst(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.as_constraint.accept(c, v)?; self.super_constraint.accept(c, v)?; self.default.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassConcreteTypeconst { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_concrete_typeconst(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.c_tc_type.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassConst<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_const(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.type_.accept(c, v)?; self.id.accept(c, v)?; self.kind.accept(c, v)?; self.span.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassConstKind<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_const_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassConstKind::CCAbstract(a0) => a0.accept(c, v), ClassConstKind::CCConcrete(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for ClassGetExpr<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_get_expr(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassGetExpr::CGstring(a0) => a0.accept(c, v), ClassGetExpr::CGexpr(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for ClassId<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_id(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.0)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassId_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_id_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassId_::CIparent => Ok(()), ClassId_::CIself => Ok(()), ClassId_::CIstatic => Ok(()), ClassId_::CIexpr(a0) => a0.accept(c, v), ClassId_::CI(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for ClassReq { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_req(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassTypeconst { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_typeconst(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassTypeconst::TCAbstract(a0) => a0.accept(c, v), ClassTypeconst::TCConcrete(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for ClassTypeconstDef<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_typeconst_def(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.name.accept(c, v)?; self.kind.accept(c, v)?; self.span.accept(c, v)?; self.doc_comment.accept(c, v)?; self.is_ctx.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassVar<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_var(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.final_.accept(c, v)?; self.xhp_attr.accept(c, v)?; self.abstract_.accept(c, v)?; self.readonly.accept(c, v)?; self.visibility.accept(c, v)?; self.type_.accept(c, v)?; self.id.accept(c, v)?; self.expr.accept(c, v)?; self.user_attributes.accept(c, v)?; self.doc_comment.accept(c, v)?; self.is_promoted_variadic.accept(c, v)?; self.is_static.accept(c, v)?; self.span.accept(c, v) } } impl<P: Params> NodeMut<P> for Class_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_class_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; v.visit_en(c, &mut self.annotation)?; self.mode.accept(c, v)?; self.final_.accept(c, v)?; self.is_xhp.accept(c, v)?; self.has_xhp_keyword.accept(c, v)?; self.kind.accept(c, v)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.extends.accept(c, v)?; self.uses.accept(c, v)?; self.xhp_attr_uses.accept(c, v)?; self.xhp_category.accept(c, v)?; self.reqs.accept(c, v)?; self.implements.accept(c, v)?; self.where_constraints.accept(c, v)?; self.consts.accept(c, v)?; self.typeconsts.accept(c, v)?; self.vars.accept(c, v)?; self.methods.accept(c, v)?; self.xhp_children.accept(c, v)?; self.xhp_attrs.accept(c, v)?; self.namespace.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.docs_url.accept(c, v)?; self.enum_.accept(c, v)?; self.doc_comment.accept(c, v)?; self.emit_id.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v) } } impl<P: Params> NodeMut<P> for ClassishKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_classish_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ClassishKind::Cclass(a0) => a0.accept(c, v), ClassishKind::Cinterface => Ok(()), ClassishKind::Ctrait => Ok(()), ClassishKind::Cenum => Ok(()), ClassishKind::CenumClass(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for CollectionTarg<P::Ex> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_collection_targ(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { CollectionTarg::CollectionTV(a0) => a0.accept(c, v), CollectionTarg::CollectionTKV(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for ConstraintKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_constraint_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ConstraintKind::ConstraintAs => Ok(()), ConstraintKind::ConstraintEq => Ok(()), ConstraintKind::ConstraintSuper => Ok(()), } } } impl<P: Params> NodeMut<P> for Contexts { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_contexts(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for CtxRefinement { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ctx_refinement(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { CtxRefinement::CRexact(a0) => a0.accept(c, v), CtxRefinement::CRloose(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for CtxRefinementBounds { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ctx_refinement_bounds(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.lower.accept(c, v)?; self.upper.accept(c, v) } } impl<P: Params> NodeMut<P> for Def<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_def(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Sid, Vec<Def<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } match self { Def::Fun(a0) => a0.accept(c, v), Def::Class(a0) => a0.accept(c, v), Def::Stmt(a0) => a0.accept(c, v), Def::Typedef(a0) => a0.accept(c, v), Def::Constant(a0) => a0.accept(c, v), Def::Namespace(a) => helper0(a, c, v), Def::NamespaceUse(a0) => a0.accept(c, v), Def::SetNamespaceEnv(a0) => a0.accept(c, v), Def::FileAttributes(a0) => a0.accept(c, v), Def::Module(a0) => a0.accept(c, v), Def::SetModule(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for DefaultCase<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_default_case(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for Efun<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_efun(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.fun.accept(c, v)?; self.use_.accept(c, v)?; self.closure_class_name.accept(c, v) } } impl<P: Params> NodeMut<P> for EmitId { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_emit_id(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { EmitId::EmitId(a0) => a0.accept(c, v), EmitId::Anonymous => Ok(()), } } } impl<P: Params> NodeMut<P> for Enum_ { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_enum_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.base.accept(c, v)?; self.constraint.accept(c, v)?; self.includes.accept(c, v) } } impl<P: Params> NodeMut<P> for EnvAnnot { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_env_annot(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { EnvAnnot::Join => Ok(()), EnvAnnot::Refinement => Ok(()), } } } impl<P: Params> NodeMut<P> for Expr<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expr(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.0)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> NodeMut<P> for Expr_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expr_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<( Option<(Targ<Ex>, Targ<Ex>)>, Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper1<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper2<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<((Pos, VcKind), Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper3<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<( (Pos, KvcKind), Option<(Targ<Ex>, Targ<Ex>)>, Vec<Field<Ex, En>>, )>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper4<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Option<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper5<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Expr<Ex, En>, OgNullFlavor, PropOrMethod)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v) } #[inline] fn helper6<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ClassId<Ex, En>, ClassGetExpr<Ex, En>, PropOrMethod)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper7<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ClassId<Ex, En>, Pstring)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper8<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(FunctionPtrId<Ex, En>, Vec<Targ<Ex>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper9<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(String, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper10<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Hint, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper11<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ast_defs::Uop, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper12<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Lid, Expr<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper13<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Option<Expr<Ex, En>>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper14<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Hint)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper15<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Hint, bool)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper16<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Hint)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper17<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<( ClassId<Ex, En>, Vec<Targ<Ex>>, Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Ex, )>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v)?; v.visit_ex(c, &mut a.4) } #[inline] fn helper18<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Fun_<Ex, En>, Vec<CaptureLid<Ex>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper19<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ClassName, Vec<XhpAttribute<Ex, En>>, Vec<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper20<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ImportFlavor, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper21<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ClassName, Option<CollectionTarg<Ex>>, Vec<Afield<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper22<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(ClassName, Pstring)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper23<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Option<(Targ<Ex>, Targ<Ex>)>, Expr<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper24<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Option<ClassName>, String)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper25<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Ex, Ex, HoleSource)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; v.visit_ex(c, &mut a.1)?; v.visit_ex(c, &mut a.2)?; a.3.accept(c, v) } match self { Expr_::Darray(a) => helper0(a, c, v), Expr_::Varray(a) => helper1(a, c, v), Expr_::Shape(a0) => a0.accept(c, v), Expr_::ValCollection(a) => helper2(a, c, v), Expr_::KeyValCollection(a) => helper3(a, c, v), Expr_::Null => Ok(()), Expr_::This => Ok(()), Expr_::True => Ok(()), Expr_::False => Ok(()), Expr_::Omitted => Ok(()), Expr_::Invalid(a0) => a0.accept(c, v), Expr_::Id(a0) => a0.accept(c, v), Expr_::Lvar(a0) => a0.accept(c, v), Expr_::Dollardollar(a0) => a0.accept(c, v), Expr_::Clone(a0) => a0.accept(c, v), Expr_::ArrayGet(a) => helper4(a, c, v), Expr_::ObjGet(a) => helper5(a, c, v), Expr_::ClassGet(a) => helper6(a, c, v), Expr_::ClassConst(a) => helper7(a, c, v), Expr_::Call(a0) => a0.accept(c, v), Expr_::FunctionPointer(a) => helper8(a, c, v), Expr_::Int(a0) => a0.accept(c, v), Expr_::Float(a0) => a0.accept(c, v), Expr_::String(a0) => a0.accept(c, v), Expr_::String2(a0) => a0.accept(c, v), Expr_::PrefixedString(a) => helper9(a, c, v), Expr_::Yield(a0) => a0.accept(c, v), Expr_::Await(a0) => a0.accept(c, v), Expr_::ReadonlyExpr(a0) => a0.accept(c, v), Expr_::Tuple(a0) => a0.accept(c, v), Expr_::List(a0) => a0.accept(c, v), Expr_::Cast(a) => helper10(a, c, v), Expr_::Unop(a) => helper11(a, c, v), Expr_::Binop(a0) => a0.accept(c, v), Expr_::Pipe(a) => helper12(a, c, v), Expr_::Eif(a) => helper13(a, c, v), Expr_::Is(a) => helper14(a, c, v), Expr_::As(a) => helper15(a, c, v), Expr_::Upcast(a) => helper16(a, c, v), Expr_::New(a) => helper17(a, c, v), Expr_::Efun(a0) => a0.accept(c, v), Expr_::Lfun(a) => helper18(a, c, v), Expr_::Xml(a) => helper19(a, c, v), Expr_::Import(a) => helper20(a, c, v), Expr_::Collection(a) => helper21(a, c, v), Expr_::ExpressionTree(a0) => a0.accept(c, v), Expr_::Lplaceholder(a0) => a0.accept(c, v), Expr_::MethodCaller(a) => helper22(a, c, v), Expr_::Pair(a) => helper23(a, c, v), Expr_::ETSplice(a0) => a0.accept(c, v), Expr_::EnumClassLabel(a) => helper24(a, c, v), Expr_::Hole(a) => helper25(a, c, v), Expr_::Package(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for ExpressionTree<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_expression_tree(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.hint.accept(c, v)?; self.splices.accept(c, v)?; self.function_pointers.accept(c, v)?; self.virtualized_expr.accept(c, v)?; self.runtime_expr.accept(c, v)?; self.dollardollar_pos.accept(c, v) } } impl<P: Params> NodeMut<P> for Field<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_field(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for FileAttribute<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_file_attribute(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.user_attributes.accept(c, v)?; self.namespace.accept(c, v) } } impl<P: Params> NodeMut<P> for FinallyBlock<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_finally_block(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> NodeMut<P> for FunDef<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_def(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.namespace.accept(c, v)?; self.file_attributes.accept(c, v)?; self.mode.accept(c, v)?; self.name.accept(c, v)?; self.fun.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v)?; self.tparams.accept(c, v)?; self.where_constraints.accept(c, v) } } impl<P: Params> NodeMut<P> for FunKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { FunKind::FSync => Ok(()), FunKind::FAsync => Ok(()), FunKind::FGenerator => Ok(()), FunKind::FAsyncGenerator => Ok(()), } } } impl<P: Params> NodeMut<P> for FunParam<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_param(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.annotation)?; self.type_hint.accept(c, v)?; self.is_variadic.accept(c, v)?; self.pos.accept(c, v)?; self.name.accept(c, v)?; self.expr.accept(c, v)?; self.readonly.accept(c, v)?; self.callconv.accept(c, v)?; self.user_attributes.accept(c, v)?; self.visibility.accept(c, v) } } impl<P: Params> NodeMut<P> for Fun_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_fun_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; self.readonly_this.accept(c, v)?; v.visit_en(c, &mut self.annotation)?; self.readonly_ret.accept(c, v)?; self.ret.accept(c, v)?; self.params.accept(c, v)?; self.ctxs.accept(c, v)?; self.unsafe_ctxs.accept(c, v)?; self.body.accept(c, v)?; self.fun_kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.external.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> NodeMut<P> for FuncBody<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_func_body(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.fb_ast.accept(c, v) } } impl<P: Params> NodeMut<P> for FunctionPtrId<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_function_ptr_id(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { FunctionPtrId::FPId(a0) => a0.accept(c, v), FunctionPtrId::FPClassConst(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for Gconst<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_gconst(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &mut self.annotation)?; self.mode.accept(c, v)?; self.name.accept(c, v)?; self.type_.accept(c, v)?; self.value.accept(c, v)?; self.namespace.accept(c, v)?; self.span.accept(c, v)?; self.emit_id.accept(c, v) } } impl<P: Params> NodeMut<P> for HfParamInfo { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hf_param_info(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.kind.accept(c, v)?; self.readonlyness.accept(c, v) } } impl<P: Params> NodeMut<P> for Hint { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for HintFun { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint_fun(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.is_readonly.accept(c, v)?; self.param_tys.accept(c, v)?; self.param_info.accept(c, v)?; self.variadic_ty.accept(c, v)?; self.ctxs.accept(c, v)?; self.return_ty.accept(c, v)?; self.is_readonly_return.accept(c, v) } } impl<P: Params> NodeMut<P> for Hint_ { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hint_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Hint_::Hoption(a0) => a0.accept(c, v), Hint_::Hlike(a0) => a0.accept(c, v), Hint_::Hfun(a0) => a0.accept(c, v), Hint_::Htuple(a0) => a0.accept(c, v), Hint_::Happly(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hshape(a0) => a0.accept(c, v), Hint_::Haccess(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hsoft(a0) => a0.accept(c, v), Hint_::Hrefinement(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hany => Ok(()), Hint_::Herr => Ok(()), Hint_::Hmixed => Ok(()), Hint_::Hwildcard => Ok(()), Hint_::Hnonnull => Ok(()), Hint_::Habstr(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::HvecOrDict(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Hint_::Hprim(a0) => a0.accept(c, v), Hint_::Hthis => Ok(()), Hint_::Hdynamic => Ok(()), Hint_::Hnothing => Ok(()), Hint_::Hunion(a0) => a0.accept(c, v), Hint_::Hintersection(a0) => a0.accept(c, v), Hint_::HfunContext(a0) => a0.accept(c, v), Hint_::Hvar(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for HoleSource { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_hole_source(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { HoleSource::Typing => Ok(()), HoleSource::UnsafeCast(a0) => a0.accept(c, v), HoleSource::UnsafeNonnullCast => Ok(()), HoleSource::EnforcedCast(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for Id { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_id(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for ImportFlavor { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_import_flavor(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ImportFlavor::Include => Ok(()), ImportFlavor::Require => Ok(()), ImportFlavor::IncludeOnce => Ok(()), ImportFlavor::RequireOnce => Ok(()), } } } impl<P: Params> NodeMut<P> for KvcKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_kvc_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { KvcKind::Map => Ok(()), KvcKind::ImmMap => Ok(()), KvcKind::Dict => Ok(()), } } } impl<P: Params> NodeMut<P> for Lid { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_lid(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for MdNameKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_md_name_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { MdNameKind::MDNameGlobal(a0) => a0.accept(c, v), MdNameKind::MDNamePrefix(a0) => a0.accept(c, v), MdNameKind::MDNameExact(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for Method_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_method_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.span.accept(c, v)?; v.visit_en(c, &mut self.annotation)?; self.final_.accept(c, v)?; self.abstract_.accept(c, v)?; self.static_.accept(c, v)?; self.readonly_this.accept(c, v)?; self.visibility.accept(c, v)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.where_constraints.accept(c, v)?; self.params.accept(c, v)?; self.ctxs.accept(c, v)?; self.unsafe_ctxs.accept(c, v)?; self.body.accept(c, v)?; self.fun_kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.readonly_ret.accept(c, v)?; self.ret.accept(c, v)?; self.external.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> NodeMut<P> for ModuleDef<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_module_def(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &mut self.annotation)?; self.name.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.span.accept(c, v)?; self.mode.accept(c, v)?; self.doc_comment.accept(c, v)?; self.exports.accept(c, v)?; self.imports.accept(c, v) } } impl<P: Params> NodeMut<P> for NastShapeInfo { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_nast_shape_info(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.allows_unknown_fields.accept(c, v)?; self.field_map.accept(c, v) } } impl<P: Params> NodeMut<P> for NsKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ns_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { NsKind::NSNamespace => Ok(()), NsKind::NSClass => Ok(()), NsKind::NSClassAndNamespace => Ok(()), NsKind::NSFun => Ok(()), NsKind::NSConst => Ok(()), } } } impl<P: Params> NodeMut<P> for OgNullFlavor { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_og_null_flavor(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { OgNullFlavor::OGNullthrows => Ok(()), OgNullFlavor::OGNullsafe => Ok(()), } } } impl<P: Params> NodeMut<P> for ParamKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_param_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ParamKind::Pinout(a0) => a0.accept(c, v), ParamKind::Pnormal => Ok(()), } } } impl<P: Params> NodeMut<P> for PatRefinement { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pat_refinement(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.pos.accept(c, v)?; self.id.accept(c, v)?; self.hint.accept(c, v) } } impl<P: Params> NodeMut<P> for PatVar { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pat_var(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.pos.accept(c, v)?; self.id.accept(c, v) } } impl<P: Params> NodeMut<P> for Pattern { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_pattern(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Pattern::PVar(a0) => a0.accept(c, v), Pattern::PRefinement(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for Program<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_program(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> NodeMut<P> for PropOrMethod { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_prop_or_method(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { PropOrMethod::IsProp => Ok(()), PropOrMethod::IsMethod => Ok(()), } } } impl<P: Params> NodeMut<P> for ReadonlyKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_readonly_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ReadonlyKind::Readonly => Ok(()), } } } impl<P: Params> NodeMut<P> for Refinement { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_refinement(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Refinement::Rctx(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } Refinement::Rtype(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for ReifyKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_reify_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ReifyKind::Erased => Ok(()), ReifyKind::SoftReified => Ok(()), ReifyKind::Reified => Ok(()), } } } impl<P: Params> NodeMut<P> for RequireKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_require_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { RequireKind::RequireExtends => Ok(()), RequireKind::RequireImplements => Ok(()), RequireKind::RequireClass => Ok(()), } } } impl<P: Params> NodeMut<P> for ShapeFieldInfo { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_shape_field_info(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.optional.accept(c, v)?; self.hint.accept(c, v)?; self.name.accept(c, v) } } impl<P: Params> NodeMut<P> for ShapeFieldName { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_shape_field_name(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { ShapeFieldName::SFlitInt(a0) => a0.accept(c, v), ShapeFieldName::SFlitStr(a0) => a0.accept(c, v), ShapeFieldName::SFclassConst(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for Stmt<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for StmtMatch<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_match(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.expr.accept(c, v)?; self.arms.accept(c, v) } } impl<P: Params> NodeMut<P> for StmtMatchArm<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_match_arm(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.pat.accept(c, v)?; self.body.accept(c, v) } } impl<P: Params> NodeMut<P> for Stmt_<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_stmt_(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { #[inline] fn helper0<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Vec<(Option<Lid>, Expr<Ex, En>)>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper1<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Block<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper2<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Block<Ex, En>, Expr<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper3<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } #[inline] fn helper4<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<( Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Vec<Expr<Ex, En>>, Block<Ex, En>, )>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v)?; a.3.accept(c, v) } #[inline] fn helper5<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, Vec<Case<Ex, En>>, Option<DefaultCase<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper6<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Expr<Ex, En>, AsExpr<Ex, En>, Block<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper7<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Block<Ex, En>, Vec<Catch<Ex, En>>, FinallyBlock<Ex, En>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper8<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(Lid, Hint, Option<Expr<Ex, En>>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v)?; a.2.accept(c, v) } #[inline] fn helper9<'node, P: Params + Params<Ex = Ex> + Params<En = En>, Ex, En>( a: &'node mut Box<(EnvAnnot, LocalIdMap<(Pos, Ex)>)>, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { a.0.accept(c, v)?; a.1.accept(c, v) } match self { Stmt_::Fallthrough => Ok(()), Stmt_::Expr(a0) => a0.accept(c, v), Stmt_::Break => Ok(()), Stmt_::Continue => Ok(()), Stmt_::Throw(a0) => a0.accept(c, v), Stmt_::Return(a0) => a0.accept(c, v), Stmt_::YieldBreak => Ok(()), Stmt_::Awaitall(a) => helper0(a, c, v), Stmt_::If(a) => helper1(a, c, v), Stmt_::Do(a) => helper2(a, c, v), Stmt_::While(a) => helper3(a, c, v), Stmt_::Using(a0) => a0.accept(c, v), Stmt_::For(a) => helper4(a, c, v), Stmt_::Switch(a) => helper5(a, c, v), Stmt_::Match(a0) => a0.accept(c, v), Stmt_::Foreach(a) => helper6(a, c, v), Stmt_::Try(a) => helper7(a, c, v), Stmt_::Noop => Ok(()), Stmt_::DeclareLocal(a) => helper8(a, c, v), Stmt_::Block(a0) => a0.accept(c, v), Stmt_::Markup(a0) => a0.accept(c, v), Stmt_::AssertEnv(a) => helper9(a, c, v), } } } impl<P: Params> NodeMut<P> for Targ<P::Ex> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_targ(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.0)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for Tparam<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_tparam(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.variance.accept(c, v)?; self.name.accept(c, v)?; self.parameters.accept(c, v)?; self.constraints.accept(c, v)?; self.reified.accept(c, v)?; self.user_attributes.accept(c, v) } } impl<P: Params> NodeMut<P> for Tprim { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_tprim(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Tprim::Tnull => Ok(()), Tprim::Tvoid => Ok(()), Tprim::Tint => Ok(()), Tprim::Tbool => Ok(()), Tprim::Tfloat => Ok(()), Tprim::Tstring => Ok(()), Tprim::Tresource => Ok(()), Tprim::Tnum => Ok(()), Tprim::Tarraykey => Ok(()), Tprim::Tnoreturn => Ok(()), } } } impl<P: Params> NodeMut<P> for TypeHint<P::Ex> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_hint(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_ex(c, &mut self.0)?; self.1.accept(c, v) } } impl<P: Params> NodeMut<P> for TypeRefinement { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_refinement(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { TypeRefinement::TRexact(a0) => a0.accept(c, v), TypeRefinement::TRloose(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for TypeRefinementBounds { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_type_refinement_bounds(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.lower.accept(c, v)?; self.upper.accept(c, v) } } impl<P: Params> NodeMut<P> for Typedef<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_typedef(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_en(c, &mut self.annotation)?; self.name.accept(c, v)?; self.tparams.accept(c, v)?; self.as_constraint.accept(c, v)?; self.super_constraint.accept(c, v)?; self.kind.accept(c, v)?; self.user_attributes.accept(c, v)?; self.file_attributes.accept(c, v)?; self.mode.accept(c, v)?; self.vis.accept(c, v)?; self.namespace.accept(c, v)?; self.span.accept(c, v)?; self.emit_id.accept(c, v)?; self.is_ctx.accept(c, v)?; self.internal.accept(c, v)?; self.module.accept(c, v)?; self.docs_url.accept(c, v)?; self.doc_comment.accept(c, v) } } impl<P: Params> NodeMut<P> for TypedefVisibility { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_typedef_visibility(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { TypedefVisibility::Transparent => Ok(()), TypedefVisibility::Opaque => Ok(()), TypedefVisibility::OpaqueModule => Ok(()), TypedefVisibility::CaseType => Ok(()), } } } impl<P: Params> NodeMut<P> for Uop { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_uop(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Uop::Utild => Ok(()), Uop::Unot => Ok(()), Uop::Uplus => Ok(()), Uop::Uminus => Ok(()), Uop::Uincr => Ok(()), Uop::Udecr => Ok(()), Uop::Upincr => Ok(()), Uop::Updecr => Ok(()), Uop::Usilence => Ok(()), } } } impl<P: Params> NodeMut<P> for UserAttribute<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_user_attribute(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.name.accept(c, v)?; self.params.accept(c, v) } } impl<P: Params> NodeMut<P> for UserAttributes<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_user_attributes(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v) } } impl<P: Params> NodeMut<P> for UsingStmt<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_using_stmt(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.is_block_scoped.accept(c, v)?; self.has_await.accept(c, v)?; self.exprs.accept(c, v)?; self.block.accept(c, v) } } impl<P: Params> NodeMut<P> for Variance { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_variance(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Variance::Covariant => Ok(()), Variance::Contravariant => Ok(()), Variance::Invariant => Ok(()), } } } impl<P: Params> NodeMut<P> for VcKind { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_vc_kind(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { VcKind::Vector => Ok(()), VcKind::ImmVector => Ok(()), VcKind::Vec => Ok(()), VcKind::Set => Ok(()), VcKind::ImmSet => Ok(()), VcKind::Keyset => Ok(()), } } } impl<P: Params> NodeMut<P> for Visibility { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_visibility(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { Visibility::Private => Ok(()), Visibility::Public => Ok(()), Visibility::Protected => Ok(()), Visibility::Internal => Ok(()), } } } impl<P: Params> NodeMut<P> for WhereConstraintHint { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_where_constraint_hint(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v) } } impl<P: Params> NodeMut<P> for XhpAttr<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.0.accept(c, v)?; self.1.accept(c, v)?; self.2.accept(c, v)?; self.3.accept(c, v) } } impl<P: Params> NodeMut<P> for XhpAttrInfo { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr_info(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.like.accept(c, v)?; self.tag.accept(c, v)?; self.enum_values.accept(c, v) } } impl<P: Params> NodeMut<P> for XhpAttrTag { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attr_tag(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpAttrTag::Required => Ok(()), XhpAttrTag::LateInit => Ok(()), } } } impl<P: Params> NodeMut<P> for XhpAttribute<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_attribute(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpAttribute::XhpSimple(a0) => a0.accept(c, v), XhpAttribute::XhpSpread(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for XhpChild { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_child(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpChild::ChildName(a0) => a0.accept(c, v), XhpChild::ChildList(a0) => a0.accept(c, v), XhpChild::ChildUnary(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } XhpChild::ChildBinary(a0, a1) => { a0.accept(c, v)?; a1.accept(c, v) } } } } impl<P: Params> NodeMut<P> for XhpChildOp { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_child_op(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpChildOp::ChildStar => Ok(()), XhpChildOp::ChildPlus => Ok(()), XhpChildOp::ChildQuestion => Ok(()), } } } impl<P: Params> NodeMut<P> for XhpEnumValue { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_enum_value(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { match self { XhpEnumValue::XEVInt(a0) => a0.accept(c, v), XhpEnumValue::XEVString(a0) => a0.accept(c, v), } } } impl<P: Params> NodeMut<P> for XhpSimple<P::Ex, P::En> { fn accept<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { v.visit_xhp_simple(c, self) } fn recurse<'node>( &'node mut self, c: &mut P::Context, v: &mut dyn VisitorMut<'node, Params = P>, ) -> Result<(), P::Error> { self.name.accept(c, v)?; v.visit_ex(c, &mut self.type_)?; self.expr.accept(c, v) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/type_params.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<ebc921d10d8d69681cbb2e890c14dca7>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub trait Params { type Context; type Error; type Ex; type En; }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/visitor.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<4f35e079ad72abd142dbbda23b95e5ad>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_imports)] #![allow(unused_variables)] use super::node::Node; use super::type_params::Params; use crate::aast_defs::*; use crate::aast_defs::{self}; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::*; pub fn visit<'node, P: Params>( v: &mut impl Visitor<'node, Params = P>, c: &mut P::Context, p: &'node impl Node<P>, ) -> Result<(), P::Error> { p.accept(c, v) } pub trait Visitor<'node> { type Params: Params; fn object(&mut self) -> &mut dyn Visitor<'node, Params = Self::Params>; fn visit_ex( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node <Self::Params as Params>::Ex, ) -> Result<(), <Self::Params as Params>::Error> { Ok(()) } fn visit_en( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node <Self::Params as Params>::En, ) -> Result<(), <Self::Params as Params>::Error> { Ok(()) } fn visit_abstraction( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Abstraction, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_afield( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Afield<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_as_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node AsExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_binop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Binop<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_block( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Block<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_bop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Bop, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_call_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node CallExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_capture_lid( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node CaptureLid<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_case( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Case<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_catch( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Catch<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_abstract_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassAbstractTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_concrete_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassConcreteTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_const( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassConst<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_const_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassConstKind<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_get_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassGetExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassId<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_id_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassId_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_req( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassReq, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_typeconst_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassTypeconstDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_var( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassVar<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Class_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_classish_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ClassishKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_collection_targ( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node CollectionTarg<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_constraint_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ConstraintKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_contexts( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Contexts, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ctx_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node CtxRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ctx_refinement_bounds( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node CtxRefinementBounds, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Def<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_default_case( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node DefaultCase<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_efun( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Efun<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_emit_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node EmitId, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_enum_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Enum_, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_env_annot( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node EnvAnnot, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Expr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expr_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Expr_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expression_tree( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ExpressionTree<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_field( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Field<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_file_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FileAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_finally_block( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FinallyBlock<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FunDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FunKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_param( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FunParam<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Fun_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_func_body( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FuncBody<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_function_ptr_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node FunctionPtrId<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_gconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Gconst<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hf_param_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node HfParamInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Hint, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint_fun( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node HintFun, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Hint_, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hole_source( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node HoleSource, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Id, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_import_flavor( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ImportFlavor, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_kvc_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node KvcKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_lid( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Lid, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_md_name_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node MdNameKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_method_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Method_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_module_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ModuleDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_nast_shape_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node NastShapeInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ns_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node NsKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_og_null_flavor( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node OgNullFlavor, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_param_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ParamKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pat_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node PatRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pat_var( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node PatVar, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pattern( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Pattern, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_program( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Program<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_prop_or_method( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node PropOrMethod, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_readonly_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ReadonlyKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Refinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_reify_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ReifyKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_require_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node RequireKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_shape_field_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ShapeFieldInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_shape_field_name( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node ShapeFieldName, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Stmt<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_match( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node StmtMatch<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_match_arm( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node StmtMatchArm<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Stmt_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_targ( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Targ<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_tparam( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Tparam<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_tprim( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Tprim, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node TypeHint<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node TypeRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_refinement_bounds( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node TypeRefinementBounds, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_typedef( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Typedef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_typedef_visibility( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node TypedefVisibility, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_uop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Uop, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_user_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node UserAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_user_attributes( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node UserAttributes<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_using_stmt( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node UsingStmt<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_variance( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Variance, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_vc_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node VcKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_visibility( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node Visibility, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_where_constraint_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node WhereConstraintHint, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpAttr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpAttrInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr_tag( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpAttrTag, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_child( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpChild, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_child_op( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpChildOp, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_enum_value( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpEnumValue, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_simple( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node XhpSimple<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } }
Rust
hhvm/hphp/hack/src/oxidized/aast_visitor/visitor_mut.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<420653060b681d7804a8294223711ed2>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_imports)] #![allow(unused_variables)] use super::node_mut::NodeMut; use super::type_params::Params; use crate::aast_defs::*; use crate::aast_defs::{self}; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::*; pub fn visit<'node, P: Params>( v: &mut impl VisitorMut<'node, Params = P>, c: &mut P::Context, p: &'node mut impl NodeMut<P>, ) -> Result<(), P::Error> { p.accept(c, v) } pub trait VisitorMut<'node> { type Params: Params; fn object(&mut self) -> &mut dyn VisitorMut<'node, Params = Self::Params>; fn visit_ex( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut <Self::Params as Params>::Ex, ) -> Result<(), <Self::Params as Params>::Error> { Ok(()) } fn visit_en( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut <Self::Params as Params>::En, ) -> Result<(), <Self::Params as Params>::Error> { Ok(()) } fn visit_abstraction( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Abstraction, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_afield( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Afield<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_as_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut AsExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_binop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Binop<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_block( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Block<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_bop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Bop, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_call_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut CallExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_capture_lid( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut CaptureLid<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_case( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Case<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_catch( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Catch<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_abstract_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassAbstractTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_concrete_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassConcreteTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_const( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassConst<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_const_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassConstKind<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_get_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassGetExpr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassId<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_id_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassId_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_req( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassReq, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_typeconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassTypeconst, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_typeconst_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassTypeconstDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_var( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassVar<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_class_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Class_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_classish_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ClassishKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_collection_targ( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut CollectionTarg<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_constraint_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ConstraintKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_contexts( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Contexts, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ctx_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut CtxRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ctx_refinement_bounds( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut CtxRefinementBounds, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Def<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_default_case( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut DefaultCase<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_efun( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Efun<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_emit_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut EmitId, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_enum_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Enum_, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_env_annot( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut EnvAnnot, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Expr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expr_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Expr_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_expression_tree( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ExpressionTree<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_field( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Field<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_file_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FileAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_finally_block( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FinallyBlock<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FunDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FunKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_param( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FunParam<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_fun_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Fun_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_func_body( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FuncBody<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_function_ptr_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut FunctionPtrId<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_gconst( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Gconst<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hf_param_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut HfParamInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Hint, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint_fun( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut HintFun, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hint_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Hint_, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_hole_source( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut HoleSource, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_id( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Id, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_import_flavor( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ImportFlavor, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_kvc_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut KvcKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_lid( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Lid, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_md_name_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut MdNameKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_method_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Method_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_module_def( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ModuleDef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_nast_shape_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut NastShapeInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_ns_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut NsKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_og_null_flavor( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut OgNullFlavor, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_param_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ParamKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pat_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut PatRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pat_var( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut PatVar, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_pattern( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Pattern, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_program( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Program<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_prop_or_method( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut PropOrMethod, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_readonly_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ReadonlyKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Refinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_reify_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ReifyKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_require_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut RequireKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_shape_field_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ShapeFieldInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_shape_field_name( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut ShapeFieldName, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Stmt<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_match( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut StmtMatch<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_match_arm( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut StmtMatchArm<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_stmt_( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Stmt_<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_targ( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Targ<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_tparam( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Tparam<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_tprim( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Tprim, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut TypeHint<<Self::Params as Params>::Ex>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_refinement( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut TypeRefinement, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_type_refinement_bounds( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut TypeRefinementBounds, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_typedef( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Typedef<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_typedef_visibility( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut TypedefVisibility, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_uop( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Uop, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_user_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut UserAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_user_attributes( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut UserAttributes<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_using_stmt( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut UsingStmt<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_variance( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Variance, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_vc_kind( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut VcKind, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_visibility( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut Visibility, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_where_constraint_hint( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut WhereConstraintHint, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpAttr<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr_info( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpAttrInfo, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attr_tag( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpAttrTag, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_attribute( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpAttribute<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_child( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpChild, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_child_op( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpChildOp, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_enum_value( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpEnumValue, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } fn visit_xhp_simple( &mut self, c: &mut <Self::Params as Params>::Context, p: &'node mut XhpSimple<<Self::Params as Params>::Ex, <Self::Params as Params>::En>, ) -> Result<(), <Self::Params as Params>::Error> { p.recurse(c, self.object()) } }
Rust
hhvm/hphp/hack/src/oxidized/asts/ast.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<2aac5de012416a3ef9b43c670a1db6a6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use aast_defs::*; pub use ast_defs::*; use crate::aast_defs; use crate::ast_defs; #[doc = r" Expressions have no type annotation."] type Ex = (); #[doc = r#" Toplevel definitions and methods have no "environment" annotation."#] type En = (); pub type Program = aast_defs::Program<Ex, En>; pub type Stmt = aast_defs::Stmt<Ex, En>; pub type Stmt_ = aast_defs::Stmt_<Ex, En>; pub type UsingStmt = aast_defs::UsingStmt<Ex, En>; pub type AsExpr = aast_defs::AsExpr<Ex, En>; pub type Block = aast_defs::Block<Ex, En>; pub type FinallyBlock = aast_defs::FinallyBlock<Ex, En>; pub type StmtMatch = aast_defs::StmtMatch<Ex, En>; pub type StmtMatchArm = aast_defs::StmtMatchArm<Ex, En>; pub type ClassId = aast_defs::ClassId<Ex, En>; pub type ClassId_ = aast_defs::ClassId_<Ex, En>; pub type Expr = aast_defs::Expr<Ex, En>; pub type CollectionTarg = aast_defs::CollectionTarg<Ex>; pub type FunctionPtrId = aast_defs::FunctionPtrId<Ex, En>; pub type ExpressionTree = aast_defs::ExpressionTree<Ex, En>; pub type Expr_ = aast_defs::Expr_<Ex, En>; pub type Binop = aast_defs::Binop<Ex, En>; pub type ClassGetExpr = aast_defs::ClassGetExpr<Ex, En>; pub type Case = aast_defs::Case<Ex, En>; pub type DefaultCase = aast_defs::DefaultCase<Ex, En>; pub type GenCase = aast_defs::GenCase<Ex, En>; pub type Catch = aast_defs::Catch<Ex, En>; pub type Field = aast_defs::Field<Ex, En>; pub type Afield = aast_defs::Afield<Ex, En>; pub type XhpSimple = aast_defs::XhpSimple<Ex, En>; pub type XhpAttribute = aast_defs::XhpAttribute<Ex, En>; pub type FunParam = aast_defs::FunParam<Ex, En>; pub type Fun_ = aast_defs::Fun_<Ex, En>; pub type CaptureLid = aast_defs::CaptureLid<Ex>; pub type Efun = aast_defs::Efun<Ex, En>; pub type FuncBody = aast_defs::FuncBody<Ex, En>; pub type TypeHint = aast_defs::TypeHint<Ex>; pub type Targ = aast_defs::Targ<Ex>; pub type CallExpr = aast_defs::CallExpr<Ex, En>; pub type UserAttribute = aast_defs::UserAttribute<Ex, En>; pub type FileAttribute = aast_defs::FileAttribute<Ex, En>; pub type Tparam = aast_defs::Tparam<Ex, En>; pub type Class_ = aast_defs::Class_<Ex, En>; pub type XhpAttr = aast_defs::XhpAttr<Ex, En>; pub type ClassConstKind = aast_defs::ClassConstKind<Ex, En>; pub type ClassConst = aast_defs::ClassConst<Ex, En>; pub type ClassTypeconstDef = aast_defs::ClassTypeconstDef<Ex, En>; pub type ClassVar = aast_defs::ClassVar<Ex, En>; pub type Method_ = aast_defs::Method_<Ex, En>; pub type Typedef = aast_defs::Typedef<Ex, En>; pub type Gconst = aast_defs::Gconst<Ex, En>; pub type FunDef = aast_defs::FunDef<Ex, En>; pub type ModuleDef = aast_defs::ModuleDef<Ex, En>; pub type Def = aast_defs::Def<Ex, En>; pub type UserAttributes = aast_defs::UserAttributes<Ex, En>;
Rust
hhvm/hphp/hack/src/oxidized/asts/mod.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. pub mod ast; pub mod nast;
Rust
hhvm/hphp/hack/src/oxidized/asts/nast.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<2aac5de012416a3ef9b43c670a1db6a6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use aast_defs::*; pub use ast_defs::*; use crate::aast_defs; use crate::ast_defs; #[doc = r" Expressions have no type annotation."] type Ex = (); #[doc = r#" Toplevel definitions and methods have no "environment" annotation."#] type En = (); pub type Program = aast_defs::Program<Ex, En>; pub type Stmt = aast_defs::Stmt<Ex, En>; pub type Stmt_ = aast_defs::Stmt_<Ex, En>; pub type UsingStmt = aast_defs::UsingStmt<Ex, En>; pub type AsExpr = aast_defs::AsExpr<Ex, En>; pub type Block = aast_defs::Block<Ex, En>; pub type FinallyBlock = aast_defs::FinallyBlock<Ex, En>; pub type StmtMatch = aast_defs::StmtMatch<Ex, En>; pub type StmtMatchArm = aast_defs::StmtMatchArm<Ex, En>; pub type ClassId = aast_defs::ClassId<Ex, En>; pub type ClassId_ = aast_defs::ClassId_<Ex, En>; pub type Expr = aast_defs::Expr<Ex, En>; pub type CollectionTarg = aast_defs::CollectionTarg<Ex>; pub type FunctionPtrId = aast_defs::FunctionPtrId<Ex, En>; pub type ExpressionTree = aast_defs::ExpressionTree<Ex, En>; pub type Expr_ = aast_defs::Expr_<Ex, En>; pub type Binop = aast_defs::Binop<Ex, En>; pub type ClassGetExpr = aast_defs::ClassGetExpr<Ex, En>; pub type Case = aast_defs::Case<Ex, En>; pub type DefaultCase = aast_defs::DefaultCase<Ex, En>; pub type GenCase = aast_defs::GenCase<Ex, En>; pub type Catch = aast_defs::Catch<Ex, En>; pub type Field = aast_defs::Field<Ex, En>; pub type Afield = aast_defs::Afield<Ex, En>; pub type XhpSimple = aast_defs::XhpSimple<Ex, En>; pub type XhpAttribute = aast_defs::XhpAttribute<Ex, En>; pub type FunParam = aast_defs::FunParam<Ex, En>; pub type Fun_ = aast_defs::Fun_<Ex, En>; pub type CaptureLid = aast_defs::CaptureLid<Ex>; pub type Efun = aast_defs::Efun<Ex, En>; pub type FuncBody = aast_defs::FuncBody<Ex, En>; pub type TypeHint = aast_defs::TypeHint<Ex>; pub type Targ = aast_defs::Targ<Ex>; pub type CallExpr = aast_defs::CallExpr<Ex, En>; pub type UserAttribute = aast_defs::UserAttribute<Ex, En>; pub type FileAttribute = aast_defs::FileAttribute<Ex, En>; pub type Tparam = aast_defs::Tparam<Ex, En>; pub type Class_ = aast_defs::Class_<Ex, En>; pub type XhpAttr = aast_defs::XhpAttr<Ex, En>; pub type ClassConstKind = aast_defs::ClassConstKind<Ex, En>; pub type ClassConst = aast_defs::ClassConst<Ex, En>; pub type ClassTypeconstDef = aast_defs::ClassTypeconstDef<Ex, En>; pub type ClassVar = aast_defs::ClassVar<Ex, En>; pub type Method_ = aast_defs::Method_<Ex, En>; pub type Typedef = aast_defs::Typedef<Ex, En>; pub type Gconst = aast_defs::Gconst<Ex, En>; pub type FunDef = aast_defs::FunDef<Ex, En>; pub type ModuleDef = aast_defs::ModuleDef<Ex, En>; pub type Def = aast_defs::Def<Ex, En>; pub type UserAttributes = aast_defs::UserAttributes<Ex, En>;
Rust
hhvm/hphp/hack/src/oxidized/gen/aast_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<edc37d984fd8ec5d2942273f5f4672f3>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; pub use ast_defs::OgNullFlavor; pub use ast_defs::Pos; pub use ast_defs::PositionedByteString; pub use ast_defs::PropOrMethod; pub use ast_defs::Pstring; pub use ast_defs::ReifyKind; pub use ast_defs::Tprim; pub use ast_defs::TypedefVisibility; pub use ast_defs::Visibility; pub use local_id::LocalId; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C)] pub struct Lid(pub Pos, pub LocalId); #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type Sid = ast_defs::Id; #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type ClassName = Sid; /// Aast.program represents the top-level definitions in a Hack program. /// ex: Expression annotation type (when typechecking, the inferred type) /// en: Environment (tracking state inside functions and classes) #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Program<Ex, En>(pub Vec<Def<Ex, En>>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Stmt<Ex, En>(pub Pos, pub Stmt_<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Stmt_<Ex, En> { /// Marker for a switch statement that falls through. /// /// // FALLTHROUGH Fallthrough, /// Standalone expression. /// /// 1 + 2; Expr(Box<Expr<Ex, En>>), /// Break inside a loop or switch statement. /// /// break; Break, /// Continue inside a loop or switch statement. /// /// continue; Continue, /// Throw an exception. /// /// throw $foo; Throw(Box<Expr<Ex, En>>), /// Return, with an optional value. /// /// return; /// return $foo; Return(Box<Option<Expr<Ex, En>>>), /// Yield break, terminating the current generator. This behaves like /// return; but is more explicit, and ensures the function is treated /// as a generator. /// /// yield break; #[rust_to_ocaml(name = "Yield_break")] YieldBreak, /// Concurrent block. All the await expressions are awaited at the /// same time, similar to genva(). /// /// We store the desugared form. In the below example, the list is: /// [('__tmp$1', f()), (__tmp$2, g()), (None, h())] /// and the block assigns the temporary variables back to the locals. /// { $foo = __tmp$1; $bar = __tmp$2; } /// /// concurrent { /// $foo = await f(); /// $bar = await g(); /// await h(); /// } #[rust_to_ocaml(inline_tuple)] Awaitall(Box<(Vec<(Option<Lid>, Expr<Ex, En>)>, Block<Ex, En>)>), /// If statement. /// /// if ($foo) { ... } else { ... } #[rust_to_ocaml(inline_tuple)] If(Box<(Expr<Ex, En>, Block<Ex, En>, Block<Ex, En>)>), /// Do-while loop. /// /// do { /// bar(); /// } while($foo) #[rust_to_ocaml(inline_tuple)] Do(Box<(Block<Ex, En>, Expr<Ex, En>)>), /// While loop. /// /// while ($foo) { /// bar(); /// } #[rust_to_ocaml(inline_tuple)] While(Box<(Expr<Ex, En>, Block<Ex, En>)>), /// Initialize a value that is automatically disposed of. /// /// using $foo = bar(); // disposed at the end of the function /// using ($foo = bar(), $baz = quux()) {} // disposed after the block Using(Box<UsingStmt<Ex, En>>), /// For loop. The initializer and increment parts can include /// multiple comma-separated statements. The termination condition is /// optional. /// /// for ($i = 0; $i < 100; $i++) { ... } /// for ($x = 0, $y = 0; ; $x++, $y++) { ... } #[rust_to_ocaml(inline_tuple)] For( Box<( Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Vec<Expr<Ex, En>>, Block<Ex, En>, )>, ), /// Switch statement. /// /// switch ($foo) { /// case X: /// bar(); /// break; /// default: /// baz(); /// break; /// } #[rust_to_ocaml(inline_tuple)] Switch(Box<(Expr<Ex, En>, Vec<Case<Ex, En>>, Option<DefaultCase<Ex, En>>)>), /// Match statement. /// /// match ($x) { /// _: FooClass => { /// foo($x); /// } /// _ => { /// bar(); /// } /// } Match(Box<StmtMatch<Ex, En>>), /// For-each loop. /// /// foreach ($items as $item) { ... } /// foreach ($items as $key => value) { ... } /// foreach ($items await as $item) { ... } // AsyncIterator<_> /// foreach ($items await as $key => value) { ... } // AsyncKeyedIterator<_> #[rust_to_ocaml(inline_tuple)] Foreach(Box<(Expr<Ex, En>, AsExpr<Ex, En>, Block<Ex, En>)>), /// Try statement, with catch blocks and a finally block. /// /// try { /// foo(); /// } catch (SomeException $e) { /// bar(); /// } finally { /// baz(); /// } #[rust_to_ocaml(inline_tuple)] Try(Box<(Block<Ex, En>, Vec<Catch<Ex, En>>, FinallyBlock<Ex, En>)>), /// No-op, the empty statement. /// /// {} /// while (true) ; /// if ($foo) {} // the else is Noop here Noop, /// Declare a local variable with the given type and optional initial value #[rust_to_ocaml(name = "Declare_local")] #[rust_to_ocaml(inline_tuple)] DeclareLocal(Box<(Lid, Hint, Option<Expr<Ex, En>>)>), /// Block, a list of statements in curly braces. /// /// { $foo = 42; } Block(Block<Ex, En>), /// The mode tag at the beginning of a file. /// TODO: this really belongs in def. /// /// <?hh #[rust_to_ocaml(attr = "transform.opaque")] Markup(Box<Pstring>), /// Used in IFC to track type inference environments. Not user /// denotable. #[rust_to_ocaml(attr = "transform.opaque")] #[rust_to_ocaml(inline_tuple)] AssertEnv(Box<(EnvAnnot, LocalIdMap<(Pos, Ex)>)>), } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum EnvAnnot { Join, Refinement, } impl TrivialDrop for EnvAnnot {} arena_deserializer::impl_deserialize_in_arena!(EnvAnnot); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "us_")] #[repr(C)] pub struct UsingStmt<Ex, En> { pub is_block_scoped: bool, pub has_await: bool, pub exprs: (Pos, Vec<Expr<Ex, En>>), pub block: Block<Ex, En>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum AsExpr<Ex, En> { #[rust_to_ocaml(name = "As_v")] AsV(Expr<Ex, En>), #[rust_to_ocaml(name = "As_kv")] AsKv(Expr<Ex, En>, Expr<Ex, En>), #[rust_to_ocaml(name = "Await_as_v")] AwaitAsV(Pos, Expr<Ex, En>), #[rust_to_ocaml(name = "Await_as_kv")] AwaitAsKv(Pos, Expr<Ex, En>, Expr<Ex, En>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Block<Ex, En>(pub Vec<Stmt<Ex, En>>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct FinallyBlock<Ex, En>(pub Vec<Stmt<Ex, En>>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sm_")] #[repr(C)] pub struct StmtMatch<Ex, En> { pub expr: Expr<Ex, En>, pub arms: Vec<StmtMatchArm<Ex, En>>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sma_")] #[repr(C)] pub struct StmtMatchArm<Ex, En> { pub pat: Pattern, pub body: Block<Ex, En>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Pattern { /// Variable patterns PVar(Box<PatVar>), /// Refinement patterns PRefinement(Box<PatRefinement>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "pv_")] #[repr(C)] pub struct PatVar { #[rust_to_ocaml(attr = "transform.opaque")] pub pos: Pos, pub id: Option<Lid>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "pr_")] #[repr(C)] pub struct PatRefinement { #[rust_to_ocaml(attr = "transform.opaque")] pub pos: Pos, pub id: Option<Lid>, pub hint: Hint, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassId<Ex, En>(pub Ex, pub Pos, pub ClassId_<Ex, En>); /// Class ID, used in things like instantiation and static property access. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassId_<Ex, En> { /// The class ID of the parent of the lexically scoped class. /// /// In a trait, it is the parent class ID of the using class. /// /// parent::some_meth() /// parent::$prop = 1; /// new parent(); CIparent, /// The class ID of the lexically scoped class. /// /// In a trait, it is the class ID of the using class. /// /// self::some_meth() /// self::$prop = 1; /// new self(); CIself, /// The class ID of the late static bound class. /// /// https://www.php.net/manual/en/language.oop5.late-static-bindings.php /// /// In a trait, it is the late static bound class ID of the using class. /// /// static::some_meth() /// static::$prop = 1; /// new static(); CIstatic, /// Dynamic class name. /// /// TODO: Syntactically this can only be an Lvar/This/Lplaceholder. /// We should use lid rather than expr. /// /// // Assume $d has type dynamic. /// $d::some_meth(); /// $d::$prop = 1; /// new $d(); CIexpr(Expr<Ex, En>), /// Explicit class name. This is the common case. /// /// Foo::some_meth() /// Foo::$prop = 1; /// new Foo(); CI(ClassName), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Expr<Ex, En>(pub Ex, pub Pos, pub Expr_<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum CollectionTarg<Ex> { CollectionTV(Targ<Ex>), CollectionTKV(Targ<Ex>, Targ<Ex>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum FunctionPtrId<Ex, En> { #[rust_to_ocaml(name = "FP_id")] FPId(Sid), /// An expression tree literal consists of a hint, splices, and /// expressions. Consider this example: /// /// Foo`1 + ${$x} + ${bar()}` #[rust_to_ocaml(name = "FP_class_const")] FPClassConst(ClassId<Ex, En>, Pstring), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "et_")] #[repr(C)] pub struct ExpressionTree<Ex, En> { /// The hint before the backtick, so Foo in this example. pub hint: Hint, /// The values spliced into expression tree at runtime are assigned /// to temporaries. /// /// $0tmp1 = $x; $0tmp2 = bar(); pub splices: Vec<Stmt<Ex, En>>, /// The list of global functions and static methods assigned to /// temporaries. /// /// $0fp1 = foo<>; pub function_pointers: Vec<Stmt<Ex, En>>, /// The expression that gets type checked. /// /// 1 + $0tmp1 + $0tmp2 pub virtualized_expr: Expr<Ex, En>, /// The expression that's executed at runtime. /// /// Foo::makeTree($v ==> $v->visitBinOp(...)) pub runtime_expr: Expr<Ex, En>, /// Position of the first $$ in a splice that refers /// to a variable outside the Expression Tree /// /// $x |> Code`${ $$ }` // Pos of the $$ /// Code`${ $x |> foo($$) }` // None #[rust_to_ocaml(attr = "transform.opaque")] pub dollardollar_pos: Option<Pos>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Expr_<Ex, En> { /// darray literal. /// /// darray['x' => 0, 'y' => 1] /// darray<string, int>['x' => 0, 'y' => 1] #[rust_to_ocaml(inline_tuple)] Darray( Box<( Option<(Targ<Ex>, Targ<Ex>)>, Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )>, ), /// varray literal. /// /// varray['hello', 'world'] /// varray<string>['hello', 'world'] #[rust_to_ocaml(inline_tuple)] Varray(Box<(Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>), /// Shape literal. /// /// shape('x' => 1, 'y' => 2) Shape(Vec<(ast_defs::ShapeFieldName, Expr<Ex, En>)>), /// Collection literal for indexable structures. /// /// Vector {1, 2} /// ImmVector {} /// Set<string> {'foo', 'bar'} /// vec[1, 2] /// keyset[] #[rust_to_ocaml(inline_tuple)] ValCollection(Box<((Pos, VcKind), Option<Targ<Ex>>, Vec<Expr<Ex, En>>)>), /// Collection literal for key-value structures. /// /// dict['x' => 1, 'y' => 2] /// Map<int, string> {} /// ImmMap {} #[rust_to_ocaml(inline_tuple)] KeyValCollection( Box<( (Pos, KvcKind), Option<(Targ<Ex>, Targ<Ex>)>, Vec<Field<Ex, En>>, )>, ), /// Null literal. /// /// null Null, /// The local variable representing the current class instance. /// /// $this This, /// Boolean literal. /// /// true True, /// Boolean literal. /// /// false False, /// The empty expression. /// /// list(, $y) = vec[1, 2] // Omitted is the first expression inside list() Omitted, /// Invalid expression marker generated during elaboration / validation phases /// /// class MyFoo { /// const int BAR = calls_are_invalid_here(); /// } Invalid(Box<Option<Expr<Ex, En>>>), /// An identifier. Used for method names and global constants. /// /// SOME_CONST /// $x->foo() // id: "foo" Id(Box<Sid>), /// Local variable. /// /// $foo Lvar(Box<Lid>), /// The extra variable in a pipe expression. /// /// $$ Dollardollar(Box<Lid>), /// Clone expression. /// /// clone $foo Clone(Box<Expr<Ex, En>>), /// Array indexing. /// /// $foo[] /// $foo[$bar] #[rust_to_ocaml(name = "Array_get")] #[rust_to_ocaml(inline_tuple)] ArrayGet(Box<(Expr<Ex, En>, Option<Expr<Ex, En>>)>), /// Instance property or method access. /// /// $foo->bar // OG_nullthrows, Is_prop: access named property /// ($foo->bar)() // OG_nullthrows, Is_prop: call lambda stored in named property /// $foo?->bar // OG_nullsafe, Is_prop /// ($foo?->bar)() // OG_nullsafe, Is_prop /// /// $foo->bar() // OG_nullthrows, Is_method: call named method /// $foo->$bar() // OG_nullthrows, Is_method: dynamic call, method name stored in local $bar /// $foo?->bar() // OG_nullsafe, Is_method /// $foo?->$bar() // OG_nullsafe, Is_method /// /// prop_or_method is: /// - Is_prop for property access /// - Is_method for method call, only possible when the node is the receiver in a Call node. #[rust_to_ocaml(name = "Obj_get")] #[rust_to_ocaml(inline_tuple)] ObjGet(Box<(Expr<Ex, En>, Expr<Ex, En>, OgNullFlavor, PropOrMethod)>), /// Static property or dynamic method access. The rhs of the :: begins /// with $ or is some non-name expression appearing within braces {}. /// /// Foo::$bar // Is_prop: access named static property /// Foo::{$bar} // Is_prop /// (Foo::$bar)(); // Is_prop: call lambda stored in static property Foo::$bar /// $classname::$bar // Is_prop /// /// Foo::$bar(); // Is_method: dynamic call, method name stored in local $bar /// Foo::{$bar}(); // Is_method #[rust_to_ocaml(name = "Class_get")] #[rust_to_ocaml(inline_tuple)] ClassGet(Box<(ClassId<Ex, En>, ClassGetExpr<Ex, En>, PropOrMethod)>), /// Class constant or static method call. As a standalone expression, /// this is a class constant. Inside a Call node, this is a static /// method call. The rhs of the :: does not begin with $ or is a name /// appearing within braces {}. /// /// This is not ambiguous, because constants are not allowed to /// contain functions. /// /// Foo::some_const // Const /// Foo::{another_const} // Const: braces are elided /// Foo::class // Const: fully qualified class name of Foo /// Foo::staticMeth() // Call /// $classname::staticMeth() // Call /// /// This syntax is used for both static and instance methods when /// calling the implementation on the superclass. /// /// parent::someStaticMeth() /// parent::someInstanceMeth() #[rust_to_ocaml(name = "Class_const")] #[rust_to_ocaml(inline_tuple)] ClassConst(Box<(ClassId<Ex, En>, Pstring)>), /// Function or method call. /// /// foo() /// $x() /// foo<int>(1, 2, ...$rest) /// $x->foo() /// bar(inout $x); /// foobar(inout $x[0]) /// /// async { return 1; } /// // lowered to: /// (async () ==> { return 1; })() Call(Box<CallExpr<Ex, En>>), /// A reference to a function or method. /// /// foo_fun<> /// FooCls::meth<int> #[rust_to_ocaml(inline_tuple)] FunctionPointer(Box<(FunctionPtrId<Ex, En>, Vec<Targ<Ex>>)>), /// Integer literal. /// /// 42 /// 0123 // octal /// 0xBEEF // hexadecimal /// 0b11111111 // binary Int(String), /// Float literal. /// /// 1.0 /// 1.2e3 /// 7E-10 Float(String), /// String literal. /// /// "foo" /// 'foo' /// /// <<<DOC /// foo /// DOC /// /// <<<'DOC' /// foo /// DOC #[rust_to_ocaml(attr = "transform.opaque")] String(bstr::BString), /// Interpolated string literal. /// /// "hello $foo $bar" /// /// <<<DOC /// hello $foo $bar /// DOC String2(Vec<Expr<Ex, En>>), /// Prefixed string literal. Only used for regular expressions. /// /// re"foo" #[rust_to_ocaml(inline_tuple)] PrefixedString(Box<(String, Expr<Ex, En>)>), /// Yield expression. The enclosing function should have an Iterator /// return type. /// /// yield $foo // enclosing function returns an Iterator /// yield $foo => $bar // enclosing function returns a KeyedIterator Yield(Box<Afield<Ex, En>>), /// Await expression. /// /// await $foo Await(Box<Expr<Ex, En>>), /// Readonly expression. /// /// readonly $foo ReadonlyExpr(Box<Expr<Ex, En>>), /// Tuple expression. /// /// tuple("a", 1, $foo) Tuple(Vec<Expr<Ex, En>>), /// List expression, only used in destructuring. Allows any arbitrary /// lvalue as a subexpression. May also nest. /// /// list($x, $y) = vec[1, 2]; /// list(, $y) = vec[1, 2]; // skipping items /// list(list($x)) = vec[vec[1]]; // nesting /// list($v[0], $x[], $y->foo) = $blah; List(Vec<Expr<Ex, En>>), /// Cast expression, converting a value to a different type. Only /// primitive types are supported in the hint position. /// /// (int)$foo /// (string)$foo #[rust_to_ocaml(inline_tuple)] Cast(Box<(Hint, Expr<Ex, En>)>), /// Unary operator. /// /// !$foo /// -$foo /// +$foo /// $foo++ #[rust_to_ocaml(inline_tuple)] Unop(Box<(ast_defs::Uop, Expr<Ex, En>)>), /// Binary operator. /// /// $foo + $bar Binop(Box<Binop<Ex, En>>), /// Pipe expression. The lid is the ID of the $$ that is implicitly /// declared by this pipe. /// /// See also Dollardollar. /// /// foo() |> bar(1, $$) // equivalent: bar(1, foo()) /// /// $$ is not required on the RHS of pipe expressions, but it's /// pretty pointless to use pipes without $$. /// /// foo() |> bar(); // equivalent: foo(); bar(); #[rust_to_ocaml(inline_tuple)] Pipe(Box<(Lid, Expr<Ex, En>, Expr<Ex, En>)>), /// Ternary operator, or elvis operator. /// /// $foo ? $bar : $baz // ternary /// $foo ?: $baz // elvis #[rust_to_ocaml(inline_tuple)] Eif(Box<(Expr<Ex, En>, Option<Expr<Ex, En>>, Expr<Ex, En>)>), /// Is operator. /// /// $foo is SomeType #[rust_to_ocaml(inline_tuple)] Is(Box<(Expr<Ex, En>, Hint)>), /// As operator. /// /// $foo as int /// $foo ?as int #[rust_to_ocaml(inline_tuple)] As(Box<(Expr<Ex, En>, Hint, bool)>), /// Upcast operator. /// /// $foo : int #[rust_to_ocaml(inline_tuple)] Upcast(Box<(Expr<Ex, En>, Hint)>), /// Instantiation. /// /// new Foo(1, 2); /// new Foo<int, T>(); /// new Foo('blah', ...$rest); #[rust_to_ocaml(inline_tuple)] New( Box<( ClassId<Ex, En>, Vec<Targ<Ex>>, Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Ex, )>, ), /// PHP-style lambda. Does not capture variables unless explicitly /// specified. /// /// Mnemonic: 'expanded lambda', since we can desugar Lfun to Efun. /// /// function($x) { return $x; } /// function(int $x): int { return $x; } /// function($x) use ($y) { return $y; } /// function($x): int use ($y, $z) { return $x + $y + $z; } Efun(Box<Efun<Ex, En>>), /// Hack lambda. Captures variables automatically. /// /// $x ==> $x /// (int $x): int ==> $x + $other /// ($x, $y) ==> { return $x + $y; } #[rust_to_ocaml(inline_tuple)] Lfun(Box<(Fun_<Ex, En>, Vec<CaptureLid<Ex>>)>), /// XHP expression. May contain interpolated expressions. /// /// <foo x="hello" y={$foo}>hello {$bar}</foo> #[rust_to_ocaml(inline_tuple)] Xml(Box<(ClassName, Vec<XhpAttribute<Ex, En>>, Vec<Expr<Ex, En>>)>), /// Include or require expression. /// /// require('foo.php') /// require_once('foo.php') /// include('foo.php') /// include_once('foo.php') #[rust_to_ocaml(inline_tuple)] Import(Box<(ImportFlavor, Expr<Ex, En>)>), /// Collection literal. /// /// TODO: T38184446 this is redundant with ValCollection/KeyValCollection. /// /// Vector {} #[rust_to_ocaml(inline_tuple)] Collection(Box<(ClassName, Option<CollectionTarg<Ex>>, Vec<Afield<Ex, En>>)>), /// Expression tree literal. Expression trees are not evaluated at /// runtime, but desugared to an expression representing the code. /// /// Foo`1 + bar()` /// Foo`(() ==> { while(true) {} })()` // not an infinite loop at runtime /// /// Splices are evaluated as normal Hack code. The following two expression trees /// are equivalent. See also `ET_Splice`. /// /// Foo`1 + ${do_stuff()}` /// /// $x = do_stuff(); /// Foo`1 + ${$x}` ExpressionTree(Box<ExpressionTree<Ex, En>>), /// Placeholder local variable. /// /// $_ #[rust_to_ocaml(attr = "transform.opaque")] Lplaceholder(Box<Pos>), /// Instance method reference that can be called with an instance. /// /// meth_caller(FooClass::class, 'some_meth') /// meth_caller('FooClass', 'some_meth') /// /// These examples are equivalent to: /// /// (FooClass $f, ...$args) ==> $f->some_meth(...$args) #[rust_to_ocaml(name = "Method_caller")] #[rust_to_ocaml(inline_tuple)] MethodCaller(Box<(ClassName, Pstring)>), /// Pair literal. /// /// Pair {$foo, $bar} #[rust_to_ocaml(inline_tuple)] Pair(Box<(Option<(Targ<Ex>, Targ<Ex>)>, Expr<Ex, En>, Expr<Ex, En>)>), /// Expression tree splice expression. Only valid inside an /// expression tree literal (backticks). See also `ExpressionTree`. /// /// ${$foo} #[rust_to_ocaml(name = "ET_Splice")] ETSplice(Box<Expr<Ex, En>>), /// Label used for enum classes. /// /// enum_name#label_name or #label_name #[rust_to_ocaml(inline_tuple)] EnumClassLabel(Box<(Option<ClassName>, String)>), /// Annotation used to record failure in subtyping or coercion of an /// expression and calls to [unsafe_cast] or [enforced_cast]. /// /// The [hole_source] indicates whether this came from an /// explicit call to [unsafe_cast] or [enforced_cast] or was /// generated during typing. /// /// Given a call to [unsafe_cast]: /// ``` /// function f(int $x): void { /* ... */ } /// /// function g(float $x): void { /// f(unsafe_cast<float,int>($x)); /// } /// ``` /// After typing, this is represented by the following TAST fragment /// ``` /// Call /// ( ( (..., function(int $x): void), Id (..., "\f")) /// , [] /// , [ ( (..., int) /// , Hole /// ( ((..., float), Lvar (..., $x)) /// , float /// , int /// , UnsafeCast /// ) /// ) /// ] /// , None /// ) /// ``` #[rust_to_ocaml(inline_tuple)] Hole(Box<(Expr<Ex, En>, Ex, Ex, HoleSource)>), /// Expression used to check whether a package exists. /// /// package package-name Package(Box<Sid>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum HoleSource { Typing, UnsafeCast(Vec<Hint>), UnsafeNonnullCast, EnforcedCast(Vec<Hint>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Binop<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub bop: ast_defs::Bop, #[rust_to_ocaml(attr = "transform.explicit")] pub lhs: Expr<Ex, En>, #[rust_to_ocaml(attr = "transform.explicit")] pub rhs: Expr<Ex, En>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassGetExpr<Ex, En> { CGstring(Pstring), CGexpr(Expr<Ex, En>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Case<Ex, En>(pub Expr<Ex, En>, pub Block<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct DefaultCase<Ex, En>(pub Pos, pub Block<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum GenCase<Ex, En> { Case(Case<Ex, En>), Default(DefaultCase<Ex, En>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Catch<Ex, En>(pub ClassName, pub Lid, pub Block<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Field<Ex, En>(pub Expr<Ex, En>, pub Expr<Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Afield<Ex, En> { AFvalue(Expr<Ex, En>), AFkvalue(Expr<Ex, En>, Expr<Ex, En>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "xs_")] #[repr(C)] pub struct XhpSimple<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub name: Pstring, pub type_: Ex, pub expr: Expr<Ex, En>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum XhpAttribute<Ex, En> { #[rust_to_ocaml(name = "Xhp_simple")] XhpSimple(XhpSimple<Ex, En>), #[rust_to_ocaml(name = "Xhp_spread")] XhpSpread(Expr<Ex, En>), } #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type IsVariadic = bool; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "param_")] #[repr(C)] pub struct FunParam<Ex, En> { pub annotation: Ex, pub type_hint: TypeHint<Ex>, pub is_variadic: IsVariadic, #[rust_to_ocaml(attr = "transform.opaque")] pub pos: Pos, pub name: String, pub expr: Option<Expr<Ex, En>>, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly: Option<ast_defs::ReadonlyKind>, #[rust_to_ocaml(attr = "transform.opaque")] pub callconv: ast_defs::ParamKind, pub user_attributes: UserAttributes<Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: Option<Visibility>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "f_")] #[repr(C)] pub struct Fun_<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_this: Option<ast_defs::ReadonlyKind>, pub annotation: En, /// Whether the return value is readonly #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_ret: Option<ast_defs::ReadonlyKind>, #[rust_to_ocaml(attr = "transform.explicit")] pub ret: TypeHint<Ex>, pub params: Vec<FunParam<Ex, En>>, pub ctxs: Option<Contexts>, pub unsafe_ctxs: Option<Contexts>, pub body: FuncBody<Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub fun_kind: ast_defs::FunKind, pub user_attributes: UserAttributes<Ex, En>, /// true if this declaration has no body because it is an /// external function declaration (e.g. from an HHI file) pub external: bool, pub doc_comment: Option<DocComment>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct CaptureLid<Ex>(pub Ex, pub Lid); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ef_")] #[repr(C)] pub struct Efun<Ex, En> { pub fun: Fun_<Ex, En>, pub use_: Vec<CaptureLid<Ex>>, pub closure_class_name: Option<String>, } /// Naming has two phases and the annotation helps to indicate the phase. /// In the first pass, it will perform naming on everything except for function /// and method bodies and collect information needed. Then, another round of /// naming is performed where function bodies are named. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct FuncBody<Ex, En> { pub fb_ast: Block<Ex, En>, } /// A type annotation is two things: /// - the localized hint, or if the hint is missing, the inferred type /// - The typehint associated to this expression if it exists #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct TypeHint<Ex>(pub Ex, pub TypeHint_); /// Explicit type argument to function, constructor, or collection literal. /// 'ex = unit in NAST /// 'ex = Typing_defs.(locl ty) in TAST, /// and is used to record inferred type arguments, with wildcard hint. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Targ<Ex>(pub Ex, pub Hint); #[rust_to_ocaml(and)] pub type TypeHint_ = Option<Hint>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct CallExpr<Ex, En> { /// function pub func: Expr<Ex, En>, /// explicit type annotations pub targs: Vec<Targ<Ex>>, /// positional args, plus their calling convention pub args: Vec<(ast_defs::ParamKind, Expr<Ex, En>)>, /// unpacked arg pub unpacked_arg: Option<Expr<Ex, En>>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ua_")] #[repr(C)] pub struct UserAttribute<Ex, En> { pub name: Sid, /// user attributes are restricted to scalar values pub params: Vec<Expr<Ex, En>>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fa_")] #[repr(C)] pub struct FileAttribute<Ex, En> { pub user_attributes: UserAttributes<Ex, En>, pub namespace: Nsenv, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tp_")] #[repr(C)] pub struct Tparam<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub variance: ast_defs::Variance, pub name: Sid, pub parameters: Vec<Tparam<Ex, En>>, pub constraints: Vec<(ast_defs::ConstraintKind, Hint)>, #[rust_to_ocaml(attr = "transform.opaque")] pub reified: ReifyKind, pub user_attributes: UserAttributes<Ex, En>, } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum RequireKind { RequireExtends, RequireImplements, RequireClass, } impl TrivialDrop for RequireKind {} arena_deserializer::impl_deserialize_in_arena!(RequireKind); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum EmitId { /// For globally defined type, the ID used in the .main function. #[rust_to_ocaml(name = "Emit_id")] EmitId(isize), /// Closures are hoisted to classes, but they don't get an entry in .main. Anonymous, } arena_deserializer::impl_deserialize_in_arena!(EmitId); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_")] #[repr(C)] pub struct Class_<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub annotation: En, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: file_info::Mode, pub final_: bool, pub is_xhp: bool, pub has_xhp_keyword: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub kind: ast_defs::ClassishKind, pub name: ClassName, /// The type parameters of a class A<T> (T is the parameter) #[rust_to_ocaml(attr = "transform.explicit")] pub tparams: Vec<Tparam<Ex, En>>, #[rust_to_ocaml(attr = "transform.explicit")] pub extends: Vec<ClassHint>, #[rust_to_ocaml(attr = "transform.explicit")] pub uses: Vec<TraitHint>, #[rust_to_ocaml(attr = "transform.explicit")] pub xhp_attr_uses: Vec<XhpAttrHint>, #[rust_to_ocaml(attr = "transform.opaque")] pub xhp_category: Option<(Pos, Vec<Pstring>)>, #[rust_to_ocaml(attr = "transform.explicit")] pub reqs: Vec<ClassReq>, #[rust_to_ocaml(attr = "transform.explicit")] pub implements: Vec<ClassHint>, pub where_constraints: Vec<WhereConstraintHint>, #[rust_to_ocaml(attr = "transform.explicit")] pub consts: Vec<ClassConst<Ex, En>>, pub typeconsts: Vec<ClassTypeconstDef<Ex, En>>, pub vars: Vec<ClassVar<Ex, En>>, pub methods: Vec<Method_<Ex, En>>, pub xhp_children: Vec<(Pos, XhpChild)>, #[rust_to_ocaml(attr = "transform.explicit")] pub xhp_attrs: Vec<XhpAttr<Ex, En>>, pub namespace: Nsenv, #[rust_to_ocaml(attr = "transform.explicit")] pub user_attributes: UserAttributes<Ex, En>, pub file_attributes: Vec<FileAttribute<Ex, En>>, pub docs_url: Option<String>, pub enum_: Option<Enum_>, pub doc_comment: Option<DocComment>, pub emit_id: Option<EmitId>, pub internal: bool, pub module: Option<Sid>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassReq(pub ClassHint, pub RequireKind); #[rust_to_ocaml(and)] pub type ClassHint = Hint; #[rust_to_ocaml(and)] pub type TraitHint = Hint; #[rust_to_ocaml(and)] pub type XhpAttrHint = Hint; #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum XhpAttrTag { Required, LateInit, } impl TrivialDrop for XhpAttrTag {} arena_deserializer::impl_deserialize_in_arena!(XhpAttrTag); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct XhpAttr<Ex, En>( pub TypeHint<Ex>, pub ClassVar<Ex, En>, pub Option<XhpAttrTag>, pub Option<(Pos, Vec<Expr<Ex, En>>)>, ); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassConstKind<Ex, En> { /// CCAbstract represents the states /// abstract const int X; /// abstract const int Y = 4; /// The expr option is a default value CCAbstract(Option<Expr<Ex, En>>), /// CCConcrete represents /// const int Z = 4; /// The expr is the value of the constant. It is not optional CCConcrete(Expr<Ex, En>), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cc_")] #[repr(C)] pub struct ClassConst<Ex, En> { pub user_attributes: UserAttributes<Ex, En>, pub type_: Option<Hint>, pub id: Sid, pub kind: ClassConstKind<Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub doc_comment: Option<DocComment>, } /// This represents a type const definition. If a type const is abstract then /// then the type hint acts as a constraint. Any concrete definition of the /// type const must satisfy the constraint. /// /// If the type const is not abstract then a type must be specified. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_atc_")] #[repr(C)] pub struct ClassAbstractTypeconst { pub as_constraint: Option<Hint>, pub super_constraint: Option<Hint>, #[rust_to_ocaml(attr = "transform.explicit")] pub default: Option<Hint>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassConcreteTypeconst { pub c_tc_type: Hint, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassTypeconst { TCAbstract(ClassAbstractTypeconst), TCConcrete(ClassConcreteTypeconst), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_tconst_")] #[repr(C)] pub struct ClassTypeconstDef<Ex, En> { pub user_attributes: UserAttributes<Ex, En>, pub name: Sid, pub kind: ClassTypeconst, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub doc_comment: Option<DocComment>, pub is_ctx: bool, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "xai_")] #[repr(C)] pub struct XhpAttrInfo { #[rust_to_ocaml(attr = "transform.opaque")] pub like: Option<Pos>, pub tag: Option<XhpAttrTag>, #[rust_to_ocaml(attr = "transform.opaque")] pub enum_values: Vec<ast_defs::XhpEnumValue>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cv_")] #[repr(C)] pub struct ClassVar<Ex, En> { pub final_: bool, pub xhp_attr: Option<XhpAttrInfo>, pub abstract_: bool, pub readonly: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: Visibility, #[rust_to_ocaml(attr = "transform.explicit")] pub type_: TypeHint<Ex>, pub id: Sid, pub expr: Option<Expr<Ex, En>>, pub user_attributes: UserAttributes<Ex, En>, pub doc_comment: Option<DocComment>, pub is_promoted_variadic: bool, pub is_static: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "m_")] #[repr(C)] pub struct Method_<Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub annotation: En, pub final_: bool, pub abstract_: bool, pub static_: bool, pub readonly_this: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: Visibility, pub name: Sid, pub tparams: Vec<Tparam<Ex, En>>, pub where_constraints: Vec<WhereConstraintHint>, pub params: Vec<FunParam<Ex, En>>, pub ctxs: Option<Contexts>, pub unsafe_ctxs: Option<Contexts>, pub body: FuncBody<Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub fun_kind: ast_defs::FunKind, pub user_attributes: UserAttributes<Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_ret: Option<ast_defs::ReadonlyKind>, #[rust_to_ocaml(attr = "transform.explicit")] pub ret: TypeHint<Ex>, /// true if this declaration has no body because it is an external method /// declaration (e.g. from an HHI file) pub external: bool, pub doc_comment: Option<DocComment>, } #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type Nsenv = std::sync::Arc<namespace_env::Env>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "t_")] #[repr(C)] pub struct Typedef<Ex, En> { pub annotation: En, pub name: Sid, pub tparams: Vec<Tparam<Ex, En>>, pub as_constraint: Option<Hint>, pub super_constraint: Option<Hint>, #[rust_to_ocaml(attr = "transform.explicit")] pub kind: Hint, pub user_attributes: UserAttributes<Ex, En>, pub file_attributes: Vec<FileAttribute<Ex, En>>, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: file_info::Mode, #[rust_to_ocaml(attr = "transform.opaque")] pub vis: TypedefVisibility, pub namespace: Nsenv, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub emit_id: Option<EmitId>, pub is_ctx: bool, pub internal: bool, pub module: Option<Sid>, pub docs_url: Option<String>, pub doc_comment: Option<DocComment>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cst_")] #[repr(C)] pub struct Gconst<Ex, En> { pub annotation: En, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: file_info::Mode, pub name: Sid, pub type_: Option<Hint>, #[rust_to_ocaml(attr = "transform.explicit")] pub value: Expr<Ex, En>, pub namespace: Nsenv, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, pub emit_id: Option<EmitId>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fd_")] #[repr(C)] pub struct FunDef<Ex, En> { pub namespace: Nsenv, pub file_attributes: Vec<FileAttribute<Ex, En>>, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: file_info::Mode, pub name: Sid, pub fun: Fun_<Ex, En>, pub internal: bool, pub module: Option<Sid>, pub tparams: Vec<Tparam<Ex, En>>, pub where_constraints: Vec<WhereConstraintHint>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "md_")] #[repr(C)] pub struct ModuleDef<Ex, En> { pub annotation: En, #[rust_to_ocaml(attr = "transform.opaque")] pub name: ast_defs::Id, pub user_attributes: UserAttributes<Ex, En>, pub file_attributes: Vec<FileAttribute<Ex, En>>, #[rust_to_ocaml(attr = "transform.opaque")] pub span: Pos, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: file_info::Mode, pub doc_comment: Option<DocComment>, pub exports: Option<Vec<MdNameKind>>, pub imports: Option<Vec<MdNameKind>>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum MdNameKind { MDNameGlobal(Pos), MDNamePrefix(Sid), MDNameExact(Sid), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Def<Ex, En> { Fun(Box<FunDef<Ex, En>>), Class(Box<Class_<Ex, En>>), Stmt(Box<Stmt<Ex, En>>), Typedef(Box<Typedef<Ex, En>>), Constant(Box<Gconst<Ex, En>>), #[rust_to_ocaml(inline_tuple)] Namespace(Box<(Sid, Vec<Def<Ex, En>>)>), NamespaceUse(Vec<(NsKind, Sid, Sid)>), SetNamespaceEnv(Box<Nsenv>), FileAttributes(Box<FileAttribute<Ex, En>>), Module(Box<ModuleDef<Ex, En>>), SetModule(Box<Sid>), } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum NsKind { NSNamespace, NSClass, NSClassAndNamespace, NSFun, NSConst, } impl TrivialDrop for NsKind {} arena_deserializer::impl_deserialize_in_arena!(NsKind); #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type DocComment = ast_defs::Pstring; #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum ImportFlavor { Include, Require, IncludeOnce, RequireOnce, } impl TrivialDrop for ImportFlavor {} arena_deserializer::impl_deserialize_in_arena!(ImportFlavor); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum XhpChild { ChildName(Sid), ChildList(Vec<XhpChild>), ChildUnary(Box<XhpChild>, XhpChildOp), ChildBinary(Box<XhpChild>, Box<XhpChild>), } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum XhpChildOp { ChildStar, ChildPlus, ChildQuestion, } impl TrivialDrop for XhpChildOp {} arena_deserializer::impl_deserialize_in_arena!(XhpChildOp); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Hint(pub Pos, pub Box<Hint_>); #[rust_to_ocaml(and)] pub type VariadicHint = Option<Hint>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct UserAttributes<Ex, En>(pub Vec<UserAttribute<Ex, En>>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Contexts(pub Pos, pub Vec<Context>); #[rust_to_ocaml(and)] pub type Context = Hint; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[rust_to_ocaml(prefix = "hfparam_")] #[repr(C)] pub struct HfParamInfo { pub kind: ast_defs::ParamKind, pub readonlyness: Option<ast_defs::ReadonlyKind>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "hf_")] #[repr(C)] pub struct HintFun { #[rust_to_ocaml(attr = "transform.opaque")] pub is_readonly: Option<ast_defs::ReadonlyKind>, pub param_tys: Vec<Hint>, pub param_info: Vec<Option<HfParamInfo>>, pub variadic_ty: VariadicHint, pub ctxs: Option<Contexts>, #[rust_to_ocaml(attr = "transform.explicit")] pub return_ty: Hint, #[rust_to_ocaml(attr = "transform.opaque")] pub is_readonly_return: Option<ast_defs::ReadonlyKind>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Hint_ { Hoption(Hint), Hlike(Hint), Hfun(HintFun), Htuple(Vec<Hint>), Happly(ClassName, Vec<Hint>), Hshape(NastShapeInfo), /// Accessing a type constant. Type constants are accessed like normal /// class constants, but in type positions. /// /// SomeClass::TFoo /// self::TFoo /// this::TFoo /// /// Type constants can be also be chained, hence the list as the second /// argument: /// /// SomeClass::TFoo::TBar // Haccess (Happly "SomeClass", ["TFoo", "TBar"]) /// /// When using contexts, the receiver may be a variable rather than a /// specific type: /// /// function uses_const_ctx(SomeClassWithConstant $t)[$t::C]: void {} Haccess(Hint, Vec<Sid>), Hsoft(Hint), Hrefinement(Hint, Vec<Refinement>), Hany, Herr, Hmixed, Hwildcard, Hnonnull, Habstr(String, Vec<Hint>), #[rust_to_ocaml(name = "Hvec_or_dict")] HvecOrDict(Option<Hint>, Hint), Hprim(Tprim), Hthis, Hdynamic, Hnothing, Hunion(Vec<Hint>), Hintersection(Vec<Hint>), #[rust_to_ocaml(name = "Hfun_context")] HfunContext(String), Hvar(String), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Refinement { Rctx(Sid, CtxRefinement), Rtype(Sid, TypeRefinement), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum TypeRefinement { TRexact(Hint), TRloose(TypeRefinementBounds), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tr_")] #[repr(C)] pub struct TypeRefinementBounds { pub lower: Vec<Hint>, pub upper: Vec<Hint>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum CtxRefinement { CRexact(Hint), CRloose(CtxRefinementBounds), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cr_")] #[repr(C)] pub struct CtxRefinementBounds { pub lower: Option<Hint>, pub upper: Option<Hint>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sfi_")] #[repr(C)] pub struct ShapeFieldInfo { pub optional: bool, pub hint: Hint, #[rust_to_ocaml(attr = "transform.opaque")] pub name: ast_defs::ShapeFieldName, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "nsi_")] #[repr(C)] pub struct NastShapeInfo { pub allows_unknown_fields: bool, pub field_map: Vec<ShapeFieldInfo>, } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum KvcKind { Map, ImmMap, Dict, } impl TrivialDrop for KvcKind {} arena_deserializer::impl_deserialize_in_arena!(KvcKind); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum VcKind { Vector, ImmVector, Vec, Set, ImmSet, Keyset, } impl TrivialDrop for VcKind {} arena_deserializer::impl_deserialize_in_arena!(VcKind); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "e_")] #[repr(C)] pub struct Enum_ { pub base: Hint, pub constraint: Option<Hint>, pub includes: Vec<Hint>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = r#"deriving ((show { with_path = false }), eq, hash, ord, map, (transform ~restart:(`Disallow `Encode_as_result)), (visitors { variety = "iter"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.iter"; "Aast_defs_visitors_ancestors.iter"] }), (visitors { variety = "reduce"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.reduce"; "Aast_defs_visitors_ancestors.reduce"] }), (visitors { variety = "map"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.map"; "Aast_defs_visitors_ancestors.map"] }), (visitors { variety = "endo"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.endo"; "Aast_defs_visitors_ancestors.endo"] }))"#)] #[repr(C)] pub struct WhereConstraintHint(pub Hint, pub ast_defs::ConstraintKind, pub Hint);
Rust
hhvm/hphp/hack/src/oxidized/gen/ast_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<35cc4f1b22122b4bb190e7ba988a539c>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; pub use pos::Pos; use serde::Deserialize; use serde::Serialize; pub use crate::shape_map; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(and)] pub type Id_ = String; #[derive( Clone, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Id(pub Pos, pub Id_); #[rust_to_ocaml(and)] pub type Pstring = (Pos, String); #[rust_to_ocaml(and)] pub type ByteString = String; #[rust_to_ocaml(and)] pub type PositionedByteString = (Pos, bstr::BString); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum ShapeFieldName { #[rust_to_ocaml(name = "SFlit_int")] SFlitInt(Pstring), #[rust_to_ocaml(name = "SFlit_str")] SFlitStr(PositionedByteString), #[rust_to_ocaml(name = "SFclass_const")] SFclassConst(Id, Pstring), } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum Variance { Covariant, Contravariant, Invariant, } impl TrivialDrop for Variance {} arena_deserializer::impl_deserialize_in_arena!(Variance); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum ConstraintKind { #[rust_to_ocaml(name = "Constraint_as")] ConstraintAs, #[rust_to_ocaml(name = "Constraint_eq")] ConstraintEq, #[rust_to_ocaml(name = "Constraint_super")] ConstraintSuper, } impl TrivialDrop for ConstraintKind {} arena_deserializer::impl_deserialize_in_arena!(ConstraintKind); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum Abstraction { Concrete, Abstract, } impl TrivialDrop for Abstraction {} arena_deserializer::impl_deserialize_in_arena!(Abstraction); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum ClassishKind { /// Kind for `class` and `abstract class` Cclass(Abstraction), /// Kind for `interface` Cinterface, /// Kind for `trait` Ctrait, /// Kind for `enum` Cenum, /// Kind for `enum class` and `abstract enum class`. /// See https://docs.hhvm.com/hack/built-in-types/enum-class #[rust_to_ocaml(name = "Cenum_class")] CenumClass(Abstraction), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum ParamKind { /// Contains the position for an entire `inout` annotated expression, e.g.: /// /// foo(inout $bar); /// ^^^^^^^^^^ Pinout(Pos), Pnormal, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum ReadonlyKind { Readonly, } impl TrivialDrop for ReadonlyKind {} arena_deserializer::impl_deserialize_in_arena!(ReadonlyKind); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum OgNullFlavor { #[rust_to_ocaml(name = "OG_nullthrows")] OGNullthrows, #[rust_to_ocaml(name = "OG_nullsafe")] OGNullsafe, } impl TrivialDrop for OgNullFlavor {} arena_deserializer::impl_deserialize_in_arena!(OgNullFlavor); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum PropOrMethod { #[rust_to_ocaml(name = "Is_prop")] IsProp, #[rust_to_ocaml(name = "Is_method")] IsMethod, } impl TrivialDrop for PropOrMethod {} arena_deserializer::impl_deserialize_in_arena!(PropOrMethod); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum FunKind { FSync, FAsync, FGenerator, FAsyncGenerator, } impl TrivialDrop for FunKind {} arena_deserializer::impl_deserialize_in_arena!(FunKind); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum Bop { /// Addition: x + y Plus, /// Subtraction: x - y Minus, /// Multiplication: x * y Star, /// Division: x / y Slash, /// Value/coercing equality: x == y Eqeq, /// Same-type-and-value equality: x === y Eqeqeq, /// Exponent: x ** y Starstar, /// Value inquality: x != y Diff, /// Not-same-type-and-value-equality: x !== y Diff2, /// Logical AND: x && y Ampamp, /// Logical OR: x || y Barbar, /// Less than: x < y Lt, /// Less than or equal to: x <= y Lte, /// Greater than: x > y Gt, /// Greater than or equal to: x >= y Gte, /// String concatenation: x . y Dot, /// Bitwise AND: x & y Amp, /// Bitwise OR: x | y Bar, /// Bitwise left shift: x << y Ltlt, /// Bitwise right shift: x >> y Gtgt, /// Modulo: x % y Percent, /// Bitwise XOR: x ^ y Xor, /// Spaceship operator: x <=> y Cmp, /// Coalesce: x ?? y QuestionQuestion, /// =, +=, -=, ... Eq(Option<Box<Bop>>), } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum Uop { /// Bitwise negation: ~x Utild, /// Logical not: !b Unot, /// Unary plus: +x Uplus, /// Unary minus: -x Uminus, /// Unary increment: ++i Uincr, /// Unary decrement: --i Udecr, /// Unary postfix increment: i++ Upincr, /// Unary postfix decrement: i-- Updecr, /// Error control/Silence (ignore) expections: @e Usilence, } impl TrivialDrop for Uop {} arena_deserializer::impl_deserialize_in_arena!(Uop); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum Visibility { #[rust_to_ocaml(attr = r#"visitors.name "visibility_Private""#)] Private, #[rust_to_ocaml(attr = r#"visitors.name "visibility_Public""#)] Public, #[rust_to_ocaml(attr = r#"visitors.name "visibility_Protected""#)] Protected, #[rust_to_ocaml(attr = r#"visitors.name "visibility_Internal""#)] Internal, } impl TrivialDrop for Visibility {} arena_deserializer::impl_deserialize_in_arena!(Visibility); /// Literal values that can occur in XHP enum properties. /// /// class :my-xhp-class { /// attribute enum {'big', 'small'} my-prop; /// } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum XhpEnumValue { #[rust_to_ocaml(name = "XEV_Int")] XEVInt(isize), #[rust_to_ocaml(name = "XEV_String")] XEVString(String), } /// Hack's primitive types (as the typechecker understands them). /// /// Used in the AST of typehints (Aast_defs.Hprim) and in the representation of /// types (Typing_defs.Tprim). #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum Tprim { Tnull, Tvoid, Tint, Tbool, Tfloat, Tstring, Tresource, Tnum, Tarraykey, Tnoreturn, } impl TrivialDrop for Tprim {} arena_deserializer::impl_deserialize_in_arena!(Tprim); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(u8)] pub enum TypedefVisibility { Transparent, Opaque, OpaqueModule, CaseType, } impl TrivialDrop for TypedefVisibility {} arena_deserializer::impl_deserialize_in_arena!(TypedefVisibility); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[rust_to_ocaml(attr = r#"deriving ((show { with_path = false }), eq, hash, ord, (transform ~restart:(`Disallow `Encode_as_result)), (visitors { variety = "iter"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.iter_base"] }), (visitors { variety = "endo"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.endo_base"] }), (visitors { variety = "reduce"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.reduce_base"] }), (visitors { variety = "map"; nude = true; visit_prefix = "on_"; ancestors = ["Visitors_runtime.map_base"] }))"#)] #[repr(u8)] pub enum ReifyKind { Erased, SoftReified, Reified, } impl TrivialDrop for ReifyKind {} arena_deserializer::impl_deserialize_in_arena!(ReifyKind);
Rust
hhvm/hphp/hack/src/oxidized/gen/custom_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<21d7e4c3bfe77c569d0f04153ff2376e>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum VersionedPattError { #[rust_to_ocaml(name = "Error_v1")] ErrorV1(patt_error::PattError), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum VersionedErrorMessage { #[rust_to_ocaml(name = "Message_v1")] MessageV1(error_message::ErrorMessage), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct CustomError { pub name: String, pub patt: VersionedPattError, pub error_message: VersionedErrorMessage, }
Rust
hhvm/hphp/hack/src/oxidized/gen/custom_error_config.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<23cde003bbf25dd2db8f59e068868701>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(attr = "boxed")] #[repr(C)] pub struct CustomErrorConfig { pub valid: Vec<custom_error::CustomError>, pub invalid: Vec<custom_error::CustomError>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/decl_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<28ffdac0faf3877e2a9c2ca86cc3ecaf>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::*; #[allow(unused_imports)] use crate::*; /// A substitution context contains all the information necessary for /// changing the type of an inherited class element to the class that is /// inheriting the class element. It's best illustrated via an example. /// /// ``` /// class A<Ta1, Ta2> { public function test(Ta1 $x, Ta2 $y): void {} } /// /// class B<Tb> extends A<Tb, int> {} /// /// class C extends B<string> {} /// ``` /// /// The method `A::test()` has the type (function(Ta1, Ta2): void) in the /// context of class A. However in the context of class B, it will have type /// (function(Tb, int): void). /// /// The substitution that leads to this change is [Ta1 -> Tb, Ta2 -> int], /// which will produce a new type in the context of class B. It's subst_context /// would then be: /// /// ``` /// { sc_subst = [Ta1 -> Tb, Ta2 -> int]; /// sc_class_context = 'B'; /// sc_from_req_extends = false; /// } /// ``` /// /// The `sc_from_req_extends` field is set to true if the context was inherited /// via a require extends type. This information is relevant when folding /// `dc_substs` during inheritance. See Decl_inherit module. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, ord)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct SubstContext { pub subst: s_map::SMap<Ty>, pub class_context: String, pub from_req_extends: bool, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(u8)] pub enum SourceType { Child, Parent, Trait, XHPAttr, Interface, IncludedEnum, ReqImpl, ReqExtends, ReqClass, } impl TrivialDrop for SourceType {} arena_deserializer::impl_deserialize_in_arena!(SourceType); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum DeclError { #[rust_to_ocaml(name = "Wrong_extend_kind")] WrongExtendKind { pos: pos::Pos, kind: ast_defs::ClassishKind, name: String, parent_pos: pos_or_decl::PosOrDecl, parent_kind: ast_defs::ClassishKind, parent_name: String, }, #[rust_to_ocaml(name = "Cyclic_class_def")] CyclicClassDef { pos: pos::Pos, stack: s_set::SSet }, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "dc_")] #[repr(C)] pub struct DeclClassType { pub need_init: bool, pub abstract_: bool, pub final_: bool, pub const_: bool, pub internal: bool, pub deferred_init_members: s_set::SSet, pub kind: ast_defs::ClassishKind, pub is_xhp: bool, pub has_xhp_keyword: bool, pub module: Option<ast_defs::Id>, pub is_module_level_trait: bool, pub name: String, pub pos: pos_or_decl::PosOrDecl, pub tparams: Vec<Tparam>, pub where_constraints: Vec<WhereConstraint>, /// class name to the subst_context that must be applied to that class pub substs: s_map::SMap<SubstContext>, pub consts: s_map::SMap<ClassConst>, pub typeconsts: s_map::SMap<TypeconstType>, pub props: s_map::SMap<Element>, pub sprops: s_map::SMap<Element>, pub methods: s_map::SMap<Element>, pub smethods: s_map::SMap<Element>, pub construct: (Option<Element>, ConsistentKind), pub ancestors: s_map::SMap<Ty>, pub support_dynamic_type: bool, pub req_ancestors: Vec<Requirement>, pub req_ancestors_extends: s_set::SSet, /// dc_req_class_ancestors gathers all the `require class` /// requirements declared in ancestors. Remark that `require class` /// requirements are _not_ stored in `dc_req_ancestors` or /// `dc_req_ancestors_extends` fields. pub req_class_ancestors: Vec<Requirement>, pub extends: s_set::SSet, pub sealed_whitelist: Option<s_set::SSet>, pub xhp_attr_deps: s_set::SSet, pub xhp_enum_values: s_map::SMap<Vec<ast_defs::XhpEnumValue>>, pub xhp_marked_empty: bool, pub enum_type: Option<EnumType>, pub decl_errors: Vec<DeclError>, pub docs_url: Option<String>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "elt_")] #[repr(C)] pub struct Element { pub flags: typing_defs_flags::class_elt::ClassElt, pub origin: String, pub visibility: CeVisibility, pub deprecated: Option<String>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/decl_parser_options.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<57c9b779b0ec52945779422503ca4b98>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct DeclParserOptions { pub auto_namespace_map: Vec<(String, String)>, pub disable_xhp_element_mangling: bool, pub interpret_soft_types_as_like_types: bool, pub allow_new_attribute_syntax: bool, pub enable_xhp_class_modifier: bool, pub everything_sdt: bool, pub php5_compat_mode: bool, pub hhvm_compat_mode: bool, pub keep_user_attributes: bool, }
Rust
hhvm/hphp/hack/src/oxidized/gen/decl_reference.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<e66086795fe07dbfe4e984bc27523d63>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show, ord)")] #[repr(C, u8)] pub enum DeclReference { GlobalConstant(String), Function(String), Type(String), Module(String), }
Rust
hhvm/hphp/hack/src/oxidized/gen/errors.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<5a8948409116c0733a0e4026cc831695>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::error_codes::GlobalAccessCheck; pub use crate::error_codes::Naming; pub use crate::error_codes::NastCheck; pub use crate::error_codes::Parsing; pub use crate::error_codes::Typing; #[allow(unused_imports)] use crate::*; pub type ErrorCode = isize; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum Format { /// Underlined references and color Context, /// Compact format with color but no references Raw, /// Numbered and colored references Highlighted, /// Verbose positions and no color Plain, } impl TrivialDrop for Format {} arena_deserializer::impl_deserialize_in_arena!(Format); #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] pub type Error = user_error::UserError<pos::Pos, pos_or_decl::PosOrDecl>; pub type PerFileErrors = Vec<Error>; #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type Errors = relative_path::map::Map<Vec<Error>>;
Rust
hhvm/hphp/hack/src/oxidized/gen/error_codes.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<357d32b1bbe055683000607f25c697c6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (enum, (show { with_path = false }))")] #[repr(C)] pub enum Parsing { FixmeFormat = 1001, ParsingError = 1002, XhpParsingError = 1007, HhIgnoreComment = 1008, PackageConfigError = 1009, } impl TrivialDrop for Parsing {} arena_deserializer::impl_deserialize_in_arena!(Parsing); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (enum, (show { with_path = false }))")] #[repr(C)] pub enum Naming { AddATypehint = 2001, AssertArity = 2003, PrimitiveInvalidAlias = 2004, DidYouMeanNaming = 2006, DisallowedXhpType = 2008, LvarInObjGet = 2011, ErrorNameAlreadyBound = 2012, ExpectedCollection = 2013, ExpectedVariable = 2014, FdNameAlreadyBound = 2015, IllegalClass = 2021, IllegalClassMeth = 2022, IllegalConstant = 2023, IllegalFun = 2024, IllegalInstMeth = 2025, IllegalMethCaller = 2026, IllegalMethFun = 2027, InvalidReqExtends = 2029, InvalidReqImplements = 2030, LowercaseThis = 2032, MethodNameAlreadyBound = 2033, MissingArrow = 2034, MissingTypehint = 2035, NameAlreadyBound = 2036, NamingTooFewArguments = 2037, NamingTooManyArguments = 2038, PrimitiveToplevel = 2039, ShadowedTypeParam = 2041, #[rust_to_ocaml(name = "StartWith_T")] StartWithT = 2042, ThisMustBeReturn = 2043, ThisNoArgument = 2044, ThisHintOutsideClass = 2045, ThisReserved = 2046, HigherKindedTypesUnsupportedFeature = 2047, UnboundName = 2049, Undefined = 2050, UnexpectedArrow = 2051, UnexpectedTypedef = 2052, UsingInternalClass = 2053, VoidCast = 2054, ObjectCast = 2055, UnsetCast = 2056, IllegalTrait = 2058, DynamicNewInStrictMode = 2060, InvalidTypeAccessRoot = 2061, DuplicateUserAttribute = 2062, ReturnOnlyTypehint = 2063, UnexpectedTypeArguments = 2064, TooManyTypeArguments = 2065, ClassnameParam = 2066, NameIsReserved = 2068, DollardollarUnused = 2069, IllegalMemberVariableClass = 2070, TooFewTypeArguments = 2071, ThisAsLexicalVariable = 2077, DynamicClassNameInStrictMode = 2078, XhpOptionalRequiredAttr = 2079, XhpRequiredWithDefault = 2080, ArrayTypehintsDisallowed = 2082, WildcardHintDisallowed = 2084, MethodNeedsVisibility = 2086, NonstaticPropertyWithLSB = 2094, UnsupportedTraitUseAs = 2102, UnsupportedInsteadOf = 2103, InvalidFunPointer = 2105, IllegalUseOfDynamicallyCallable = 2106, ClassMethNonFinalSelf = 2111, ParentInFunctionPointer = 2112, SelfInNonFinalFunctionPointer = 2113, ClassMethNonFinalCLASS = 2114, WildcardTypeParamDisallowed = 2115, InvalidWildcardContext = 2117, ExplicitConsistentConstructor = 2118, InvalidReqClass = 2119, ModuleDeclarationOutsideAllowedFiles = 2120, DynamicMethodAccess = 2121, TypeConstantInEnumClassOutsideAllowedLocations = 2122, InvalidBuiltinType = 2123, InvalidMemoizeLabel = 2124, DynamicHintDisallowed = 2125, IllegalTypedLocal = 2126, } impl TrivialDrop for Naming {} arena_deserializer::impl_deserialize_in_arena!(Naming); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (enum, (show { with_path = false }))")] #[repr(C)] pub enum NastCheck { AbstractBody = 3001, AbstractWithBody = 3002, AwaitInSyncFunction = 3003, CallBeforeInit = 3004, CaseFallthrough = 3005, ContinueInSwitch = 3006, DefaultFallthrough = 3008, InterfaceWithMemberVariable = 3009, InterfaceWithStaticMemberVariable = 3010, Magic = 3011, NoConstructParent = 3012, NonInterface = 3013, NotAbstractWithoutBody = 3014, NotInitialized = 3015, NotPublicInterface = 3016, RequiresNonClass = 3017, ReturnInFinally = 3018, ReturnInGen = 3019, ToStringReturnsString = 3020, ToStringVisibility = 3021, ToplevelBreak = 3022, ToplevelContinue = 3023, UsesNonTrait = 3024, IllegalFunctionName = 3025, NotAbstractWithoutTypeconst = 3026, TypeconstDependsOnExternalTparam = 3027, ConstructorRequired = 3030, InterfaceWithPartialTypeconst = 3031, MultipleXhpCategory = 3032, StaticMemoizedFunction = 3041, InoutParamsSpecial = 3043, InoutParamsMemoize = 3045, ReadingFromAppend = 3047, IllegalDestructor = 3056, RequiresFinalClass = 3072, InterfaceUsesTrait = 3073, NonstaticMethodInAbstractFinalClass = 3074, SwitchNonTerminalDefault = 3081, SwitchMultipleDefault = 3082, RepeatedRecordFieldName = 3083, PhpLambdaDisallowed = 3084, EntryPointArguments = 3085, VariadicMemoize = 3086, AbstractMethodMemoize = 3087, InstancePropertyInAbstractFinalClass = 3088, DynamicallyCallableReified = 3089, IllegalContext = 3090, ListRvalue = 3092, PartiallyAbstractTypeconstDefinition = 3093, EntryPointGenerics = 3094, InternalProtectedOrPrivate = 3095, InoutInTransformedPsuedofunction = 3096, PrivateAndFinal = 3097, InternalMemberInsidePublicTrait = 3099, AttributeConflictingMemoize = 3100, RefinementInTypeStruct = 3101, #[rust_to_ocaml(name = "Soft_internal_without_internal")] SoftInternalWithoutInternal = 3102, } impl TrivialDrop for NastCheck {} arena_deserializer::impl_deserialize_in_arena!(NastCheck); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (enum, (show { with_path = false }))")] #[repr(C)] pub enum Typing { InternalError = 0, UninstantiableClass = 4002, ArrayAccessRead = 4005, ArrayAppend = 4006, ArrayCast = 4007, ArrayGetArity = 4008, BadCall = 4009, ConstMutation = 4011, ConstructorNoArgs = 4012, CyclicClassDef = 4013, CyclicTypedef = 4014, DiscardedAwaitable = 4015, IssetEmptyInStrict = 4016, EnumConstantTypeBad = 4018, EnumSwitchNonexhaustive = 4019, EnumSwitchNotConst = 4020, EnumSwitchRedundant = 4021, EnumSwitchRedundantDefault = 4022, EnumSwitchWrongClass = 4023, EnumTypeBad = 4024, ExpectedClass = 4026, ExpectedLiteralFormatString = 4027, ExpectedTparam = 4029, ExpectingReturnTypeHint = 4030, ExpectingTypeHint = 4032, ExpectingTypeHintVariadic = 4033, ExtendFinal = 4035, FieldKinds = 4036, FormatString = 4038, FunArityMismatch = 4039, FunTooFewArgs = 4040, FunTooManyArgs = 4041, FunUnexpectedNonvariadic = 4042, FunVariadicityHhVsPhp56 = 4043, GenericArrayStrict = 4045, GenericStatic = 4046, ImplementAbstract = 4047, InvalidShapeFieldConst = 4049, InvalidShapeFieldLiteral = 4050, InvalidShapeFieldName = 4051, InvalidShapeFieldType = 4052, MemberNotFound = 4053, MemberNotImplemented = 4054, MissingAssign = 4055, MissingConstructor = 4056, MissingField = 4057, SelfOutsideClass = 4059, NewStaticInconsistent = 4060, StaticOutsideClass = 4061, NonObjectMemberRead = 4062, NullContainer = 4063, NullMemberRead = 4064, OptionReturnOnlyTypehint = 4066, ObjectString = 4067, OverrideFinal = 4070, OverridePerTrait = 4071, AbstractCall = 4073, ParentInTrait = 4074, ParentOutsideClass = 4075, ParentUndefined = 4076, PreviousDefault = 4077, PrivateClassMeth = 4078, PrivateInstMeth = 4079, PrivateOverride = 4080, ProtectedClassMeth = 4081, ProtectedInstMeth = 4082, ReadBeforeWrite = 4083, ReturnInVoid = 4084, ShapeFieldClassMismatch = 4085, ShapeFieldTypeMismatch = 4086, ShouldNotBeOverride = 4087, SmemberNotFound = 4090, StaticDynamic = 4091, ThisVarOutsideClass = 4095, TupleSyntax = 4100, TypeArityMismatch = 4101, TypingTooFewArgs = 4104, TypingTooManyArgs = 4105, UnboundGlobal = 4106, UnboundNameTyping = 4107, UndefinedField = 4108, UndefinedParent = 4109, UnifyError = 4110, UnsatisfiedReq = 4111, Visibility = 4112, VisibilityExtends = 4113, WrongExtendKind = 4115, GenericUnify = 4116, TrivialStrictEq = 4118, VoidUsage = 4119, DeclaredCovariant = 4120, DeclaredContravariant = 4121, StrictMembersNotKnown = 4123, ErasedGenericAtRuntime = 4124, AttributeTooManyArguments = 4126, AttributeParamType = 4127, DeprecatedUse = 4128, AbstractConstUsage = 4129, CannotDeclareConstant = 4130, CyclicTypeconst = 4131, NullsafePropertyWriteContext = 4132, NoreturnUsage = 4133, UnsetNonidxInStrict = 4135, InvalidShapeFieldNameEmpty = 4136, ShapeFieldsUnknown = 4138, InvalidShapeRemoveKey = 4139, ShapeFieldUnset = 4141, AbstractConcreteOverride = 4142, LocalVariableModifedAndUsed = 4143, LocalVariableModifedTwice = 4144, AssignDuringCase = 4145, CyclicEnumConstraint = 4146, UnpackingDisallowed = 4147, InvalidClassname = 4148, InvalidMemoizedParam = 4149, IllegalTypeStructure = 4150, NotNullableCompareNullTrivial = 4151, AttributeTooFewArguments = 4153, UnificationCycle = 4155, KeysetSet = 4156, EqIncompatibleTypes = 4157, ContravariantThis = 4158, RequiredFieldIsOptional = 4163, FinalProperty = 4164, ArrayGetWithOptionalField = 4165, UnknownFieldDisallowedInShape = 4166, NullableCast = 4167, DuplicateUsingVar = 4178, IllegalDisposable = 4179, EscapingDisposable = 4180, InoutAnnotationMissing = 4182, InoutAnnotationUnexpected = 4183, InoutnessMismatch = 4184, StaticSyntheticMethod = 4185, TraitReuse = 4186, InvalidNewDisposable = 4187, EscapingDisposableParameter = 4188, AcceptDisposableInvariant = 4189, InvalidDisposableHint = 4190, XhpRequired = 4191, EscapingThis = 4192, IllegalXhpChild = 4193, MustExtendDisposable = 4194, InvalidIsAsExpressionHint = 4195, AssigningToConst = 4196, SelfConstParentNot = 4197, OverridingPropConstMismatch = 4204, InvalidReturnDisposable = 4205, InvalidDisposableReturnHint = 4206, ReturnDisposableMismatch = 4207, InoutArgumentBadType = 4208, EnumTypeTypedefNonnull = 4219, AmbiguousLambda = 4222, EllipsisStrictMode = 4223, OutputInWrongContext = 4226, StaticPropertyInWrongContext = 4228, WrongExpressionKindAttribute = 4231, DeclOverrideMissingHint = 4236, ExtendSealed = 4238, ComparisonInvalidTypes = 4240, ShapesKeyExistsAlwaysTrue = 4249, ShapesKeyExistsAlwaysFalse = 4250, ShapesMethodAccessWithNonExistentField = 4251, NonClassMember = 4252, AmbiguousObjectAccess = 4256, RePrefixedNonString = 4274, BadRegexPattern = 4275, LateInitWithDefault = 4277, OverrideMemoizeLSB = 4278, ClassVarTypeGenericParam = 4279, InvalidSwitchCaseValueType = 4280, StringCast = 4281, BadLateInitOverride = 4282, OverrideLSB = 4284, MultipleConcreteDefs = 4285, InvalidMoveUse = 4287, InvalidMoveTarget = 4288, UnexpectedTy = 4291, UnserializableType = 4292, UnknownObjectMember = 4296, UnknownType = 4297, InvalidArrayKeyRead = 4298, RedeclaringMissingMethod = 4301, InvalidEnforceableTypeArgument = 4302, RequireArgsReify = 4303, TypecheckerTimeout = 4304, InvalidReifiedArgument = 4305, GenericsNotAllowed = 4306, InvalidNewableTypeArgument = 4307, InvalidNewableTypeParamConstraints = 4308, NewWithoutNewable = 4309, NewClassReified = 4310, MemoizeReified = 4311, ConsistentConstructReified = 4312, MethodVariance = 4313, MissingXhpRequiredAttr = 4314, BadXhpAttrRequiredOverride = 4315, UnresolvedTypeVariable = 4317, InvalidSubString = 4318, InvalidArrayKeyConstraint = 4319, OverrideNoDefaultTypeconst = 4320, ShapeAccessWithNonExistentField = 4321, DisallowPHPArraysAttr = 4322, TypeConstraintViolation = 4323, IndexTypeMismatch = 4324, ExpectedStringlike = 4325, TypeConstantMismatch = 4326, ConstantDoesNotMatchEnumType = 4328, EnumConstraintMustBeArraykey = 4329, EnumSubtypeMustHaveCompatibleConstraint = 4330, ParameterDefaultValueWrongType = 4331, NewtypeAliasMustSatisfyConstraint = 4332, MissingReturnInNonVoidFunction = 4336, InoutReturnTypeMismatch = 4337, ClassConstantValueDoesNotMatchHint = 4338, ClassPropertyInitializerTypeDoesNotMatchHint = 4339, BadDeclOverride = 4340, BadMethodOverride = 4341, BadEnumExtends = 4342, XhpAttributeValueDoesNotMatchHint = 4343, TraitPropConstClass = 4344, EnumUnderlyingTypeMustBeArraykey = 4345, ClassGetReified = 4346, RequireGenericExplicit = 4347, ClassConstantTypeMismatch = 4348, RecordInitValueDoesNotMatchHint = 4351, AbstractTconstNotAllowed = 4352, InvalidDestructure = 4357, StaticMethWithClassReifiedGeneric = 4358, SplatArrayRequired = 4359, SplatArrayVariadic = 4360, ExceptionOccurred = 4361, InvalidReifiedFunctionPointer = 4362, BadFunctionPointerConstruction = 4363, TraitReuseInsideClass = 4365, RedundantGeneric = 4366, ArrayAccessWrite = 4370, InvalidArrayKeyWrite = 4371, NullMemberWrite = 4372, NonObjectMemberWrite = 4373, ConcreteConstInterfaceOverride = 4374, MethCallerTrait = 4375, DuplicateInterface = 4377, TypeParameterNameAlreadyUsedNonShadow = 4378, IllegalInformationFlow = 4379, ContextImplicitPolicyLeakage = 4380, ReifiedFunctionReference = 4381, ClassMethAbstractCall = 4382, KindMismatch = 4383, UnboundNameTypeConstantAccess = 4384, UnknownInformationFlow = 4385, CallsiteCIPPMismatch = 4386, NonpureFunctionCall = 4387, IncompatibleEnumInclusion = 4388, RedeclaringClassishConstant = 4389, CallCoeffects = 4390, AbstractFunctionPointer = 4391, UnnecessaryAttribute = 4392, InheritedMethodCaseDiffers = 4393, EnumClassLabelUnknown = 4394, EnumClassLabelAsExpression = 4396, IFCInternalError = 4398, IFCExternalContravariant = 4399, IFCPolicyMismatch = 4400, OpCoeffects = 4401, ImplementsDynamic = 4402, SubtypeCoeffects = 4403, ImmutableLocal = 4404, EnumClassesReservedSyntax = 4405, NonsenseMemberSelection = 4406, ConsiderMethCaller = 4407, EnumSupertypingReservedSyntax = 4408, ReadonlyValueModified = 4409, ReadonlyMismatch = 4411, ExplicitReadonlyCast = 4412, ReadonlyMethodCall = 4413, StrictStrConcatTypeMismatch = 4414, StrictStrInterpTypeMismatch = 4415, InvalidMethCallerCallingConvention = 4416, ReadonlyException = 4418, InvalidTypeHint = 4419, ExperimentalExpressionTrees = 4420, ReturnsWithAndWithoutValue = 4421, NonVoidAnnotationOnReturnVoidFun = 4422, BitwiseMathInvalidArgument = 4423, CyclicClassConstant = 4424, PrivateDynamicRead = 4425, PrivateDynamicWrite = 4426, IncDecInvalidArgument = 4427, ReadonlyClosureCall = 4428, MathInvalidArgument = 4429, TypeconstConcreteConcreteOverride = 4430, PrivateMethCaller = 4431, ProtectedMethCaller = 4432, BadConditionalSupportDynamic = 4433, ReadonlyInvalidAsMut = 4434, InvalidKeysetValue = 4435, UnresolvedTypeVariableProjection = 4436, InvalidEchoArgument = 4438, DiamondTraitMethod = 4439, ReifiedStaticMethodInExprTree = 4440, InvariantViolated = 4441, RigidTVarEscape = 4442, StrictEqValueIncompatibleTypes = 4443, ModuleError = 4444, SealedNotSubtype = 4445, ModuleHintError = 4446, MemoizeObjectWithoutGlobals = 4447, ExpressionTreeNonPublicProperty = 4448, CovariantIndexTypeMismatch = 4449, InoutInPseudofunction = 4450, TraitParentConstructInconsistent = 4451, HHExpectEquivalentFailure = 4452, HHExpectFailure = 4453, CallLvalue = 4454, UnsafeCastAwait = 4455, HigherKindedTypesUnsupportedFeature = 4456, ThisFinal = 4457, ExactClassFinal = 4458, DiamondTraitProperty = 4462, ConstructNotInstanceMethod = 4463, InvalidMethCallerReadonlyReturn = 4464, AbstractMemberInConcreteClass = 4465, TraitNotUsed = 4466, OverrideAsync = 4467, InexactTConstAccess = 4468, UnsupportedRefinement = 4469, InvalidClassRefinement = 4470, InvalidRefinedConstKind = 4471, InvalidCrossPackage = 4472, InvalidCrossPackageSoft = 4473, AttributeNoAutoDynamic = 4474, IllegalCaseTypeVariants = 4475, } impl TrivialDrop for Typing {} arena_deserializer::impl_deserialize_in_arena!(Typing); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (enum, (show { with_path = false }))")] #[repr(C)] pub enum GlobalAccessCheck { DefiniteGlobalWrite = 11001, PossibleGlobalWriteViaReference = 11002, PossibleGlobalWriteViaFunctionCall = 11003, DefiniteGlobalRead = 11004, } impl TrivialDrop for GlobalAccessCheck {} arena_deserializer::impl_deserialize_in_arena!(GlobalAccessCheck);
Rust
hhvm/hphp/hack/src/oxidized/gen/error_message.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<9e36fbd802f8f66076c72fbf37654300>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum Elem { Lit(String), #[rust_to_ocaml(name = "Ty_var")] TyVar(patt_var::PattVar), #[rust_to_ocaml(name = "Name_var")] NameVar(patt_var::PattVar), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct ErrorMessage { pub message: Vec<Elem>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/full_fidelity_parser_env.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<e9ff81cafe703dfddceae1bdb97e42c6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, sexp_of)")] #[repr(C)] pub struct FullFidelityParserEnv { pub hhvm_compat_mode: bool, pub php5_compat_mode: bool, pub codegen: bool, pub disable_lval_as_an_expression: bool, pub mode: Option<file_info::Mode>, pub rust: bool, pub disable_legacy_soft_typehints: bool, pub allow_new_attribute_syntax: bool, pub disable_legacy_attribute_syntax: bool, pub leak_rust_tree: bool, pub enable_xhp_class_modifier: bool, pub disable_xhp_element_mangling: bool, pub disable_xhp_children_declarations: bool, pub interpret_soft_types_as_like_types: bool, pub is_systemlib: bool, }
Rust
hhvm/hphp/hack/src/oxidized/gen/global_options.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<ed95ac32a5dc74297215fec5b52be1b0>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[repr(C)] pub struct SavedStateLoading { pub saved_state_manifold_api_key: Option<String>, pub log_saved_state_age_and_distance: bool, pub use_manifold_cython_client: bool, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[repr(C)] pub struct SavedState { pub loading: SavedStateLoading, pub rollouts: saved_state_rollouts::SavedStateRollouts, pub project_metadata_w_flags: bool, } /// Naming conventions for fields in this struct: /// - tco_<feature/flag/setting> - type checker option /// - po_<feature/flag/setting> - parser option /// - so_<feature/flag/setting> - server option #[derive( Clone, Debug, Deserialize, FromOcamlRep, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct GlobalOptions { pub tco_saved_state: SavedState, pub tco_experimental_features: s_set::SSet, pub tco_migration_flags: s_set::SSet, pub tco_num_local_workers: Option<isize>, pub tco_max_typechecker_worker_memory_mb: Option<isize>, pub tco_defer_class_declaration_threshold: Option<isize>, pub tco_locl_cache_capacity: isize, pub tco_locl_cache_node_threshold: isize, pub so_naming_sqlite_path: Option<String>, pub po_auto_namespace_map: Vec<(String, String)>, pub po_codegen: bool, pub po_deregister_php_stdlib: bool, pub po_disallow_toplevel_requires: bool, pub po_allow_unstable_features: bool, pub tco_log_large_fanouts_threshold: Option<isize>, pub tco_log_inference_constraints: bool, pub tco_language_feature_logging: bool, pub tco_timeout: isize, pub tco_disallow_invalid_arraykey: bool, pub tco_disallow_byref_dynamic_calls: bool, pub tco_disallow_byref_calls: bool, pub code_agnostic_fixme: bool, pub allowed_fixme_codes_strict: i_set::ISet, pub log_levels: s_map::SMap<isize>, pub po_disable_lval_as_an_expression: bool, pub tco_remote_old_decls_no_limit: bool, pub tco_fetch_remote_old_decls: bool, pub tco_populate_member_heaps: bool, pub tco_skip_hierarchy_checks: bool, pub tco_skip_tast_checks: bool, pub tco_like_type_hints: bool, pub tco_union_intersection_type_hints: bool, pub tco_coeffects: bool, pub tco_coeffects_local: bool, pub tco_strict_contexts: bool, pub tco_like_casts: bool, pub tco_check_xhp_attribute: bool, pub tco_check_redundant_generics: bool, pub tco_disallow_unresolved_type_variables: bool, pub tco_custom_error_config: custom_error_config::CustomErrorConfig, pub po_enable_class_level_where_clauses: bool, pub po_disable_legacy_soft_typehints: bool, pub po_allowed_decl_fixme_codes: i_set::ISet, pub po_allow_new_attribute_syntax: bool, pub tco_const_static_props: bool, pub po_disable_legacy_attribute_syntax: bool, pub tco_const_attribute: bool, pub po_const_default_func_args: bool, pub po_const_default_lambda_args: bool, pub po_disallow_silence: bool, pub po_abstract_static_props: bool, pub po_parser_errors_only: bool, pub tco_check_attribute_locations: bool, pub glean_reponame: String, pub symbol_write_index_inherited_members: bool, pub symbol_write_ownership: bool, pub symbol_write_root_path: String, pub symbol_write_hhi_path: String, pub symbol_write_ignore_paths: Vec<String>, pub symbol_write_index_paths: Vec<String>, pub symbol_write_index_paths_file: Option<String>, pub symbol_write_index_paths_file_output: Option<String>, pub symbol_write_include_hhi: bool, pub symbol_write_sym_hash_in: Option<String>, pub symbol_write_exclude_out: Option<String>, pub symbol_write_referenced_out: Option<String>, pub symbol_write_sym_hash_out: bool, pub po_disallow_func_ptrs_in_constants: bool, pub tco_error_php_lambdas: bool, pub tco_disallow_discarded_nullable_awaitables: bool, pub po_enable_xhp_class_modifier: bool, pub po_disable_xhp_element_mangling: bool, pub po_disable_xhp_children_declarations: bool, pub po_disable_hh_ignore_error: isize, pub po_keep_user_attributes: bool, pub tco_is_systemlib: bool, pub tco_higher_kinded_types: bool, pub tco_method_call_inference: bool, pub tco_report_pos_from_reason: bool, pub tco_typecheck_sample_rate: f64, pub tco_enable_sound_dynamic: bool, pub tco_pessimise_builtins: bool, pub tco_enable_no_auto_dynamic: bool, pub tco_skip_check_under_dynamic: bool, pub tco_ifc_enabled: Vec<String>, pub tco_global_access_check_enabled: bool, pub po_interpret_soft_types_as_like_types: bool, pub tco_enable_strict_string_concat_interp: bool, pub tco_ignore_unsafe_cast: bool, pub tco_no_parser_readonly_check: bool, pub tco_enable_expression_trees: bool, pub tco_enable_modules: bool, pub tco_allowed_expression_tree_visitors: Vec<String>, pub tco_math_new_code: bool, pub tco_typeconst_concrete_concrete_error: bool, pub tco_enable_strict_const_semantics: isize, pub tco_strict_wellformedness: isize, pub tco_meth_caller_only_public_visibility: bool, pub tco_require_extends_implements_ancestors: bool, pub tco_strict_value_equality: bool, pub tco_enforce_sealed_subclasses: bool, pub tco_everything_sdt: bool, pub tco_explicit_consistent_constructors: isize, pub tco_require_types_class_consts: isize, pub tco_type_printer_fuel: isize, pub tco_specify_manifold_api_key: bool, pub tco_profile_top_level_definitions: bool, pub tco_allow_all_files_for_module_declarations: bool, pub tco_allowed_files_for_module_declarations: Vec<String>, pub tco_record_fine_grained_dependencies: bool, pub tco_loop_iteration_upper_bound: Option<isize>, pub tco_expression_tree_virtualize_functions: bool, pub tco_substitution_mutation: bool, pub tco_use_type_alias_heap: bool, pub tco_populate_dead_unsafe_cast_heap: bool, pub po_disallow_static_constants_in_default_func_args: bool, pub tco_load_hack_64_distc_saved_state: bool, pub tco_rust_elab: bool, pub dump_tast_hashes: bool, pub tco_autocomplete_mode: bool, pub tco_package_info: package_info::PackageInfo, pub po_unwrap_concurrent: bool, pub tco_log_exhaustivity_check: bool, }
Rust
hhvm/hphp/hack/src/oxidized/gen/map_reduce_ffi.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<2c86c365e82c3003f77c086986d15c54>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; /// Auxiliary type used for communicating map-reduce data across FFI boundaries. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving yojson_of")] #[repr(C)] pub struct MapReduceFfi { #[rust_to_ocaml(attr = "yojson.option")] pub tast_hashes: Option<tast_hashes::TastHashes>, #[rust_to_ocaml(attr = "yojson.option")] pub type_counter: Option<type_counter::TypeCounter>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/message.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<9c27bc0a3a9372cc14f5cd546ef552c7>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] pub type TByteString = String; /// We use `Pos.t message` and `Pos_or_decl.t message` on the server /// and convert to `Pos.absolute message` before sending it to the client #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C)] pub struct Message<A>(pub A, pub bstr::BString);
Rust
hhvm/hphp/hack/src/oxidized/gen/mod.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<a2edf3fe9dfb136554dd12f181d5f7f6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub mod aast_defs; pub mod ast_defs; pub mod custom_error; pub mod custom_error_config; pub mod decl_defs; pub mod decl_parser_options; pub mod decl_reference; pub mod error_codes; pub mod error_message; pub mod errors; pub mod full_fidelity_parser_env; pub mod global_options; pub mod map_reduce_ffi; pub mod message; pub mod name_context; pub mod namespace_env; pub mod naming_error; pub mod naming_phase_error; pub mod nast_check_error; pub mod package; pub mod package_info; pub mod parser_options; pub mod parsing_error; pub mod patt_binding_ty; pub mod patt_error; pub mod patt_locl_ty; pub mod patt_name; pub mod patt_string; pub mod patt_var; pub mod pos_or_decl; pub mod quickfix; pub mod saved_state_rollouts; pub mod scoured_comments; pub mod search_types; pub mod shallow_decl_defs; pub mod tast; pub mod tast_hashes; pub mod tast_with_dynamic; pub mod type_counter; pub mod type_parameter_env; pub mod typechecker_options; pub mod typing_defs; pub mod typing_defs_core; pub mod typing_inference_env; pub mod typing_kinding_defs; pub mod typing_reason; pub mod typing_tyvar_occurrences; pub mod user_error; pub mod validation_err; pub mod xhp_attribute;
Rust
hhvm/hphp/hack/src/oxidized/gen/namespace_env.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<7eaa338ed3e31bf3b77b0e82f09c5c03>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show, ord)")] #[rust_to_ocaml(prefix = "ns_")] #[repr(C)] pub struct Env { #[rust_to_ocaml(attr = "opaque")] pub ns_uses: s_map::SMap<String>, #[rust_to_ocaml(attr = "opaque")] pub class_uses: s_map::SMap<String>, #[rust_to_ocaml(attr = "opaque")] pub fun_uses: s_map::SMap<String>, #[rust_to_ocaml(attr = "opaque")] pub const_uses: s_map::SMap<String>, pub name: Option<String>, pub is_codegen: bool, pub disable_xhp_element_mangling: bool, }
Rust
hhvm/hphp/hack/src/oxidized/gen/name_context.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<63697d94ce0ab2e6fdd7d7a4753a7fe9>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum NameContext { FunctionNamespace, ConstantNamespace, ModuleNamespace, PackageNamespace, /// Classes, interfaces, traits, records and type aliases. TypeNamespace, TraitContext, ClassContext, } impl TrivialDrop for NameContext {} arena_deserializer::impl_deserialize_in_arena!(NameContext);
Rust
hhvm/hphp/hack/src/oxidized/gen/naming_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<300986842c3e4c9ed96b1db608bbb336>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::error_codes::Naming as Error_code; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum Visibility { Vprivate, Vpublic, Vinternal, Vprotected, } impl TrivialDrop for Visibility {} arena_deserializer::impl_deserialize_in_arena!(Visibility); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum ReturnOnlyHint { Hvoid, Hnoreturn, } impl TrivialDrop for ReturnOnlyHint {} arena_deserializer::impl_deserialize_in_arena!(ReturnOnlyHint); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum UnsupportedFeature { #[rust_to_ocaml(name = "Ft_where_constraints")] FtWhereConstraints, #[rust_to_ocaml(name = "Ft_constraints")] FtConstraints, #[rust_to_ocaml(name = "Ft_reification")] FtReification, #[rust_to_ocaml(name = "Ft_user_attrs")] FtUserAttrs, #[rust_to_ocaml(name = "Ft_variance")] FtVariance, } impl TrivialDrop for UnsupportedFeature {} arena_deserializer::impl_deserialize_in_arena!(UnsupportedFeature); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum NamingError { #[rust_to_ocaml(name = "Unsupported_trait_use_as")] UnsupportedTraitUseAs(pos::Pos), #[rust_to_ocaml(name = "Unsupported_instead_of")] UnsupportedInsteadOf(pos::Pos), #[rust_to_ocaml(name = "Unexpected_arrow")] UnexpectedArrow { pos: pos::Pos, cname: String }, #[rust_to_ocaml(name = "Missing_arrow")] MissingArrow { pos: pos::Pos, cname: String }, #[rust_to_ocaml(name = "Disallowed_xhp_type")] DisallowedXhpType { pos: pos::Pos, ty_name: String }, #[rust_to_ocaml(name = "Name_is_reserved")] NameIsReserved { pos: pos::Pos, name: String }, #[rust_to_ocaml(name = "Dollardollar_unused")] DollardollarUnused(pos::Pos), #[rust_to_ocaml(name = "Method_name_already_bound")] MethodNameAlreadyBound { pos: pos::Pos, meth_name: String }, #[rust_to_ocaml(name = "Error_name_already_bound")] ErrorNameAlreadyBound { pos: pos::Pos, name: String, prev_pos: pos::Pos, }, #[rust_to_ocaml(name = "Unbound_name")] UnboundName { pos: pos::Pos, name: String, kind: name_context::NameContext, }, #[rust_to_ocaml(name = "Invalid_fun_pointer")] InvalidFunPointer { pos: pos::Pos, name: String }, Undefined { pos: pos::Pos, var_name: String, did_you_mean: Option<(String, pos::Pos)>, }, #[rust_to_ocaml(name = "Undefined_in_expr_tree")] UndefinedInExprTree { pos: pos::Pos, var_name: String, dsl: Option<String>, did_you_mean: Option<(String, pos::Pos)>, }, #[rust_to_ocaml(name = "This_reserved")] ThisReserved(pos::Pos), #[rust_to_ocaml(name = "Start_with_T")] StartWithT(pos::Pos), #[rust_to_ocaml(name = "Already_bound")] AlreadyBound { pos: pos::Pos, name: String }, #[rust_to_ocaml(name = "Unexpected_typedef")] UnexpectedTypedef { pos: pos::Pos, decl_pos: pos::Pos, expected_kind: name_context::NameContext, }, #[rust_to_ocaml(name = "Field_name_already_bound")] FieldNameAlreadyBound(pos::Pos), #[rust_to_ocaml(name = "Primitive_top_level")] PrimitiveTopLevel(pos::Pos), #[rust_to_ocaml(name = "Primitive_invalid_alias")] PrimitiveInvalidAlias { pos: pos::Pos, ty_name_used: String, ty_name_canon: String, }, #[rust_to_ocaml(name = "Dynamic_new_in_strict_mode")] DynamicNewInStrictMode(pos::Pos), #[rust_to_ocaml(name = "Invalid_type_access_root")] InvalidTypeAccessRoot { pos: pos::Pos, id: Option<String> }, #[rust_to_ocaml(name = "Duplicate_user_attribute")] DuplicateUserAttribute { pos: pos::Pos, attr_name: String, prev_pos: pos::Pos, }, #[rust_to_ocaml(name = "Invalid_memoize_label")] InvalidMemoizeLabel { pos: pos::Pos, attr_name: String }, #[rust_to_ocaml(name = "Unbound_attribute_name")] UnboundAttributeName { pos: pos::Pos, attr_name: String, closest_attr_name: Option<String>, }, #[rust_to_ocaml(name = "This_no_argument")] ThisNoArgument(pos::Pos), #[rust_to_ocaml(name = "Object_cast")] ObjectCast(pos::Pos), #[rust_to_ocaml(name = "This_hint_outside_class")] ThisHintOutsideClass(pos::Pos), #[rust_to_ocaml(name = "Parent_outside_class")] ParentOutsideClass(pos::Pos), #[rust_to_ocaml(name = "Self_outside_class")] SelfOutsideClass(pos::Pos), #[rust_to_ocaml(name = "Static_outside_class")] StaticOutsideClass(pos::Pos), #[rust_to_ocaml(name = "This_type_forbidden")] ThisTypeForbidden { pos: pos::Pos, in_extends: bool, in_req_extends: bool, }, #[rust_to_ocaml(name = "Nonstatic_property_with_lsb")] NonstaticPropertyWithLsb(pos::Pos), #[rust_to_ocaml(name = "Lowercase_this")] LowercaseThis { pos: pos::Pos, ty_name: String }, #[rust_to_ocaml(name = "Classname_param")] ClassnameParam(pos::Pos), #[rust_to_ocaml(name = "Tparam_applied_to_type")] TparamAppliedToType { pos: pos::Pos, tparam_name: String }, #[rust_to_ocaml(name = "Tparam_with_tparam")] TparamWithTparam { pos: pos::Pos, tparam_name: String }, #[rust_to_ocaml(name = "Shadowed_tparam")] ShadowedTparam { pos: pos::Pos, tparam_name: String, prev_pos: pos::Pos, }, #[rust_to_ocaml(name = "Missing_typehint")] MissingTypehint(pos::Pos), #[rust_to_ocaml(name = "Expected_variable")] ExpectedVariable(pos::Pos), #[rust_to_ocaml(name = "Too_many_arguments")] TooManyArguments(pos::Pos), #[rust_to_ocaml(name = "Too_few_arguments")] TooFewArguments(pos::Pos), #[rust_to_ocaml(name = "Expected_collection")] ExpectedCollection { pos: pos::Pos, cname: String }, #[rust_to_ocaml(name = "Illegal_CLASS")] IllegalCLASS(pos::Pos), #[rust_to_ocaml(name = "Illegal_TRAIT")] IllegalTRAIT(pos::Pos), #[rust_to_ocaml(name = "Illegal_fun")] IllegalFun(pos::Pos), #[rust_to_ocaml(name = "Illegal_member_variable_class")] IllegalMemberVariableClass(pos::Pos), #[rust_to_ocaml(name = "Illegal_meth_fun")] IllegalMethFun(pos::Pos), #[rust_to_ocaml(name = "Illegal_inst_meth")] IllegalInstMeth(pos::Pos), #[rust_to_ocaml(name = "Illegal_meth_caller")] IllegalMethCaller(pos::Pos), #[rust_to_ocaml(name = "Illegal_class_meth")] IllegalClassMeth(pos::Pos), #[rust_to_ocaml(name = "Lvar_in_obj_get")] LvarInObjGet { pos: pos::Pos, lvar_pos: pos::Pos, lvar_name: String, }, #[rust_to_ocaml(name = "Class_meth_non_final_self")] ClassMethNonFinalSelf { pos: pos::Pos, class_name: String }, #[rust_to_ocaml(name = "Class_meth_non_final_CLASS")] ClassMethNonFinalCLASS { pos: pos::Pos, class_name: String, is_trait: bool, }, #[rust_to_ocaml(name = "Const_without_typehint")] ConstWithoutTypehint { pos: pos::Pos, const_name: String, ty_name: String, }, #[rust_to_ocaml(name = "Prop_without_typehint")] PropWithoutTypehint { pos: pos::Pos, prop_name: String, vis: Visibility, }, #[rust_to_ocaml(name = "Illegal_constant")] IllegalConstant(pos::Pos), #[rust_to_ocaml(name = "Invalid_require_implements")] InvalidRequireImplements(pos::Pos), #[rust_to_ocaml(name = "Invalid_require_extends")] InvalidRequireExtends(pos::Pos), #[rust_to_ocaml(name = "Invalid_require_class")] InvalidRequireClass(pos::Pos), #[rust_to_ocaml(name = "Did_you_mean")] DidYouMean { pos: pos::Pos, name: String, suggest_pos: pos::Pos, suggest_name: String, }, #[rust_to_ocaml(name = "Using_internal_class")] UsingInternalClass { pos: pos::Pos, class_name: String }, #[rust_to_ocaml(name = "Too_few_type_arguments")] TooFewTypeArguments(pos::Pos), #[rust_to_ocaml(name = "Dynamic_class_name_in_strict_mode")] DynamicClassNameInStrictMode(pos::Pos), #[rust_to_ocaml(name = "Xhp_optional_required_attr")] XhpOptionalRequiredAttr { pos: pos::Pos, attr_name: String }, #[rust_to_ocaml(name = "Xhp_required_with_default")] XhpRequiredWithDefault { pos: pos::Pos, attr_name: String }, #[rust_to_ocaml(name = "Array_typehints_disallowed")] ArrayTypehintsDisallowed(pos::Pos), #[rust_to_ocaml(name = "Wildcard_hint_disallowed")] WildcardHintDisallowed(pos::Pos), #[rust_to_ocaml(name = "Wildcard_tparam_disallowed")] WildcardTparamDisallowed(pos::Pos), #[rust_to_ocaml(name = "Illegal_use_of_dynamically_callable")] IllegalUseOfDynamicallyCallable { attr_pos: pos::Pos, meth_pos: pos::Pos, vis: Visibility, }, #[rust_to_ocaml(name = "Parent_in_function_pointer")] ParentInFunctionPointer { pos: pos::Pos, meth_name: String, parent_name: Option<String>, }, #[rust_to_ocaml(name = "Self_in_non_final_function_pointer")] SelfInNonFinalFunctionPointer { pos: pos::Pos, meth_name: String, class_name: Option<String>, }, #[rust_to_ocaml(name = "Invalid_wildcard_context")] InvalidWildcardContext(pos::Pos), #[rust_to_ocaml(name = "Return_only_typehint")] ReturnOnlyTypehint { pos: pos::Pos, kind: ReturnOnlyHint }, #[rust_to_ocaml(name = "Unexpected_type_arguments")] UnexpectedTypeArguments(pos::Pos), #[rust_to_ocaml(name = "Too_many_type_arguments")] TooManyTypeArguments(pos::Pos), #[rust_to_ocaml(name = "This_as_lexical_variable")] ThisAsLexicalVariable(pos::Pos), #[rust_to_ocaml(name = "HKT_unsupported_feature")] HKTUnsupportedFeature { pos: pos::Pos, because_nested: bool, var_name: String, feature: UnsupportedFeature, }, #[rust_to_ocaml(name = "HKT_partial_application")] HKTPartialApplication { pos: pos::Pos, count: isize }, #[rust_to_ocaml(name = "HKT_wildcard")] HKTWildcard(pos::Pos), #[rust_to_ocaml(name = "HKT_implicit_argument")] HKTImplicitArgument { pos: pos::Pos, decl_pos: pos_or_decl::PosOrDecl, param_name: String, }, #[rust_to_ocaml(name = "HKT_class_with_constraints_used")] HKTClassWithConstraintsUsed { pos: pos::Pos, class_name: String }, #[rust_to_ocaml(name = "HKT_alias_with_implicit_constraints")] HKTAliasWithImplicitConstraints { pos: pos::Pos, typedef_pos: pos_or_decl::PosOrDecl, used_class_in_def_pos: pos_or_decl::PosOrDecl, typedef_name: String, typedef_tparam_name: String, used_class_in_def_name: String, used_class_tparam_name: String, }, #[rust_to_ocaml(name = "Explicit_consistent_constructor")] ExplicitConsistentConstructor { pos: pos::Pos, classish_kind: ast_defs::ClassishKind, }, #[rust_to_ocaml(name = "Module_declaration_outside_allowed_files")] ModuleDeclarationOutsideAllowedFiles(pos::Pos), #[rust_to_ocaml(name = "Dynamic_method_access")] DynamicMethodAccess(pos::Pos), #[rust_to_ocaml(name = "Deprecated_use")] DeprecatedUse { pos: pos::Pos, fn_name: String }, #[rust_to_ocaml(name = "Unnecessary_attribute")] UnnecessaryAttribute { pos: pos::Pos, attr: String, class_pos: pos::Pos, class_name: String, suggestion: Option<String>, }, #[rust_to_ocaml(name = "Tparam_non_shadowing_reuse")] TparamNonShadowingReuse { pos: pos::Pos, tparam_name: String }, #[rust_to_ocaml(name = "Dynamic_hint_disallowed")] DynamicHintDisallowed(pos::Pos), #[rust_to_ocaml(name = "Illegal_typed_local")] IllegalTypedLocal { join: bool, id_pos: pos::Pos, id_name: String, def_pos: pos::Pos, }, }
Rust
hhvm/hphp/hack/src/oxidized/gen/naming_phase_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<e6d3dee33c6bcc3772beebf38708506b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = r#"ocaml.warning "-37""#)] #[repr(C, u8)] pub enum ExperimentalFeature { #[rust_to_ocaml(name = "Like_type")] LikeType(pos::Pos), Supportdyn(pos::Pos), #[rust_to_ocaml(attr = r#"warning "-37""#)] #[rust_to_ocaml(name = "Const_attr")] ConstAttr(pos::Pos), #[rust_to_ocaml(attr = r#"warning "-37""#)] #[rust_to_ocaml(name = "Const_static_prop")] ConstStaticProp(pos::Pos), #[rust_to_ocaml(attr = r#"warning "-37""#)] #[rust_to_ocaml(name = "IFC_infer_flows")] IFCInferFlows(pos::Pos), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = r#"ocaml.warning "-37""#)] #[repr(C, u8)] pub enum NamingPhaseError { Naming(naming_error::NamingError), #[rust_to_ocaml(name = "Nast_check")] NastCheck(nast_check_error::NastCheckError), #[rust_to_ocaml(name = "Unexpected_hint")] UnexpectedHint(pos::Pos), #[rust_to_ocaml(name = "Malformed_access")] MalformedAccess(pos::Pos), #[rust_to_ocaml(name = "Experimental_feature")] ExperimentalFeature(ExperimentalFeature), #[rust_to_ocaml(attr = r#"warning "-37""#)] Parsing(parsing_error::ParsingError), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Agg { pub naming: Vec<naming_error::NamingError>, pub nast_check: Vec<nast_check_error::NastCheckError>, pub unexpected_hints: Vec<pos::Pos>, pub malformed_accesses: Vec<pos::Pos>, pub experimental_features: Vec<ExperimentalFeature>, pub parsing: Vec<parsing_error::ParsingError>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/nast_check_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<627c906c3afc284fc1345b0b17258d0b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::error_codes::NastCheck as Error_code; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum Verb { #[rust_to_ocaml(name = "Vreq_implement")] VreqImplement, Vimplement, } impl TrivialDrop for Verb {} arena_deserializer::impl_deserialize_in_arena!(Verb); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum NastCheckError { #[rust_to_ocaml(name = "Repeated_record_field_name")] RepeatedRecordFieldName { pos: pos::Pos, name: String, prev_pos: pos_or_decl::PosOrDecl, }, #[rust_to_ocaml(name = "Dynamically_callable_reified")] DynamicallyCallableReified(pos::Pos), #[rust_to_ocaml(name = "No_construct_parent")] NoConstructParent(pos::Pos), #[rust_to_ocaml(name = "Nonstatic_method_in_abstract_final_class")] NonstaticMethodInAbstractFinalClass(pos::Pos), #[rust_to_ocaml(name = "Constructor_required")] ConstructorRequired { pos: pos::Pos, class_name: String, prop_names: Vec<String>, }, #[rust_to_ocaml(name = "Not_initialized")] NotInitialized { pos: pos::Pos, class_name: String, props: Vec<(pos_or_decl::PosOrDecl, String)>, }, #[rust_to_ocaml(name = "Call_before_init")] CallBeforeInit { pos: pos::Pos, prop_name: String, }, #[rust_to_ocaml(name = "Abstract_with_body")] AbstractWithBody(pos::Pos), #[rust_to_ocaml(name = "Not_abstract_without_typeconst")] NotAbstractWithoutTypeconst(pos::Pos), #[rust_to_ocaml(name = "Typeconst_depends_on_external_tparam")] TypeconstDependsOnExternalTparam { pos: pos::Pos, ext_pos: pos::Pos, ext_name: String, }, #[rust_to_ocaml(name = "Interface_with_partial_typeconst")] InterfaceWithPartialTypeconst(pos::Pos), #[rust_to_ocaml(name = "Partially_abstract_typeconst_definition")] PartiallyAbstractTypeconstDefinition(pos::Pos), #[rust_to_ocaml(name = "Refinement_in_typestruct")] RefinementInTypestruct { pos: pos::Pos, kind: String, }, #[rust_to_ocaml(name = "Multiple_xhp_category")] MultipleXhpCategory(pos::Pos), #[rust_to_ocaml(name = "Return_in_gen")] ReturnInGen(pos::Pos), #[rust_to_ocaml(name = "Return_in_finally")] ReturnInFinally(pos::Pos), #[rust_to_ocaml(name = "Toplevel_break")] ToplevelBreak(pos::Pos), #[rust_to_ocaml(name = "Toplevel_continue")] ToplevelContinue(pos::Pos), #[rust_to_ocaml(name = "Continue_in_switch")] ContinueInSwitch(pos::Pos), #[rust_to_ocaml(name = "Await_in_sync_function")] AwaitInSyncFunction { pos: pos::Pos, func_pos: Option<pos::Pos>, }, #[rust_to_ocaml(name = "Interface_uses_trait")] InterfaceUsesTrait(pos::Pos), #[rust_to_ocaml(name = "Static_memoized_function")] StaticMemoizedFunction(pos::Pos), Magic { pos: pos::Pos, meth_name: String, }, #[rust_to_ocaml(name = "Non_interface")] NonInterface { pos: pos::Pos, name: String, verb: Verb, }, #[rust_to_ocaml(name = "ToString_returns_string")] ToStringReturnsString(pos::Pos), #[rust_to_ocaml(name = "ToString_visibility")] ToStringVisibility(pos::Pos), #[rust_to_ocaml(name = "Uses_non_trait")] UsesNonTrait { pos: pos::Pos, name: String, kind: String, }, #[rust_to_ocaml(name = "Requires_non_class")] RequiresNonClass { pos: pos::Pos, name: String, kind: String, }, #[rust_to_ocaml(name = "Requires_final_class")] RequiresFinalClass { pos: pos::Pos, name: String, }, #[rust_to_ocaml(name = "Abstract_body")] AbstractBody(pos::Pos), #[rust_to_ocaml(name = "Interface_with_member_variable")] InterfaceWithMemberVariable(pos::Pos), #[rust_to_ocaml(name = "Interface_with_static_member_variable")] InterfaceWithStaticMemberVariable(pos::Pos), #[rust_to_ocaml(name = "Illegal_function_name")] IllegalFunctionName { pos: pos::Pos, name: String, }, #[rust_to_ocaml(name = "Entrypoint_arguments")] EntrypointArguments(pos::Pos), #[rust_to_ocaml(name = "Entrypoint_generics")] EntrypointGenerics(pos::Pos), #[rust_to_ocaml(name = "Variadic_memoize")] VariadicMemoize(pos::Pos), #[rust_to_ocaml(name = "Abstract_method_memoize")] AbstractMethodMemoize(pos::Pos), #[rust_to_ocaml(name = "Instance_property_in_abstract_final_class")] InstancePropertyInAbstractFinalClass(pos::Pos), #[rust_to_ocaml(name = "Inout_params_special")] InoutParamsSpecial(pos::Pos), #[rust_to_ocaml(name = "Inout_params_memoize")] InoutParamsMemoize { pos: pos::Pos, param_pos: pos::Pos, }, #[rust_to_ocaml(name = "Inout_in_transformed_pseudofunction")] InoutInTransformedPseudofunction { pos: pos::Pos, fn_name: String, }, #[rust_to_ocaml(name = "Reading_from_append")] ReadingFromAppend(pos::Pos), #[rust_to_ocaml(name = "List_rvalue")] ListRvalue(pos::Pos), #[rust_to_ocaml(name = "Illegal_destructor")] IllegalDestructor(pos::Pos), #[rust_to_ocaml(name = "Illegal_context")] IllegalContext { pos: pos::Pos, name: String, }, #[rust_to_ocaml(name = "Case_fallthrough")] CaseFallthrough { switch_pos: pos::Pos, case_pos: pos::Pos, next_pos: Option<pos::Pos>, }, #[rust_to_ocaml(name = "Default_fallthrough")] DefaultFallthrough(pos::Pos), #[rust_to_ocaml(name = "Php_lambda_disallowed")] PhpLambdaDisallowed(pos::Pos), #[rust_to_ocaml(name = "Internal_method_with_invalid_visibility")] InternalMethodWithInvalidVisibility { pos: pos::Pos, vis: ast_defs::Visibility, }, #[rust_to_ocaml(name = "Private_and_final")] PrivateAndFinal(pos::Pos), #[rust_to_ocaml(name = "Internal_member_inside_public_trait")] InternalMemberInsidePublicTrait { member_pos: pos::Pos, trait_pos: pos::Pos, }, #[rust_to_ocaml(name = "Attribute_conflicting_memoize")] AttributeConflictingMemoize { pos: pos::Pos, second_pos: pos::Pos, }, #[rust_to_ocaml(name = "Soft_internal_without_internal")] SoftInternalWithoutInternal(pos::Pos), #[rust_to_ocaml(name = "Wrong_expression_kind_builtin_attribute")] WrongExpressionKindBuiltinAttribute { pos: pos::Pos, attr_name: String, expr_kind: String, }, #[rust_to_ocaml(name = "Attribute_too_many_arguments")] AttributeTooManyArguments { pos: pos::Pos, name: String, expected: isize, }, #[rust_to_ocaml(name = "Attribute_too_few_arguments")] AttributeTooFewArguments { pos: pos::Pos, name: String, expected: isize, }, #[rust_to_ocaml(name = "Attribute_not_exact_number_of_args")] AttributeNotExactNumberOfArgs { pos: pos::Pos, name: String, actual: isize, expected: isize, }, #[rust_to_ocaml(name = "Attribute_param_type")] AttributeParamType { pos: pos::Pos, x: String, }, #[rust_to_ocaml(name = "Attribute_no_auto_dynamic")] AttributeNoAutoDynamic(pos::Pos), #[rust_to_ocaml(name = "Generic_at_runtime")] GenericAtRuntime { pos: pos::Pos, prefix: String, }, #[rust_to_ocaml(name = "Generics_not_allowed")] GenericsNotAllowed(pos::Pos), #[rust_to_ocaml(name = "Local_variable_modified_and_used")] LocalVariableModifiedAndUsed { pos: pos::Pos, pos_useds: Vec<pos::Pos>, }, #[rust_to_ocaml(name = "Local_variable_modified_twice")] LocalVariableModifiedTwice { pos: pos::Pos, pos_modifieds: Vec<pos::Pos>, }, #[rust_to_ocaml(name = "Assign_during_case")] AssignDuringCase(pos::Pos), #[rust_to_ocaml(name = "Read_before_write")] ReadBeforeWrite { pos: pos::Pos, member_name: String, }, #[rust_to_ocaml(name = "Lateinit_with_default")] LateinitWithDefault(pos::Pos), #[rust_to_ocaml(name = "Missing_assign")] MissingAssign(pos::Pos), }
Rust
hhvm/hphp/hack/src/oxidized/gen/package.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<d1e5e6bf962ad33870bdc8cb8df5f08a>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct PosId(pub pos::Pos, pub String); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct Package { pub name: PosId, pub uses: Vec<PosId>, pub includes: Vec<PosId>, pub soft_includes: Vec<PosId>, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(u8)] pub enum PackageRelationship { Unrelated, Includes, #[rust_to_ocaml(name = "Soft_includes")] SoftIncludes, Equal, } impl TrivialDrop for PackageRelationship {} arena_deserializer::impl_deserialize_in_arena!(PackageRelationship);
Rust
hhvm/hphp/hack/src/oxidized/gen/package_info.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<c5974392a883cd6439e78cd9c68d221f>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct PackageInfo { pub glob_to_package: s_map::SMap<package::Package>, pub existing_packages: s_map::SMap<package::Package>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/parser_options.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<7fc1198d132ca572d3e65e375e4abb8d>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving show")] pub type ParserOptions = global_options::GlobalOptions; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct FfiT( pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, pub bool, );
Rust
hhvm/hphp/hack/src/oxidized/gen/parsing_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<1678040748804598fcbd6f77f10174a4>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::error_codes::Parsing as Error_code; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum ParsingError { #[rust_to_ocaml(name = "Fixme_format")] FixmeFormat(pos::Pos), #[rust_to_ocaml(name = "Hh_ignore_comment")] HhIgnoreComment(pos::Pos), #[rust_to_ocaml(name = "Parsing_error")] ParsingError { pos: pos::Pos, msg: String, quickfixes: Vec<quickfix::Quickfix<pos::Pos>>, }, #[rust_to_ocaml(name = "Xhp_parsing_error")] XhpParsingError { pos: pos::Pos, msg: String }, #[rust_to_ocaml(name = "Package_config_error")] PackageConfigError { pos: pos::Pos, msg: String, reasons: Vec<message::Message<pos_or_decl::PosOrDecl>>, }, }
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_binding_ty.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<acf24b460a12454a077abf53cc96851c>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(u8)] pub enum PattBindingTy { Name, Ty, } impl TrivialDrop for PattBindingTy {} arena_deserializer::impl_deserialize_in_arena!(PattBindingTy);
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<c5592265f8d5e918ba1feb0a4b5de323>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattError { Primary(Primary), #[rust_to_ocaml(prefix = "patt_")] Apply { cb: Callback, err: Box<PattError>, }, #[rust_to_ocaml(prefix = "patt_")] #[rust_to_ocaml(name = "Apply_reasons")] ApplyReasons { rsns_cb: ReasonsCallback, secondary: Box<Secondary>, }, #[rust_to_ocaml(prefix = "patt_")] Or { fst: Box<PattError>, snd: Box<PattError>, }, Invalid { errs: Vec<validation_err::ValidationErr>, patt: Box<PattError>, }, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(u8)] pub enum Primary { #[rust_to_ocaml(name = "Any_prim")] AnyPrim, } impl TrivialDrop for Primary {} arena_deserializer::impl_deserialize_in_arena!(Primary); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Secondary { #[rust_to_ocaml(name = "Of_error")] OfError(PattError), #[rust_to_ocaml(prefix = "patt_")] #[rust_to_ocaml(name = "Violated_constraint")] ViolatedConstraint { cstr: patt_string::PattString, ty_sub: patt_locl_ty::PattLoclTy, ty_sup: patt_locl_ty::PattLoclTy, }, #[rust_to_ocaml(prefix = "patt_ty_")] #[rust_to_ocaml(name = "Subtyping_error")] SubtypingError { sub: patt_locl_ty::PattLoclTy, sup: patt_locl_ty::PattLoclTy, }, #[rust_to_ocaml(name = "Any_snd")] AnySnd, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(u8)] pub enum Callback { #[rust_to_ocaml(name = "Any_callback")] AnyCallback, } impl TrivialDrop for Callback {} arena_deserializer::impl_deserialize_in_arena!(Callback); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(u8)] pub enum ReasonsCallback { #[rust_to_ocaml(name = "Any_reasons_callback")] AnyReasonsCallback, } impl TrivialDrop for ReasonsCallback {} arena_deserializer::impl_deserialize_in_arena!(ReasonsCallback);
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_locl_ty.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<d8f37fdd1f7d06a03fdce08710c86926>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use core::*; use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattLoclTy { #[rust_to_ocaml(prefix = "patt_")] Apply { name: patt_name::PattName, params: Box<Params>, }, Prim(Prim), Shape(ShapeFields), Option(Box<PattLoclTy>), Tuple(Vec<PattLoclTy>), Dynamic, Nonnull, Any, #[rust_to_ocaml(prefix = "patt_")] Or { fst: Box<PattLoclTy>, snd: Box<PattLoclTy>, }, As { lbl: patt_var::PattVar, patt: Box<PattLoclTy>, }, Invalid(Vec<validation_err::ValidationErr>, Box<PattLoclTy>), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Params { Nil, Wildcard, #[rust_to_ocaml(prefix = "patt_")] Cons { hd: PattLoclTy, tl: Box<Params>, }, Exists(PattLoclTy), } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(u8)] pub enum Prim { Null, Void, Int, Bool, Float, String, Resource, Num, Arraykey, Noreturn, } impl TrivialDrop for Prim {} arena_deserializer::impl_deserialize_in_arena!(Prim); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ShapeFields { #[rust_to_ocaml(prefix = "patt_")] Fld { fld: ShapeField, rest: Box<ShapeFields>, }, Open, Closed, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ShapeField { pub lbl: ShapeLabel, pub optional: bool, pub patt: Box<PattLoclTy>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum ShapeLabel { StrLbl(String), IntLbl(String), CConstLbl { cls_nm: String, cnst_nm: String }, }
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_name.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<4eeb7dbc16be777c80d441f52e0bb2ad>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use core::*; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattName { As { lbl: patt_var::PattVar, patt: Box<PattName>, }, #[rust_to_ocaml(prefix = "patt_")] Name { namespace: Namespace, name: patt_string::PattString, }, Wildcard, Invalid { errs: Vec<validation_err::ValidationErr>, patt: Box<PattName>, }, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum Namespace { Root, Slash { prefix: Box<Namespace>, elt: patt_string::PattString, }, }
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_string.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<1c17c1fbe87ff8f8cb78f33d532a98d5>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use core::*; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum PattString { Exactly(String), #[rust_to_ocaml(name = "Starts_with")] StartsWith(String), #[rust_to_ocaml(name = "Ends_with")] EndsWith(String), Contains(String), Or(Vec<PattString>), And(Vec<PattString>), Not(Box<PattString>), }
Rust
hhvm/hphp/hack/src/oxidized/gen/patt_var.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<cd8dd24def8515c11985286234166c74>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use core::*; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] pub type PattVar = String;
Rust
hhvm/hphp/hack/src/oxidized/gen/pos_or_decl.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<8d2052eb81b85e22c5a4a7091a4fd1e0>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::pos::map; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] pub type PosOrDecl = pos::Pos; /// The decl and file of a position. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct Ctx { pub decl: Option<decl_reference::DeclReference>, pub file: relative_path::RelativePath, }
Rust
hhvm/hphp/hack/src/oxidized/gen/quickfix.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<b63800277691d071702e9766e3aced3f>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C, u8)] pub enum QfPos<Pos> { Qpos(Pos), #[rust_to_ocaml(name = "Qclassish_start")] QclassishStart(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C)] pub struct Edit<Pos>(pub String, pub QfPos<Pos>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C)] pub struct Quickfix<Pos> { pub title: String, pub edits: Vec<Edit<Pos>>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/saved_state_rollouts.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<15a97c8d9f4b11bae56a55ae2d2844d1>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct SavedStateRollouts { pub dummy_one: bool, pub dummy_two: bool, pub dummy_three: bool, /// Whether the depgraph contains the transitive closure of extends edges. pub no_ancestor_edges: bool, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show { with_path = false }")] #[repr(u8)] pub enum Flag { #[rust_to_ocaml(name = "Dummy_one")] DummyOne, #[rust_to_ocaml(name = "Dummy_two")] DummyTwo, #[rust_to_ocaml(name = "Dummy_three")] DummyThree, #[rust_to_ocaml(name = "No_ancestor_edges")] NoAncestorEdges, } impl TrivialDrop for Flag {} arena_deserializer::impl_deserialize_in_arena!(Flag); pub type FlagName = String;
Rust
hhvm/hphp/hack/src/oxidized/gen/scoured_comments.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<3fdb8c1302f09458fa1a840adedbe616>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (show, eq)")] pub type Fixmes = i_map::IMap<i_map::IMap<pos::Pos>>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct ScouredComments { pub comments: Vec<(pos::Pos, prim_defs::Comment)>, pub fixmes: Fixmes, pub misuses: Fixmes, pub error_pos: Vec<pos::Pos>, pub bad_ignore_pos: Vec<pos::Pos>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/search_types.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<b9427dadb5d4875fbf6a17be59d13dd6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, (show { with_path = false }))")] #[repr(u8)] pub enum SiKind { #[rust_to_ocaml(name = "SI_Class")] SIClass, #[rust_to_ocaml(name = "SI_Interface")] SIInterface, #[rust_to_ocaml(name = "SI_Enum")] SIEnum, #[rust_to_ocaml(name = "SI_Trait")] SITrait, #[rust_to_ocaml(name = "SI_Unknown")] SIUnknown, #[rust_to_ocaml(name = "SI_Mixed")] SIMixed, #[rust_to_ocaml(name = "SI_Function")] SIFunction, #[rust_to_ocaml(name = "SI_Typedef")] SITypedef, #[rust_to_ocaml(name = "SI_GlobalConstant")] SIGlobalConstant, #[rust_to_ocaml(name = "SI_XHP")] SIXHP, #[rust_to_ocaml(name = "SI_Namespace")] SINamespace, #[rust_to_ocaml(name = "SI_ClassMethod")] SIClassMethod, #[rust_to_ocaml(name = "SI_Literal")] SILiteral, #[rust_to_ocaml(name = "SI_ClassConstant")] SIClassConstant, #[rust_to_ocaml(name = "SI_Property")] SIProperty, #[rust_to_ocaml(name = "SI_LocalVariable")] SILocalVariable, #[rust_to_ocaml(name = "SI_Keyword")] SIKeyword, #[rust_to_ocaml(name = "SI_Constructor")] SIConstructor, } impl TrivialDrop for SiKind {} arena_deserializer::impl_deserialize_in_arena!(SiKind); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "sia_")] #[repr(C)] pub struct SiAddendum { /// This is expected not to contain the leading namespace backslash! See [Utils.strip_ns]. pub name: String, pub kind: SiKind, pub is_abstract: bool, pub is_final: bool, } /// This is used as a filter on top-level symbol searches, for both autocomplete and symbol-search. #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, (show { with_path = false }))")] #[repr(u8)] pub enum AutocompleteType { /// satisfies [valid_for_acid], e.g. in autocomplete contexts like `|` at the start of a statement Acid, /// satisfies [valid_for_acnew] AND isn't an abstract class, e.g. in autocomplete contexts like `$x = new |` Acnew, /// satisfies [valid_for_actype], e.g. in autocomplete contexts like `Foo<|` Actype, /// is [SI_Trait], e.g. in autocomplete contexts like `uses |` #[rust_to_ocaml(name = "Actrait_only")] ActraitOnly, /// isn't [SI_Namespace]; repo-wide symbol search #[rust_to_ocaml(name = "Ac_workspace_symbol")] AcWorkspaceSymbol, } impl TrivialDrop for AutocompleteType {} arena_deserializer::impl_deserialize_in_arena!(AutocompleteType); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum SiFile { /// string represent Int64 #[rust_to_ocaml(name = "SI_Filehash")] SIFilehash(String), #[rust_to_ocaml(name = "SI_Path")] SIPath(relative_path::RelativePath), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(prefix = "si_")] #[repr(C)] pub struct SiItem { pub name: String, pub kind: SiKind, /// needed so that local file deletes can "tombstone" the item pub file: SiFile, pub fullname: String, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving eq")] #[repr(u8)] pub enum SiComplete { Complete, Incomplete, } impl TrivialDrop for SiComplete {} arena_deserializer::impl_deserialize_in_arena!(SiComplete);
Rust
hhvm/hphp/hack/src/oxidized/gen/shallow_decl_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<9ab56fde3066f4a8f97d567a995455e6>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::ConstDecl; pub use typing_defs::*; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "scc_")] #[repr(C)] pub struct ShallowClassConst { pub abstract_: typing_defs::ClassConstKind, pub name: typing_defs::PosId, /// This field is used for two different meanings in two different places... /// enum class A:arraykey {int X="a";} -- here X.scc_type=\HH\MemberOf<A,int> /// enum B:int as arraykey {X="a"; Y=1; Z=B::X;} -- here X.scc_type=string, Y.scc_type=int, Z.scc_type=TAny /// In the later case, the scc_type is just a simple syntactic attempt to retrieve the type from the initializer. pub type_: Ty, /// This is a list of all scope-resolution operators "A::B" that are mentioned in the const initializer, /// for members of regular-enums and enum-class-enums to detect circularity of initializers. /// We don't yet have a similar mechanism for top-level const initializers. pub refs: Vec<typing_defs::ClassConstRef>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "stc_")] #[repr(C)] pub struct ShallowTypeconst { pub name: typing_defs::PosId, pub kind: typing_defs::Typeconst, pub enforceable: (pos_or_decl::PosOrDecl, bool), pub reifiable: Option<pos_or_decl::PosOrDecl>, pub is_ctx: bool, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sp_")] #[repr(C)] pub struct ShallowProp { pub name: typing_defs::PosId, pub xhp_attr: Option<XhpAttr>, pub type_: Ty, pub visibility: ast_defs::Visibility, pub flags: prop_flags::PropFlags, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sm_")] #[repr(C)] pub struct ShallowMethod { pub name: typing_defs::PosId, pub type_: Ty, pub visibility: ast_defs::Visibility, pub deprecated: Option<String>, pub flags: method_flags::MethodFlags, pub attributes: Vec<UserAttribute>, } #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type XhpEnumValues = s_map::SMap<Vec<ast_defs::XhpEnumValue>>; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct ShallowClass { pub mode: file_info::Mode, pub final_: bool, pub abstract_: bool, pub is_xhp: bool, pub internal: bool, pub has_xhp_keyword: bool, pub kind: ast_defs::ClassishKind, pub module: Option<ast_defs::Id>, pub name: typing_defs::PosId, pub tparams: Vec<Tparam>, pub where_constraints: Vec<WhereConstraint>, pub extends: Vec<Ty>, pub uses: Vec<Ty>, pub xhp_attr_uses: Vec<Ty>, pub xhp_enum_values: s_map::SMap<Vec<ast_defs::XhpEnumValue>>, pub xhp_marked_empty: bool, pub req_extends: Vec<Ty>, pub req_implements: Vec<Ty>, pub req_class: Vec<Ty>, pub implements: Vec<Ty>, pub support_dynamic_type: bool, pub consts: Vec<ShallowClassConst>, pub typeconsts: Vec<ShallowTypeconst>, pub props: Vec<ShallowProp>, pub sprops: Vec<ShallowProp>, pub constructor: Option<ShallowMethod>, pub static_methods: Vec<ShallowMethod>, pub methods: Vec<ShallowMethod>, pub user_attributes: Vec<UserAttribute>, pub enum_type: Option<EnumType>, pub docs_url: Option<String>, } #[rust_to_ocaml(attr = "deriving show")] pub type FunDecl = FunElt; #[rust_to_ocaml(attr = "deriving show")] pub type ClassDecl = ShallowClass; #[rust_to_ocaml(attr = "deriving show")] pub type TypedefDecl = TypedefType; #[rust_to_ocaml(attr = "deriving show")] pub type ModuleDecl = typing_defs::ModuleDefType; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum Decl { Class(ClassDecl), Fun(FunDecl), Typedef(TypedefDecl), Const(ConstDecl), Module(ModuleDecl), }
Rust
hhvm/hphp/hack/src/oxidized/gen/tast.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<2537c375f61a4ae9338b381b0392ceb7>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use aast_defs::*; use arena_trait::TrivialDrop; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::PossiblyEnforcedTy; pub use typing_defs::Ty; pub use typing_defs::ValKind; #[allow(unused_imports)] use crate::*; pub type DeclTy = typing_defs::Ty; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "has_")] #[repr(C)] pub struct FunTastInfo { pub implicit_return: bool, /// True if there are leaves of the function's imaginary CFG without a return statement pub readonly: bool, } #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(u8)] pub enum CheckStatus { /// The definition is checked only once. COnce, /// The definition is checked twice and this is the check under normal /// assumptions that is using the parameter and return types that are /// written in the source code (but potentially implicitly pessimised). CUnderNormalAssumptions, /// The definition is checked twice and this is the check under dynamic /// assumptions that is using the dynamic type for parameters and return. CUnderDynamicAssumptions, } impl TrivialDrop for CheckStatus {} arena_deserializer::impl_deserialize_in_arena!(CheckStatus); #[derive( Clone, Debug, Deserialize, FromOcamlRep, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct SavedEnv { #[rust_to_ocaml(attr = "opaque")] pub tcopt: typechecker_options::TypecheckerOptions, pub inference_env: typing_inference_env::TypingInferenceEnv, pub tpenv: type_parameter_env::TypeParameterEnv, pub condition_types: s_map::SMap<Ty>, pub fun_tast_info: Option<FunTastInfo>, /// Indicates how many types the callable was checked and under what /// assumptions. pub checked: CheckStatus, } #[rust_to_ocaml(attr = "deriving show")] pub type Program = aast::Program<Ty, SavedEnv>; #[rust_to_ocaml(attr = "deriving hash")] pub type Def = aast::Def<Ty, SavedEnv>; #[rust_to_ocaml(attr = "deriving hash")] pub type DefWithDynamic = tast_with_dynamic::TastWithDynamic<Def>; pub type Expr = aast::Expr<Ty, SavedEnv>; pub type Expr_ = aast::Expr_<Ty, SavedEnv>; pub type Stmt = aast::Stmt<Ty, SavedEnv>; pub type Stmt_ = aast::Stmt_<Ty, SavedEnv>; pub type Case = aast::Case<Ty, SavedEnv>; pub type Block = aast::Block<Ty, SavedEnv>; pub type Class_ = aast::Class_<Ty, SavedEnv>; pub type ClassId = aast::ClassId<Ty, SavedEnv>; pub type TypeHint = aast::TypeHint<Ty>; pub type Targ = aast::Targ<Ty>; pub type ClassGetExpr = aast::ClassGetExpr<Ty, SavedEnv>; pub type ClassTypeconstDef = aast::ClassTypeconstDef<Ty, SavedEnv>; pub type UserAttribute = aast::UserAttribute<Ty, SavedEnv>; pub type CaptureLid = aast::CaptureLid<Ty>; pub type Fun_ = aast::Fun_<Ty, SavedEnv>; pub type Efun = aast::Efun<Ty, SavedEnv>; pub type FileAttribute = aast::FileAttribute<Ty, SavedEnv>; pub type FunDef = aast::FunDef<Ty, SavedEnv>; pub type FunParam = aast::FunParam<Ty, SavedEnv>; pub type FuncBody = aast::FuncBody<Ty, SavedEnv>; pub type Method_ = aast::Method_<Ty, SavedEnv>; pub type ClassVar = aast::ClassVar<Ty, SavedEnv>; pub type ClassConst = aast::ClassConst<Ty, SavedEnv>; pub type Tparam = aast::Tparam<Ty, SavedEnv>; pub type Typedef = aast::Typedef<Ty, SavedEnv>; pub type Gconst = aast::Gconst<Ty, SavedEnv>; pub type ModuleDef = aast::ModuleDef<Ty, SavedEnv>; pub type CallExpr = aast::CallExpr<Ty, SavedEnv>; #[derive( Clone, Debug, Deserialize, FromOcamlRep, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct ByNames { pub fun_tasts: s_map::SMap<tast_with_dynamic::TastWithDynamic<Def>>, pub class_tasts: s_map::SMap<tast_with_dynamic::TastWithDynamic<Def>>, pub typedef_tasts: s_map::SMap<Def>, pub gconst_tasts: s_map::SMap<Def>, pub module_tasts: s_map::SMap<Def>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/tast_hashes.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<62a4b4361a1bf89fdd0a6b50f296c41b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; pub type Hash = isize; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving yojson_of")] #[repr(C)] pub struct ByNames { #[serde(default)] #[rust_to_ocaml(attr = "yojson_drop_if SMap.is_empty")] pub fun_tast_hashes: s_map::SMap<Hash>, #[serde(default)] #[rust_to_ocaml(attr = "yojson_drop_if SMap.is_empty")] pub class_tast_hashes: s_map::SMap<Hash>, #[serde(default)] #[rust_to_ocaml(attr = "yojson_drop_if SMap.is_empty")] pub typedef_tast_hashes: s_map::SMap<Hash>, #[serde(default)] #[rust_to_ocaml(attr = "yojson_drop_if SMap.is_empty")] pub gconst_tast_hashes: s_map::SMap<Hash>, #[serde(default)] #[rust_to_ocaml(attr = "yojson_drop_if SMap.is_empty")] pub module_tast_hashes: s_map::SMap<Hash>, } #[rust_to_ocaml(attr = "deriving yojson_of")] pub type TastHashes = relative_path::map::Map<ByNames>;
Rust
hhvm/hphp/hack/src/oxidized/gen/tast_with_dynamic.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<e44be98972553b91c29584e4d15e15a8>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[rust_to_ocaml(prefix = "under_")] #[repr(C)] pub struct TastWithDynamic<A> { pub normal_assumptions: A, pub dynamic_assumptions: Option<A>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/typechecker_options.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<dc5dab05b6cc9c8adf36e0c9a8eef62e>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type TypecheckerOptions = global_options::GlobalOptions;
Rust
hhvm/hphp/hack/src/oxidized/gen/type_counter.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<ab6b6d2cb8c6f5937164b90ee6438ad7>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; pub use pos::Pos; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (ord, yojson_of)")] #[repr(C, u8)] pub enum Entity { Class(String), Function(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (ord, yojson_of)")] #[repr(C)] pub struct EntityPos(pub Pos, pub Entity); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (ord, yojson_of)")] #[repr(u8)] pub enum LoggedType { Like, NonLike, Mixed, SupportdynOfMixed, Dynamic, Tany, } impl TrivialDrop for LoggedType {} arena_deserializer::impl_deserialize_in_arena!(LoggedType); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (ord, yojson_of)")] #[repr(u8)] pub enum Category { Expression, #[rust_to_ocaml(name = "Obj_get_receiver")] ObjGetReceiver, #[rust_to_ocaml(name = "Class_get_receiver")] ClassGetReceiver, #[rust_to_ocaml(name = "Class_const_receiver")] ClassConstReceiver, Property, Parameter, Return, } impl TrivialDrop for Category {} arena_deserializer::impl_deserialize_in_arena!(Category); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving yojson_of")] #[repr(C)] pub struct Count { /// The position of the entity for which this count holds pub entity_pos: EntityPos, /// The type that this count is for pub counted_type: LoggedType, /// Program construct that produces this type pub category: Category, /// The actual count pub value: isize, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving yojson_of")] #[rust_to_ocaml(prefix = "num_")] #[repr(C)] pub struct Summary { pub like_types: isize, pub non_like_types: isize, pub mixed: isize, pub supportdyn_of_mixed: isize, pub dynamic: isize, pub tany: isize, } #[rust_to_ocaml(attr = "deriving yojson_of")] pub type TypeCounter = relative_path::map::Map<Summary>;
Rust
hhvm/hphp/hack/src/oxidized/gen/type_parameter_env.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<1c72b3e9cd571f1c5601e290720fd784>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::*; pub use typing_kinding_defs::*; pub use crate::typing_set as ty_set; #[allow(unused_imports)] use crate::*; pub type TparamName = String; pub type TparamBounds = ty_set::TySet; pub type TparamInfo = typing_kinding_defs::Kind; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct TypeParameterEnv { /// The position indicates where the type parameter was defined. /// It may be Pos.none if the type parameter denotes a fresh type variable /// (i.e., without a source location that defines it) pub tparams: s_map::SMap<(pos_or_decl::PosOrDecl, TparamInfo)>, pub consistent: bool, }
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<a4ea892034ea9ce01ec09ff8408915d0>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs_core::*; pub use typing_defs_flags::*; #[allow(unused_imports)] use crate::*; /// Origin of Class Constant References: /// In order to be able to detect cycle definitions like /// class C { /// const int A = D::A; /// } /// class D { /// const int A = C::A; /// } /// we need to remember which constants were used during initialization. /// /// Currently the syntax of constants allows direct references to another class /// like D::A, or self references using self::A. /// /// class_const_from encodes the origin (class vs self). #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum ClassConstFrom { #[rust_to_ocaml(name = "Self")] Self_, From(String), } /// Class Constant References: /// In order to be able to detect cycle definitions like /// class C { /// const int A = D::A; /// } /// class D { /// const int A = C::A; /// } /// we need to remember which constants were used during initialization. /// /// Currently the syntax of constants allows direct references to another class /// like D::A, or self references using self::A. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct ClassConstRef(pub ClassConstFrom, pub String); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "cd_")] #[repr(C)] pub struct ConstDecl { pub pos: pos_or_decl::PosOrDecl, pub type_: Ty, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "ce_")] #[repr(C)] pub struct ClassElt { pub visibility: CeVisibility, pub type_: lazy::Lazy<Ty>, /// identifies the class from which this elt originates pub origin: String, pub deprecated: Option<String>, /// pos of the type of the elt pub pos: lazy::Lazy<pos_or_decl::PosOrDecl>, pub flags: typing_defs_flags::class_elt::ClassElt, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "fe_")] #[repr(C)] pub struct FunElt { pub deprecated: Option<String>, pub module: Option<ast_defs::Id>, /// Top-level functions have limited visibilities pub internal: bool, pub type_: Ty, pub pos: pos_or_decl::PosOrDecl, pub php_std_lib: bool, pub support_dynamic_type: bool, pub no_auto_dynamic: bool, pub no_auto_likes: bool, } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum ClassConstKind { CCAbstract(bool), CCConcrete, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "cc_")] #[repr(C)] pub struct ClassConst { pub synthesized: bool, pub abstract_: ClassConstKind, pub pos: pos_or_decl::PosOrDecl, pub type_: Ty, /// identifies the class from which this const originates pub origin: String, /// references to the constants used in the initializer pub refs: Vec<ClassConstRef>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum ModuleReference { MRGlobal, MRPrefix(String), MRExact(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "mdt_")] #[repr(C)] pub struct ModuleDefType { pub pos: pos_or_decl::PosOrDecl, pub exports: Option<Vec<ModuleReference>>, pub imports: Option<Vec<ModuleReference>>, } /// The position is that of the hint in the `use` / `implements` AST node /// that causes a class to have this requirement applied to it. E.g. /// /// ``` /// class Foo {} /// /// interface Bar { /// require extends Foo; <- position of the decl_phase ty /// } /// /// class Baz extends Foo implements Bar { <- position of the `implements` /// } /// ``` #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Requirement(pub pos_or_decl::PosOrDecl, pub Ty); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "atc_")] #[repr(C)] pub struct AbstractTypeconst { pub as_constraint: Option<Ty>, pub super_constraint: Option<Ty>, pub default: Option<Ty>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ConcreteTypeconst { pub tc_type: Ty, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "patc_")] #[repr(C)] pub struct PartiallyAbstractTypeconst { pub constraint: Ty, pub type_: Ty, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Typeconst { TCAbstract(AbstractTypeconst), TCConcrete(ConcreteTypeconst), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ttc_")] #[repr(C)] pub struct TypeconstType { pub synthesized: bool, pub name: PosId, pub kind: Typeconst, pub origin: String, /// If the typeconst had the <<__Enforceable>> attribute on its /// declaration, this will be [(position_of_declaration, true)]. /// /// In legacy decl, the second element of the tuple will also be true if /// the typeconst overrides some parent typeconst which had the /// <<__Enforceable>> attribute. In that case, the position will point to /// the declaration of the parent typeconst. /// /// In shallow decl, this is not the case--there is no overriding behavior /// modeled here, and the second element will only be true when the /// declaration of this typeconst had the attribute. /// /// When the second element of the tuple is false, the position will be /// [Pos_or_decl.none]. /// /// To manage the difference between legacy and shallow decl, use /// [Typing_classes_heap.Api.get_typeconst_enforceability] rather than /// accessing this field directly. pub enforceable: (pos_or_decl::PosOrDecl, bool), pub reifiable: Option<pos_or_decl::PosOrDecl>, pub concretized: bool, pub is_ctx: bool, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "te_")] #[repr(C)] pub struct EnumType { pub base: Ty, pub constraint: Option<Ty>, pub includes: Vec<Ty>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "td_")] #[repr(C)] pub struct TypedefType { pub module: Option<ast_defs::Id>, pub pos: pos_or_decl::PosOrDecl, pub vis: ast_defs::TypedefVisibility, pub tparams: Vec<Tparam>, pub as_constraint: Option<Ty>, pub super_constraint: Option<Ty>, pub type_: Ty, pub is_ctx: bool, pub attributes: Vec<UserAttribute>, pub internal: bool, pub docs_url: Option<String>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum DeserializationError { /// The type was valid, but some component thereof was a decl_ty when we /// expected a locl_phase ty, or vice versa. #[rust_to_ocaml(name = "Wrong_phase")] WrongPhase(String), /// The specific type or some component thereof is not one that we support /// deserializing, usually because not enough information was serialized to be /// able to deserialize it again. #[rust_to_ocaml(name = "Not_supported")] NotSupported(String), /// The input JSON was invalid for some reason. #[rust_to_ocaml(name = "Deserialization_error")] DeserializationError(String), }
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_defs_core.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<81c31c27f343f2346da69ae759110c41>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; pub use reason::PosId; use serde::Deserialize; use serde::Serialize; pub use crate::t_shape_map; pub use crate::typing_reason as reason; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C, u8)] pub enum CeVisibility { Vpublic, Vprivate(String), Vprotected(String), Vinternal(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord)")] #[repr(C, u8)] pub enum IfcFunDecl { FDPolicied(Option<String>), FDInferFlows, } #[rust_to_ocaml(attr = "deriving (eq, hash, ord)")] pub type CrossPackageDecl = Option<String>; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving eq")] #[repr(u8)] pub enum ValKind { Lval, LvalSubexpr, Other, } impl TrivialDrop for ValKind {} arena_deserializer::impl_deserialize_in_arena!(ValKind); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving eq")] #[repr(u8)] pub enum FunTparamsKind { /// If ft_tparams is empty, the containing fun_type is a concrete function type. /// Otherwise, it is a generic function and ft_tparams specifies its type parameters. FTKtparams, /// The containing fun_type is a concrete function type which is an /// instantiation of a generic function with at least one reified type /// parameter. This means that the function requires explicit type arguments /// at every invocation, and ft_tparams specifies the type arguments with /// which the generic function was instantiated, as well as whether each /// explicit type argument must be reified. #[rust_to_ocaml(name = "FTKinstantiated_targs")] FTKinstantiatedTargs, } impl TrivialDrop for FunTparamsKind {} arena_deserializer::impl_deserialize_in_arena!(FunTparamsKind); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C, u8)] pub enum TypeOrigin { #[rust_to_ocaml(name = "Missing_origin")] MissingOrigin, #[rust_to_ocaml(name = "From_alias")] FromAlias(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C)] pub struct PosString(pub pos_or_decl::PosOrDecl, pub String); #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] pub type TByteString = String; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C)] pub struct PosByteString(pub pos_or_decl::PosOrDecl, pub bstr::BString); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C, u8)] pub enum TshapeFieldName { #[rust_to_ocaml(name = "TSFlit_int")] TSFlitInt(PosString), #[rust_to_ocaml(name = "TSFlit_str")] TSFlitStr(PosByteString), #[rust_to_ocaml(name = "TSFclass_const")] TSFclassConst(PosId, PosString), } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(u8)] pub enum ParamMode { FPnormal, FPinout, } impl TrivialDrop for ParamMode {} arena_deserializer::impl_deserialize_in_arena!(ParamMode); #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type XhpAttr = xhp_attribute::XhpAttribute; /// Denotes the categories of requirements we apply to constructor overrides. /// /// In the default case, we use Inconsistent. If a class has <<__ConsistentConstruct>>, /// or if it inherits a class that has <<__ConsistentConstruct>>, we use inherited. /// If we have a new final class that doesn't extend from <<__ConsistentConstruct>>, /// then we use Final. Only classes that are Inconsistent or Final can have reified /// generics. #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(u8)] pub enum ConsistentKind { Inconsistent, ConsistentConstruct, FinalClass, } impl TrivialDrop for ConsistentKind {} arena_deserializer::impl_deserialize_in_arena!(ConsistentKind); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C, u8)] pub enum DependentType { DTexpr(ident::Ident), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[repr(C, u8)] pub enum UserAttributeParam { Classname(String), EnumClassLabel(String), String(bstr::BString), Int(String), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[rust_to_ocaml(prefix = "ua_")] #[repr(C)] pub struct UserAttribute { pub name: PosId, pub params: Vec<UserAttributeParam>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[rust_to_ocaml(prefix = "tp_")] #[repr(C)] pub struct Tparam { pub variance: ast_defs::Variance, pub name: PosId, pub tparams: Vec<Tparam>, pub constraints: Vec<(ast_defs::ConstraintKind, Ty)>, pub reified: ast_defs::ReifyKind, pub user_attributes: Vec<UserAttribute>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[repr(C)] pub struct WhereConstraint(pub Ty, pub ast_defs::ConstraintKind, pub Ty); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show, ord)")] #[repr(u8)] pub enum Enforcement { Unenforced, Enforced, } impl TrivialDrop for Enforcement {} arena_deserializer::impl_deserialize_in_arena!(Enforcement); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Ty(pub reason::T_, pub Box<Ty_>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum NegType { #[rust_to_ocaml(name = "Neg_prim")] NegPrim(ast_defs::Tprim), #[rust_to_ocaml(name = "Neg_class")] NegClass(PosId), } /// A shape may specify whether or not fields are required. For example, consider /// this typedef: /// /// ``` /// type ShapeWithOptionalField = shape(?'a' => ?int); /// ``` /// /// With this definition, the field 'a' may be unprovided in a shape. In this /// case, the field 'a' would have sf_optional set to true. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sft_")] #[repr(C)] pub struct ShapeFieldType { pub optional: bool, pub ty: Ty, } #[derive( Clone, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Ty_ { /// The late static bound type of a class Tthis, /// Either an object type or a type alias, ty list are the arguments Tapply(PosId, Vec<Ty>), /// 'With' refinements of the form `_ with { type T as int; type TC = C; }`. Trefinement(Ty, ClassRefinement), /// "Any" is the type of a variable with a missing annotation, and "mixed" is /// the type of a variable annotated as "mixed". THESE TWO ARE VERY DIFFERENT! /// Any unifies with anything, i.e., it is both a supertype and subtype of any /// other type. You can do literally anything to it; it's the "trust me" type. /// Mixed, on the other hand, is only a supertype of everything. You need to do /// a case analysis to figure out what it is (i.e., its elimination form). /// /// Here's an example to demonstrate: /// /// ``` /// function f($x): int { /// return $x + 1; /// } /// ``` /// /// In that example, $x has type Tany. This unifies with anything, so adding /// one to it is allowed, and returning that as int is allowed. /// /// In contrast, if $x were annotated as mixed, adding one to that would be /// a type error -- mixed is not a subtype of int, and you must be a subtype /// of int to take part in addition. (The converse is true though -- int is a /// subtype of mixed.) A case analysis would need to be done on $x, via /// is_int or similar. /// /// mixed exists only in the decl_phase phase because it is desugared into ?nonnull /// during the localization phase. Tmixed, /// Various intepretations, depending on context. /// inferred type e.g. (vec<_> $x) ==> $x[0] /// placeholder in refinement e.g. $x as Vector<_> /// placeholder for higher-kinded formal type parameter e.g. foo<T1<_>>(T1<int> $_) Twildcard, Tlike(Ty), Tany(tany_sentinel::TanySentinel), Tnonnull, /// A dynamic type is a special type which sometimes behaves as if it were a /// top type; roughly speaking, where a specific value of a particular type is /// expected and that type is dynamic, anything can be given. We call this /// behaviour "coercion", in that the types "coerce" to dynamic. In other ways it /// behaves like a bottom type; it can be used in any sort of binary expression /// or even have object methods called from it. However, it is in fact neither. /// /// it captures dynamicism within function scope. /// See tests in typecheck/dynamic/ for more examples. Tdynamic, /// Nullable, called "option" in the ML parlance. Toption(Ty), /// All the primitive types: int, string, void, etc. Tprim(ast_defs::Tprim), /// A wrapper around fun_type, which contains the full type information for a /// function, method, lambda, etc. Tfun(FunType), /// Tuple, with ordered list of the types of the elements of the tuple. Ttuple(Vec<Ty>), Tshape(ShapeType), /// The type of a generic parameter. The constraints on a generic parameter /// are accessed through the lenv.tpenv component of the environment, which /// is set up when checking the body of a function or method. See uses of /// Typing_phase.add_generic_parameters_and_constraints. The list denotes /// type arguments. Tgeneric(String, Vec<Ty>), /// Union type. /// The values that are members of this type are the union of the values /// that are members of the components of the union. /// Some examples (writing | for binary union) /// Tunion [] is the "nothing" type, with no values /// Tunion [int;float] is the same as num /// Tunion [null;t] is the same as Toption t Tunion(Vec<Ty>), Tintersection(Vec<Ty>), /// Tvec_or_dict (ty1, ty2) => "vec_or_dict<ty1, ty2>" #[rust_to_ocaml(name = "Tvec_or_dict")] TvecOrDict(Ty, Ty), /// Name of class, name of type const, remaining names of type consts Taccess(TaccessType), /// The type of an opaque type or enum. Outside their defining files or /// when they represent enums, they are "opaque", which means that they /// only unify with themselves. Within a file, uses of newtypes are /// expanded to their definitions (unless the newtype is an enum). /// /// However, it is possible to have a constraint that allows us to relax /// opaqueness. For example: /// /// newtype MyType as int = ... /// /// or /// /// enum MyType: int as int { ... } /// /// Outside of the file where the type was defined, this translates to: /// /// Tnewtype ((pos, "MyType"), [], Tprim Tint) /// /// which means that MyType is abstract, but is a subtype of int as well. /// When the constraint is omitted, the third parameter is set to mixed. /// /// The second parameter is the list of type arguments to the type. Tnewtype(String, Vec<Ty>, Ty), Tvar(ident::Ident), /// This represents a type alias that lacks necessary type arguments. Given /// type Foo<T1,T2> = ... /// Tunappliedalias "Foo" stands for usages of plain Foo, without supplying /// further type arguments. In particular, Tunappliedalias always stands for /// a higher-kinded type. It is never used for an alias like /// type Foo2 = ... /// that simply doesn't require type arguments. #[rust_to_ocaml(name = "Tunapplied_alias")] TunappliedAlias(String), /// see dependent_type Tdependent(DependentType, Ty), /// An instance of a class or interface, ty list are the arguments /// If exact=Exact, then this represents instances of *exactly* this class /// If exact=Nonexact, this also includes subclasses Tclass(PosId, Exact, Vec<Ty>), /// The negation of the type in neg_type Tneg(NegType), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct TaccessType(pub Ty, pub PosId); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Exact { Exact, Nonexact(ClassRefinement), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassRefinement { pub cr_consts: s_map::SMap<RefinedConst>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "rc_")] #[repr(C)] pub struct RefinedConst { pub bound: RefinedConstBound, pub is_ctx: bool, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum RefinedConstBound { TRexact(Ty), TRloose(RefinedConstBounds), } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tr_")] #[repr(C)] pub struct RefinedConstBounds { pub lower: Vec<Ty>, pub upper: Vec<Ty>, } /// Whether all fields of this shape are known, types of each of the /// known arms. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "s_")] #[repr(C)] pub struct ShapeType { pub origin: TypeOrigin, pub unknown_value: Ty, pub fields: t_shape_map::TShapeMap<ShapeFieldType>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Capability { CapDefaults(pos_or_decl::PosOrDecl), CapTy(Ty), } /// Companion to fun_params type, intended to consolidate checking of /// implicit params for functions. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct FunImplicitParams { pub capability: Capability, } /// The type of a function AND a method. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ft_")] #[repr(C)] pub struct FunType { pub tparams: Vec<Tparam>, pub where_constraints: Vec<WhereConstraint>, pub params: FunParams, pub implicit_params: FunImplicitParams, /// Carries through the sync/async information from the aast pub ret: PossiblyEnforcedTy, pub flags: typing_defs_flags::FunTypeFlags, pub ifc_decl: IfcFunDecl, pub cross_package: CrossPackageDecl, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "et_")] #[repr(C)] pub struct PossiblyEnforcedTy { /// True if consumer of this type enforces it at runtime pub enforced: Enforcement, pub type_: Ty, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fp_")] #[repr(C)] pub struct FunParam { pub pos: pos_or_decl::PosOrDecl, pub name: Option<String>, pub type_: PossiblyEnforcedTy, pub flags: typing_defs_flags::FunParamFlags, } #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving hash")] pub type FunParams = Vec<FunParam>; #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(u8)] pub enum DestructureKind { ListDestructure, SplatUnpack, } impl TrivialDrop for DestructureKind {} arena_deserializer::impl_deserialize_in_arena!(DestructureKind); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "d_")] #[repr(C)] pub struct Destructure { /// This represents the standard parameters of a function or the fields in a list /// destructuring assignment. Example: /// /// function take(bool $b, float $f = 3.14, arraykey ...$aks): void {} /// function f((bool, float, int, string) $tup): void { /// take(...$tup); /// } /// /// corresponds to the subtyping assertion /// /// (bool, float, int, string) <: splat([#1], [opt#2], ...#3) pub required: Vec<Ty>, /// Represents the optional parameters in a function, only used for splats pub optional: Vec<Ty>, /// Represents a function's variadic parameter, also only used for splats pub variadic: Option<Ty>, /// list() destructuring allows for partial matches on lists, even when the operation /// might throw i.e. list($a) = vec[]; pub kind: DestructureKind, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "hm_")] #[repr(C)] pub struct HasMember { pub name: nast::Sid, pub type_: Ty, /// This is required to check ambiguous object access, where sometimes /// HHVM would access the private member of a parent class instead of the /// one from the current class. #[rust_to_ocaml(attr = "opaque")] pub class_id: nast::ClassId_, #[rust_to_ocaml(attr = "opaque")] pub explicit_targs: Option<Vec<nast::Targ>>, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "ci_")] #[repr(C)] pub struct CanIndex { pub key: Ty, pub shape: Option<TshapeFieldName>, pub val: Ty, pub expr_pos: pos::Pos, pub index_pos: pos::Pos, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "ct_")] #[repr(C)] pub struct CanTraverse { pub key: Option<Ty>, pub val: Ty, pub is_await: bool, pub reason: reason::Reason, } #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "htm_")] #[repr(C)] pub struct HasTypeMember { pub id: String, pub lower: Ty, pub upper: Ty, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum ConstraintType_ { #[rust_to_ocaml(name = "Thas_member")] ThasMember(HasMember), #[rust_to_ocaml(name = "Thas_type_member")] ThasTypeMember(HasTypeMember), #[rust_to_ocaml(name = "Tcan_index")] TcanIndex(CanIndex), #[rust_to_ocaml(name = "Tcan_traverse")] TcanTraverse(CanTraverse), /// The type of container destructuring via list() or splat `...` Tdestructure(Destructure), TCunion(Ty, ConstraintType), TCintersection(Ty, ConstraintType), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct ConstraintType(pub reason::Reason, pub Box<ConstraintType_>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum InternalType { LoclType(Ty), ConstraintType(ConstraintType), }
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_inference_env.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<ba21efeda98faf3c4f8ea31dd4ed1126>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::*; pub use crate::internal_type_set as i_ty_set; pub use crate::typing_logic as t_l; pub use crate::typing_tyvar_occurrences as occ; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct TyvarConstraints { /// Does this type variable appear covariantly in the type of the expression? pub appears_covariantly: bool, /// Does this type variable appear contravariantly in the type of the expression? /// If it appears in an invariant position then both will be true; if it doesn't /// appear at all then both will be false. pub appears_contravariantly: bool, pub lower_bounds: i_ty_set::ITySet, pub upper_bounds: i_ty_set::ITySet, /// Map associating a type to each type constant id of this variable. /// Whenever we localize "T1::T" in a constraint, we add a fresh type variable /// indexed by "T" in the type_constants of the type variable representing T1. /// This allows to properly check constraints on "T1::T". pub type_constants: s_map::SMap<(PosId, Ty)>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum SolvingInfo { /// when the type variable is bound to a type TVIType(Ty), /// when the type variable is still unsolved TVIConstraints(TyvarConstraints), } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct TyvarInfo { /// Where was the type variable introduced? (e.g. generic method invocation, /// new object construction) pub tyvar_pos: pos::Pos, pub eager_solve_failed: bool, pub solving_info: SolvingInfo, } pub type Tvenv = i_map::IMap<TyvarInfo>; #[rust_to_ocaml(attr = "deriving eq")] pub type Identifier = isize; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct TypingInferenceEnv { pub tvenv: Tvenv, pub tyvars_stack: Vec<(pos::Pos, Vec<Identifier>)>, pub subtype_prop: t_l::SubtypeProp, pub tyvar_occurrences: typing_tyvar_occurrences::TypingTyvarOccurrences, }
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_kinding_defs.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<c06edcc010b7eee5192eeb56385bb099>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use typing_defs::*; pub use crate::typing_set as ty_set; #[allow(unused_imports)] use crate::*; pub type TparamBounds = ty_set::TySet; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Kind { pub lower_bounds: TparamBounds, pub upper_bounds: TparamBounds, pub reified: aast::ReifyKind, pub enforceable: bool, pub newable: bool, pub require_dynamic: bool, pub parameters: Vec<NamedKind>, } #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct NamedKind(pub PosId, pub Kind);
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_reason.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<17302596369fbcaef60c319d605205d2>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] pub type PosId = (pos_or_decl::PosOrDecl, ast_defs::Id_); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(u8)] pub enum ArgPosition { Aonly, Afirst, Asecond, } impl TrivialDrop for ArgPosition {} arena_deserializer::impl_deserialize_in_arena!(ArgPosition); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(C, u8)] pub enum ExprDepTypeReason { ERexpr(isize), ERstatic, ERclass(String), ERparent(String), ERself(String), ERpu(String), } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(u8)] pub enum BlameSource { BScall, BSlambda, BSassignment, #[rust_to_ocaml(name = "BSout_of_scope")] BSoutOfScope, } impl TrivialDrop for BlameSource {} arena_deserializer::impl_deserialize_in_arena!(BlameSource); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(C, u8)] pub enum Blame { Blame(pos::Pos, BlameSource), } /// The reason why something is expected to have a certain type #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving hash")] #[repr(C, u8)] pub enum T_ { Rnone, Rwitness(pos::Pos), #[rust_to_ocaml(name = "Rwitness_from_decl")] RwitnessFromDecl(pos_or_decl::PosOrDecl), /// Used as an index into a vector-like /// array or string. Position of indexing, /// reason for the indexed type Ridx(pos::Pos, Box<T_>), #[rust_to_ocaml(name = "Ridx_vector")] RidxVector(pos::Pos), /// Used as an index, in the Vector case #[rust_to_ocaml(name = "Ridx_vector_from_decl")] RidxVectorFromDecl(pos_or_decl::PosOrDecl), /// Because it is iterated in a foreach loop Rforeach(pos::Pos), /// Because it is iterated "await as" in foreach Rasyncforeach(pos::Pos), Rarith(pos::Pos), #[rust_to_ocaml(name = "Rarith_ret")] RarithRet(pos::Pos), /// pos, arg float typing reason, arg position #[rust_to_ocaml(name = "Rarith_ret_float")] RarithRetFloat(pos::Pos, Box<T_>, ArgPosition), /// pos, arg num typing reason, arg position #[rust_to_ocaml(name = "Rarith_ret_num")] RarithRetNum(pos::Pos, Box<T_>, ArgPosition), #[rust_to_ocaml(name = "Rarith_ret_int")] RarithRetInt(pos::Pos), #[rust_to_ocaml(name = "Rarith_dynamic")] RarithDynamic(pos::Pos), #[rust_to_ocaml(name = "Rbitwise_dynamic")] RbitwiseDynamic(pos::Pos), #[rust_to_ocaml(name = "Rincdec_dynamic")] RincdecDynamic(pos::Pos), Rcomp(pos::Pos), #[rust_to_ocaml(name = "Rconcat_ret")] RconcatRet(pos::Pos), #[rust_to_ocaml(name = "Rlogic_ret")] RlogicRet(pos::Pos), Rbitwise(pos::Pos), #[rust_to_ocaml(name = "Rbitwise_ret")] RbitwiseRet(pos::Pos), #[rust_to_ocaml(name = "Rno_return")] RnoReturn(pos::Pos), #[rust_to_ocaml(name = "Rno_return_async")] RnoReturnAsync(pos::Pos), #[rust_to_ocaml(name = "Rret_fun_kind")] RretFunKind(pos::Pos, ast_defs::FunKind), #[rust_to_ocaml(name = "Rret_fun_kind_from_decl")] RretFunKindFromDecl(pos_or_decl::PosOrDecl, ast_defs::FunKind), Rhint(pos_or_decl::PosOrDecl), Rthrow(pos::Pos), Rplaceholder(pos::Pos), #[rust_to_ocaml(name = "Rret_div")] RretDiv(pos::Pos), #[rust_to_ocaml(name = "Ryield_gen")] RyieldGen(pos::Pos), #[rust_to_ocaml(name = "Ryield_asyncgen")] RyieldAsyncgen(pos::Pos), #[rust_to_ocaml(name = "Ryield_asyncnull")] RyieldAsyncnull(pos::Pos), #[rust_to_ocaml(name = "Ryield_send")] RyieldSend(pos::Pos), #[rust_to_ocaml(name = "Rlost_info")] RlostInfo(String, Box<T_>, Blame), Rformat(pos::Pos, String, Box<T_>), #[rust_to_ocaml(name = "Rclass_class")] RclassClass(pos_or_decl::PosOrDecl, String), #[rust_to_ocaml(name = "Runknown_class")] RunknownClass(pos::Pos), #[rust_to_ocaml(name = "Rvar_param")] RvarParam(pos::Pos), #[rust_to_ocaml(name = "Rvar_param_from_decl")] RvarParamFromDecl(pos_or_decl::PosOrDecl), /// splat pos, fun def pos, number of args before splat #[rust_to_ocaml(name = "Runpack_param")] RunpackParam(pos::Pos, pos_or_decl::PosOrDecl, isize), #[rust_to_ocaml(name = "Rinout_param")] RinoutParam(pos_or_decl::PosOrDecl), Rinstantiate(Box<T_>, String, Box<T_>), Rtypeconst( Box<T_>, (pos_or_decl::PosOrDecl, String), lazy::Lazy<String>, Box<T_>, ), #[rust_to_ocaml(name = "Rtype_access")] RtypeAccess(Box<T_>, Vec<(Box<T_>, lazy::Lazy<String>)>), #[rust_to_ocaml(name = "Rexpr_dep_type")] RexprDepType(Box<T_>, pos_or_decl::PosOrDecl, ExprDepTypeReason), /// ?-> operator is used #[rust_to_ocaml(name = "Rnullsafe_op")] RnullsafeOp(pos::Pos), #[rust_to_ocaml(name = "Rtconst_no_cstr")] RtconstNoCstr(PosId), Rpredicated(pos::Pos, String), Ris(pos::Pos), Ras(pos::Pos), Requal(pos::Pos), #[rust_to_ocaml(name = "Rvarray_or_darray_key")] RvarrayOrDarrayKey(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rvec_or_dict_key")] RvecOrDictKey(pos_or_decl::PosOrDecl), Rusing(pos::Pos), #[rust_to_ocaml(name = "Rdynamic_prop")] RdynamicProp(pos::Pos), #[rust_to_ocaml(name = "Rdynamic_call")] RdynamicCall(pos::Pos), #[rust_to_ocaml(name = "Rdynamic_construct")] RdynamicConstruct(pos::Pos), #[rust_to_ocaml(name = "Ridx_dict")] RidxDict(pos::Pos), #[rust_to_ocaml(name = "Rset_element")] RsetElement(pos::Pos), #[rust_to_ocaml(name = "Rmissing_optional_field")] RmissingOptionalField(pos_or_decl::PosOrDecl, String), #[rust_to_ocaml(name = "Runset_field")] RunsetField(pos::Pos, String), #[rust_to_ocaml(name = "Rcontravariant_generic")] RcontravariantGeneric(Box<T_>, String), #[rust_to_ocaml(name = "Rinvariant_generic")] RinvariantGeneric(Box<T_>, String), Rregex(pos::Pos), #[rust_to_ocaml(name = "Rimplicit_upper_bound")] RimplicitUpperBound(pos_or_decl::PosOrDecl, String), #[rust_to_ocaml(name = "Rtype_variable")] RtypeVariable(pos::Pos), #[rust_to_ocaml(name = "Rtype_variable_generics")] RtypeVariableGenerics(pos::Pos, String, String), #[rust_to_ocaml(name = "Rtype_variable_error")] RtypeVariableError(pos::Pos), #[rust_to_ocaml(name = "Rglobal_type_variable_generics")] RglobalTypeVariableGenerics(pos_or_decl::PosOrDecl, String, String), #[rust_to_ocaml(name = "Rsolve_fail")] RsolveFail(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rcstr_on_generics")] RcstrOnGenerics(pos_or_decl::PosOrDecl, PosId), #[rust_to_ocaml(name = "Rlambda_param")] RlambdaParam(pos::Pos, Box<T_>), Rshape(pos::Pos, String), #[rust_to_ocaml(name = "Rshape_literal")] RshapeLiteral(pos::Pos), Renforceable(pos_or_decl::PosOrDecl), Rdestructure(pos::Pos), #[rust_to_ocaml(name = "Rkey_value_collection_key")] RkeyValueCollectionKey(pos::Pos), #[rust_to_ocaml(name = "Rglobal_class_prop")] RglobalClassProp(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rglobal_fun_param")] RglobalFunParam(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rglobal_fun_ret")] RglobalFunRet(pos_or_decl::PosOrDecl), Rsplice(pos::Pos), #[rust_to_ocaml(name = "Ret_boolean")] RetBoolean(pos::Pos), #[rust_to_ocaml(name = "Rdefault_capability")] RdefaultCapability(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rconcat_operand")] RconcatOperand(pos::Pos), #[rust_to_ocaml(name = "Rinterp_operand")] RinterpOperand(pos::Pos), #[rust_to_ocaml(name = "Rdynamic_coercion")] RdynamicCoercion(Box<T_>), #[rust_to_ocaml(name = "Rsupport_dynamic_type")] RsupportDynamicType(pos_or_decl::PosOrDecl), #[rust_to_ocaml(name = "Rdynamic_partial_enforcement")] RdynamicPartialEnforcement(pos_or_decl::PosOrDecl, String, Box<T_>), #[rust_to_ocaml(name = "Rrigid_tvar_escape")] RrigidTvarEscape(pos::Pos, String, String, Box<T_>), #[rust_to_ocaml(name = "Ropaque_type_from_module")] RopaqueTypeFromModule(pos_or_decl::PosOrDecl, String, Box<T_>), #[rust_to_ocaml(name = "Rmissing_class")] RmissingClass(pos::Pos), Rinvalid, } pub type Reason = T_; pub type DeclT = T_; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum Ureason { URnone, URassign, #[rust_to_ocaml(name = "URassign_inout")] URassignInout, URhint, URreturn, URforeach, URthrow, URvector, URkey(String), URvalue(String), URawait, URyield, /// Name of XHP class, Name of XHP attribute URxhp(String, String), #[rust_to_ocaml(name = "URxhp_spread")] URxhpSpread, URindex(String), URelement(String), URparam, #[rust_to_ocaml(name = "URparam_inout")] URparamInout, #[rust_to_ocaml(name = "URarray_value")] URarrayValue, #[rust_to_ocaml(name = "URpair_value")] URpairValue, #[rust_to_ocaml(name = "URtuple_access")] URtupleAccess, #[rust_to_ocaml(name = "URpair_access")] URpairAccess, #[rust_to_ocaml(name = "URnewtype_cstr")] URnewtypeCstr, #[rust_to_ocaml(name = "URclass_req")] URclassReq, URenum, #[rust_to_ocaml(name = "URenum_include")] URenumInclude, #[rust_to_ocaml(name = "URenum_cstr")] URenumCstr, #[rust_to_ocaml(name = "URenum_underlying")] URenumUnderlying, #[rust_to_ocaml(name = "URenum_incompatible_cstr")] URenumIncompatibleCstr, #[rust_to_ocaml(name = "URtypeconst_cstr")] URtypeconstCstr, #[rust_to_ocaml(name = "URsubsume_tconst_cstr")] URsubsumeTconstCstr, #[rust_to_ocaml(name = "URsubsume_tconst_assign")] URsubsumeTconstAssign, URclone, URusing, #[rust_to_ocaml(name = "URstr_concat")] URstrConcat, #[rust_to_ocaml(name = "URstr_interp")] URstrInterp, #[rust_to_ocaml(name = "URdynamic_prop")] URdynamicProp, }
Rust
hhvm/hphp/hack/src/oxidized/gen/typing_tyvar_occurrences.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<cb137456b0c8764f51c2e5436e795506>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct TypingTyvarOccurrences { /// A map to track where each type variable occurs, /// more precisely in the type of which other type variables. /// E.g. if #1 is bound to (#2 | int), then this map contains the entry /// #2 -> { #1 } /// This is based on shallow binding, i.e. in the example above, if #2 /// is mapped to #3, then tyvar_occurrences would be: /// #2 -> { #1 } /// #3 -> { #2 } /// but we would not record that #3 occurs in #1. /// When a type variable v gets solved or the type bound to it gets simplified, /// we simplify the unions and intersections of the types bound to the /// type variables associated to v in this map. /// So in our example, if #2 gets solved to int, /// we simplify #1 to (int | int) = int. /// There are only entries for variables that are unsolved or contain /// other unsolved type variables. Variables that are solved and contain /// no other unsolved type variables get removed from this map. pub tyvar_occurrences: i_map::IMap<i_set::ISet>, /// Mapping of type variables to the type variables contained in their /// types which are either unsolved or themselves contain unsolved type /// variables. /// This is the dual of tyvar_occurrences. pub tyvars_in_tyvar: i_map::IMap<i_set::ISet>, }
Rust
hhvm/hphp/hack/src/oxidized/gen/user_error.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<dd596b63609e073e5d38abaed07cc27d>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRep, Hash, NoPosHash, PartialEq, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C)] pub struct UserError<PrimPos, Pos> { pub code: isize, pub claim: message::Message<PrimPos>, pub reasons: Vec<message::Message<Pos>>, pub quickfixes: Vec<quickfix::Quickfix<PrimPos>>, pub custom_msgs: Vec<String>, pub is_fixmed: bool, }