language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
Rust
hhvm/hphp/hack/src/oxidized/gen/validation_err.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<<6d78fc7af173c27b4cd4828dceee756a>> // // 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 (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum ValidationErr { Mismatch( patt_binding_ty::PattBindingTy, patt_binding_ty::PattBindingTy, ), Shadowed(patt_var::PattVar), Unbound(patt_var::PattVar), }
Rust
hhvm/hphp/hack/src/oxidized/gen/xhp_attribute.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<<45ff6a9e54c4b8cfe74bfbccd0f4b2eb>> // // 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 Tag { Required, LateInit, } impl TrivialDrop for Tag {} arena_deserializer::impl_deserialize_in_arena!(Tag); #[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 }))")] #[rust_to_ocaml(prefix = "xa_")] #[repr(C)] pub struct XhpAttribute { pub tag: Option<Tag>, pub has_default: bool, }
Rust
hhvm/hphp/hack/src/oxidized/impl_gen/aast_defs_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<<882cd6bc03356d847900c351f3bfe650>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use crate::aast_defs::*; use crate::ast_defs; use crate::LocalIdMap; impl<Ex, En> Stmt_<Ex, En> { pub fn mk_fallthrough() -> Self { Stmt_::Fallthrough } pub fn mk_expr(p0: Expr<Ex, En>) -> Self { Stmt_::Expr(Box::new(p0)) } pub fn mk_break() -> Self { Stmt_::Break } pub fn mk_continue() -> Self { Stmt_::Continue } pub fn mk_throw(p0: Expr<Ex, En>) -> Self { Stmt_::Throw(Box::new(p0)) } pub fn mk_return(p0: Option<Expr<Ex, En>>) -> Self { Stmt_::Return(Box::new(p0)) } pub fn mk_yield_break() -> Self { Stmt_::YieldBreak } pub fn mk_awaitall(p0: Vec<(Option<Lid>, Expr<Ex, En>)>, p1: Block<Ex, En>) -> Self { Stmt_::Awaitall(Box::new((p0, p1))) } pub fn mk_if(p0: Expr<Ex, En>, p1: Block<Ex, En>, p2: Block<Ex, En>) -> Self { Stmt_::If(Box::new((p0, p1, p2))) } pub fn mk_do(p0: Block<Ex, En>, p1: Expr<Ex, En>) -> Self { Stmt_::Do(Box::new((p0, p1))) } pub fn mk_while(p0: Expr<Ex, En>, p1: Block<Ex, En>) -> Self { Stmt_::While(Box::new((p0, p1))) } pub fn mk_using(p0: UsingStmt<Ex, En>) -> Self { Stmt_::Using(Box::new(p0)) } pub fn mk_for( p0: Vec<Expr<Ex, En>>, p1: Option<Expr<Ex, En>>, p2: Vec<Expr<Ex, En>>, p3: Block<Ex, En>, ) -> Self { Stmt_::For(Box::new((p0, p1, p2, p3))) } pub fn mk_switch( p0: Expr<Ex, En>, p1: Vec<Case<Ex, En>>, p2: Option<DefaultCase<Ex, En>>, ) -> Self { Stmt_::Switch(Box::new((p0, p1, p2))) } pub fn mk_match(p0: StmtMatch<Ex, En>) -> Self { Stmt_::Match(Box::new(p0)) } pub fn mk_foreach(p0: Expr<Ex, En>, p1: AsExpr<Ex, En>, p2: Block<Ex, En>) -> Self { Stmt_::Foreach(Box::new((p0, p1, p2))) } pub fn mk_try(p0: Block<Ex, En>, p1: Vec<Catch<Ex, En>>, p2: FinallyBlock<Ex, En>) -> Self { Stmt_::Try(Box::new((p0, p1, p2))) } pub fn mk_noop() -> Self { Stmt_::Noop } pub fn mk_declare_local(p0: Lid, p1: Hint, p2: Option<Expr<Ex, En>>) -> Self { Stmt_::DeclareLocal(Box::new((p0, p1, p2))) } pub fn mk_block(p0: Block<Ex, En>) -> Self { Stmt_::Block(p0) } pub fn mk_markup(p0: Pstring) -> Self { Stmt_::Markup(Box::new(p0)) } pub fn mk_assert_env(p0: EnvAnnot, p1: LocalIdMap<(Pos, Ex)>) -> Self { Stmt_::AssertEnv(Box::new((p0, p1))) } pub fn is_fallthrough(&self) -> bool { match self { Stmt_::Fallthrough => true, _ => false, } } pub fn is_expr(&self) -> bool { match self { Stmt_::Expr(..) => true, _ => false, } } pub fn is_break(&self) -> bool { match self { Stmt_::Break => true, _ => false, } } pub fn is_continue(&self) -> bool { match self { Stmt_::Continue => true, _ => false, } } pub fn is_throw(&self) -> bool { match self { Stmt_::Throw(..) => true, _ => false, } } pub fn is_return(&self) -> bool { match self { Stmt_::Return(..) => true, _ => false, } } pub fn is_yield_break(&self) -> bool { match self { Stmt_::YieldBreak => true, _ => false, } } pub fn is_awaitall(&self) -> bool { match self { Stmt_::Awaitall(..) => true, _ => false, } } pub fn is_if(&self) -> bool { match self { Stmt_::If(..) => true, _ => false, } } pub fn is_do(&self) -> bool { match self { Stmt_::Do(..) => true, _ => false, } } pub fn is_while(&self) -> bool { match self { Stmt_::While(..) => true, _ => false, } } pub fn is_using(&self) -> bool { match self { Stmt_::Using(..) => true, _ => false, } } pub fn is_for(&self) -> bool { match self { Stmt_::For(..) => true, _ => false, } } pub fn is_switch(&self) -> bool { match self { Stmt_::Switch(..) => true, _ => false, } } pub fn is_match(&self) -> bool { match self { Stmt_::Match(..) => true, _ => false, } } pub fn is_foreach(&self) -> bool { match self { Stmt_::Foreach(..) => true, _ => false, } } pub fn is_try(&self) -> bool { match self { Stmt_::Try(..) => true, _ => false, } } pub fn is_noop(&self) -> bool { match self { Stmt_::Noop => true, _ => false, } } pub fn is_declare_local(&self) -> bool { match self { Stmt_::DeclareLocal(..) => true, _ => false, } } pub fn is_block(&self) -> bool { match self { Stmt_::Block(..) => true, _ => false, } } pub fn is_markup(&self) -> bool { match self { Stmt_::Markup(..) => true, _ => false, } } pub fn is_assert_env(&self) -> bool { match self { Stmt_::AssertEnv(..) => true, _ => false, } } pub fn as_expr(&self) -> Option<&Expr<Ex, En>> { match self { Stmt_::Expr(p0) => Some(&p0), _ => None, } } pub fn as_throw(&self) -> Option<&Expr<Ex, En>> { match self { Stmt_::Throw(p0) => Some(&p0), _ => None, } } pub fn as_return(&self) -> Option<&Option<Expr<Ex, En>>> { match self { Stmt_::Return(p0) => Some(&p0), _ => None, } } pub fn as_awaitall(&self) -> Option<(&Vec<(Option<Lid>, Expr<Ex, En>)>, &Block<Ex, En>)> { match self { Stmt_::Awaitall(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_if(&self) -> Option<(&Expr<Ex, En>, &Block<Ex, En>, &Block<Ex, En>)> { match self { Stmt_::If(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_do(&self) -> Option<(&Block<Ex, En>, &Expr<Ex, En>)> { match self { Stmt_::Do(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_while(&self) -> Option<(&Expr<Ex, En>, &Block<Ex, En>)> { match self { Stmt_::While(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_using(&self) -> Option<&UsingStmt<Ex, En>> { match self { Stmt_::Using(p0) => Some(&p0), _ => None, } } pub fn as_for( &self, ) -> Option<( &Vec<Expr<Ex, En>>, &Option<Expr<Ex, En>>, &Vec<Expr<Ex, En>>, &Block<Ex, En>, )> { match self { Stmt_::For(p0) => Some((&p0.0, &p0.1, &p0.2, &p0.3)), _ => None, } } pub fn as_switch( &self, ) -> Option<( &Expr<Ex, En>, &Vec<Case<Ex, En>>, &Option<DefaultCase<Ex, En>>, )> { match self { Stmt_::Switch(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_match(&self) -> Option<&StmtMatch<Ex, En>> { match self { Stmt_::Match(p0) => Some(&p0), _ => None, } } pub fn as_foreach(&self) -> Option<(&Expr<Ex, En>, &AsExpr<Ex, En>, &Block<Ex, En>)> { match self { Stmt_::Foreach(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_try(&self) -> Option<(&Block<Ex, En>, &Vec<Catch<Ex, En>>, &FinallyBlock<Ex, En>)> { match self { Stmt_::Try(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_declare_local(&self) -> Option<(&Lid, &Hint, &Option<Expr<Ex, En>>)> { match self { Stmt_::DeclareLocal(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_block(&self) -> Option<&Block<Ex, En>> { match self { Stmt_::Block(p0) => Some(p0), _ => None, } } pub fn as_markup(&self) -> Option<&Pstring> { match self { Stmt_::Markup(p0) => Some(&p0), _ => None, } } pub fn as_assert_env(&self) -> Option<(&EnvAnnot, &LocalIdMap<(Pos, Ex)>)> { match self { Stmt_::AssertEnv(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_expr_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Stmt_::Expr(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_throw_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Stmt_::Throw(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_return_mut(&mut self) -> Option<&mut Option<Expr<Ex, En>>> { match self { Stmt_::Return(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_awaitall_mut( &mut self, ) -> Option<(&mut Vec<(Option<Lid>, Expr<Ex, En>)>, &mut Block<Ex, En>)> { match self { Stmt_::Awaitall(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_if_mut( &mut self, ) -> Option<(&mut Expr<Ex, En>, &mut Block<Ex, En>, &mut Block<Ex, En>)> { match self { Stmt_::If(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_do_mut(&mut self) -> Option<(&mut Block<Ex, En>, &mut Expr<Ex, En>)> { match self { Stmt_::Do(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_while_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Block<Ex, En>)> { match self { Stmt_::While(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_using_mut(&mut self) -> Option<&mut UsingStmt<Ex, En>> { match self { Stmt_::Using(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_for_mut( &mut self, ) -> Option<( &mut Vec<Expr<Ex, En>>, &mut Option<Expr<Ex, En>>, &mut Vec<Expr<Ex, En>>, &mut Block<Ex, En>, )> { match self { Stmt_::For(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2, &mut p0.3)), _ => None, } } pub fn as_switch_mut( &mut self, ) -> Option<( &mut Expr<Ex, En>, &mut Vec<Case<Ex, En>>, &mut Option<DefaultCase<Ex, En>>, )> { match self { Stmt_::Switch(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_match_mut(&mut self) -> Option<&mut StmtMatch<Ex, En>> { match self { Stmt_::Match(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_foreach_mut( &mut self, ) -> Option<(&mut Expr<Ex, En>, &mut AsExpr<Ex, En>, &mut Block<Ex, En>)> { match self { Stmt_::Foreach(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_try_mut( &mut self, ) -> Option<( &mut Block<Ex, En>, &mut Vec<Catch<Ex, En>>, &mut FinallyBlock<Ex, En>, )> { match self { Stmt_::Try(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_declare_local_mut( &mut self, ) -> Option<(&mut Lid, &mut Hint, &mut Option<Expr<Ex, En>>)> { match self { Stmt_::DeclareLocal(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_block_mut(&mut self) -> Option<&mut Block<Ex, En>> { match self { Stmt_::Block(p0) => Some(p0), _ => None, } } pub fn as_markup_mut(&mut self) -> Option<&mut Pstring> { match self { Stmt_::Markup(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_assert_env_mut(&mut self) -> Option<(&mut EnvAnnot, &mut LocalIdMap<(Pos, Ex)>)> { match self { Stmt_::AssertEnv(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_expr_into(self) -> Option<Expr<Ex, En>> { match self { Stmt_::Expr(p0) => Some(*p0), _ => None, } } pub fn as_throw_into(self) -> Option<Expr<Ex, En>> { match self { Stmt_::Throw(p0) => Some(*p0), _ => None, } } pub fn as_return_into(self) -> Option<Option<Expr<Ex, En>>> { match self { Stmt_::Return(p0) => Some(*p0), _ => None, } } pub fn as_awaitall_into(self) -> Option<(Vec<(Option<Lid>, Expr<Ex, En>)>, Block<Ex, En>)> { match self { Stmt_::Awaitall(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_if_into(self) -> Option<(Expr<Ex, En>, Block<Ex, En>, Block<Ex, En>)> { match self { Stmt_::If(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_do_into(self) -> Option<(Block<Ex, En>, Expr<Ex, En>)> { match self { Stmt_::Do(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_while_into(self) -> Option<(Expr<Ex, En>, Block<Ex, En>)> { match self { Stmt_::While(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_using_into(self) -> Option<UsingStmt<Ex, En>> { match self { Stmt_::Using(p0) => Some(*p0), _ => None, } } pub fn as_for_into( self, ) -> Option<( Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Vec<Expr<Ex, En>>, Block<Ex, En>, )> { match self { Stmt_::For(p0) => Some(((*p0).0, (*p0).1, (*p0).2, (*p0).3)), _ => None, } } pub fn as_switch_into( self, ) -> Option<(Expr<Ex, En>, Vec<Case<Ex, En>>, Option<DefaultCase<Ex, En>>)> { match self { Stmt_::Switch(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_match_into(self) -> Option<StmtMatch<Ex, En>> { match self { Stmt_::Match(p0) => Some(*p0), _ => None, } } pub fn as_foreach_into(self) -> Option<(Expr<Ex, En>, AsExpr<Ex, En>, Block<Ex, En>)> { match self { Stmt_::Foreach(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_try_into(self) -> Option<(Block<Ex, En>, Vec<Catch<Ex, En>>, FinallyBlock<Ex, En>)> { match self { Stmt_::Try(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_declare_local_into(self) -> Option<(Lid, Hint, Option<Expr<Ex, En>>)> { match self { Stmt_::DeclareLocal(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_block_into(self) -> Option<Block<Ex, En>> { match self { Stmt_::Block(p0) => Some(p0), _ => None, } } pub fn as_markup_into(self) -> Option<Pstring> { match self { Stmt_::Markup(p0) => Some(*p0), _ => None, } } pub fn as_assert_env_into(self) -> Option<(EnvAnnot, LocalIdMap<(Pos, Ex)>)> { match self { Stmt_::AssertEnv(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } } impl EnvAnnot { pub fn mk_join() -> Self { EnvAnnot::Join } pub fn mk_refinement() -> Self { EnvAnnot::Refinement } pub fn is_join(&self) -> bool { match self { EnvAnnot::Join => true, _ => false, } } pub fn is_refinement(&self) -> bool { match self { EnvAnnot::Refinement => true, _ => false, } } } impl<Ex, En> AsExpr<Ex, En> { pub fn mk_as_v(p0: Expr<Ex, En>) -> Self { AsExpr::AsV(p0) } pub fn mk_as_kv(p0: Expr<Ex, En>, p1: Expr<Ex, En>) -> Self { AsExpr::AsKv(p0, p1) } pub fn mk_await_as_v(p0: Pos, p1: Expr<Ex, En>) -> Self { AsExpr::AwaitAsV(p0, p1) } pub fn mk_await_as_kv(p0: Pos, p1: Expr<Ex, En>, p2: Expr<Ex, En>) -> Self { AsExpr::AwaitAsKv(p0, p1, p2) } pub fn is_as_v(&self) -> bool { match self { AsExpr::AsV(..) => true, _ => false, } } pub fn is_as_kv(&self) -> bool { match self { AsExpr::AsKv(..) => true, _ => false, } } pub fn is_await_as_v(&self) -> bool { match self { AsExpr::AwaitAsV(..) => true, _ => false, } } pub fn is_await_as_kv(&self) -> bool { match self { AsExpr::AwaitAsKv(..) => true, _ => false, } } pub fn as_as_v(&self) -> Option<&Expr<Ex, En>> { match self { AsExpr::AsV(p0) => Some(p0), _ => None, } } pub fn as_as_kv(&self) -> Option<(&Expr<Ex, En>, &Expr<Ex, En>)> { match self { AsExpr::AsKv(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_v(&self) -> Option<(&Pos, &Expr<Ex, En>)> { match self { AsExpr::AwaitAsV(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_kv(&self) -> Option<(&Pos, &Expr<Ex, En>, &Expr<Ex, En>)> { match self { AsExpr::AwaitAsKv(p0, p1, p2) => Some((p0, p1, p2)), _ => None, } } pub fn as_as_v_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { AsExpr::AsV(p0) => Some(p0), _ => None, } } pub fn as_as_kv_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Expr<Ex, En>)> { match self { AsExpr::AsKv(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_v_mut(&mut self) -> Option<(&mut Pos, &mut Expr<Ex, En>)> { match self { AsExpr::AwaitAsV(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_kv_mut( &mut self, ) -> Option<(&mut Pos, &mut Expr<Ex, En>, &mut Expr<Ex, En>)> { match self { AsExpr::AwaitAsKv(p0, p1, p2) => Some((p0, p1, p2)), _ => None, } } pub fn as_as_v_into(self) -> Option<Expr<Ex, En>> { match self { AsExpr::AsV(p0) => Some(p0), _ => None, } } pub fn as_as_kv_into(self) -> Option<(Expr<Ex, En>, Expr<Ex, En>)> { match self { AsExpr::AsKv(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_v_into(self) -> Option<(Pos, Expr<Ex, En>)> { match self { AsExpr::AwaitAsV(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_await_as_kv_into(self) -> Option<(Pos, Expr<Ex, En>, Expr<Ex, En>)> { match self { AsExpr::AwaitAsKv(p0, p1, p2) => Some((p0, p1, p2)), _ => None, } } } impl Pattern { pub fn mk_pvar(p0: PatVar) -> Self { Pattern::PVar(Box::new(p0)) } pub fn mk_prefinement(p0: PatRefinement) -> Self { Pattern::PRefinement(Box::new(p0)) } pub fn is_pvar(&self) -> bool { match self { Pattern::PVar(..) => true, _ => false, } } pub fn is_prefinement(&self) -> bool { match self { Pattern::PRefinement(..) => true, _ => false, } } pub fn as_pvar(&self) -> Option<&PatVar> { match self { Pattern::PVar(p0) => Some(&p0), _ => None, } } pub fn as_prefinement(&self) -> Option<&PatRefinement> { match self { Pattern::PRefinement(p0) => Some(&p0), _ => None, } } pub fn as_pvar_mut(&mut self) -> Option<&mut PatVar> { match self { Pattern::PVar(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_prefinement_mut(&mut self) -> Option<&mut PatRefinement> { match self { Pattern::PRefinement(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_pvar_into(self) -> Option<PatVar> { match self { Pattern::PVar(p0) => Some(*p0), _ => None, } } pub fn as_prefinement_into(self) -> Option<PatRefinement> { match self { Pattern::PRefinement(p0) => Some(*p0), _ => None, } } } impl<Ex, En> ClassId_<Ex, En> { pub fn mk_ciparent() -> Self { ClassId_::CIparent } pub fn mk_ciself() -> Self { ClassId_::CIself } pub fn mk_cistatic() -> Self { ClassId_::CIstatic } pub fn mk_ciexpr(p0: Expr<Ex, En>) -> Self { ClassId_::CIexpr(p0) } pub fn mk_ci(p0: ClassName) -> Self { ClassId_::CI(p0) } pub fn is_ciparent(&self) -> bool { match self { ClassId_::CIparent => true, _ => false, } } pub fn is_ciself(&self) -> bool { match self { ClassId_::CIself => true, _ => false, } } pub fn is_cistatic(&self) -> bool { match self { ClassId_::CIstatic => true, _ => false, } } pub fn is_ciexpr(&self) -> bool { match self { ClassId_::CIexpr(..) => true, _ => false, } } pub fn is_ci(&self) -> bool { match self { ClassId_::CI(..) => true, _ => false, } } pub fn as_ciexpr(&self) -> Option<&Expr<Ex, En>> { match self { ClassId_::CIexpr(p0) => Some(p0), _ => None, } } pub fn as_ci(&self) -> Option<&ClassName> { match self { ClassId_::CI(p0) => Some(p0), _ => None, } } pub fn as_ciexpr_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { ClassId_::CIexpr(p0) => Some(p0), _ => None, } } pub fn as_ci_mut(&mut self) -> Option<&mut ClassName> { match self { ClassId_::CI(p0) => Some(p0), _ => None, } } pub fn as_ciexpr_into(self) -> Option<Expr<Ex, En>> { match self { ClassId_::CIexpr(p0) => Some(p0), _ => None, } } pub fn as_ci_into(self) -> Option<ClassName> { match self { ClassId_::CI(p0) => Some(p0), _ => None, } } } impl<Ex> CollectionTarg<Ex> { pub fn mk_collectiontv(p0: Targ<Ex>) -> Self { CollectionTarg::CollectionTV(p0) } pub fn mk_collectiontkv(p0: Targ<Ex>, p1: Targ<Ex>) -> Self { CollectionTarg::CollectionTKV(p0, p1) } pub fn is_collectiontv(&self) -> bool { match self { CollectionTarg::CollectionTV(..) => true, _ => false, } } pub fn is_collectiontkv(&self) -> bool { match self { CollectionTarg::CollectionTKV(..) => true, _ => false, } } pub fn as_collectiontv(&self) -> Option<&Targ<Ex>> { match self { CollectionTarg::CollectionTV(p0) => Some(p0), _ => None, } } pub fn as_collectiontkv(&self) -> Option<(&Targ<Ex>, &Targ<Ex>)> { match self { CollectionTarg::CollectionTKV(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_collectiontv_mut(&mut self) -> Option<&mut Targ<Ex>> { match self { CollectionTarg::CollectionTV(p0) => Some(p0), _ => None, } } pub fn as_collectiontkv_mut(&mut self) -> Option<(&mut Targ<Ex>, &mut Targ<Ex>)> { match self { CollectionTarg::CollectionTKV(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_collectiontv_into(self) -> Option<Targ<Ex>> { match self { CollectionTarg::CollectionTV(p0) => Some(p0), _ => None, } } pub fn as_collectiontkv_into(self) -> Option<(Targ<Ex>, Targ<Ex>)> { match self { CollectionTarg::CollectionTKV(p0, p1) => Some((p0, p1)), _ => None, } } } impl<Ex, En> FunctionPtrId<Ex, En> { pub fn mk_fpid(p0: Sid) -> Self { FunctionPtrId::FPId(p0) } pub fn mk_fpclass_const(p0: ClassId<Ex, En>, p1: Pstring) -> Self { FunctionPtrId::FPClassConst(p0, p1) } pub fn is_fpid(&self) -> bool { match self { FunctionPtrId::FPId(..) => true, _ => false, } } pub fn is_fpclass_const(&self) -> bool { match self { FunctionPtrId::FPClassConst(..) => true, _ => false, } } pub fn as_fpid(&self) -> Option<&Sid> { match self { FunctionPtrId::FPId(p0) => Some(p0), _ => None, } } pub fn as_fpclass_const(&self) -> Option<(&ClassId<Ex, En>, &Pstring)> { match self { FunctionPtrId::FPClassConst(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_fpid_mut(&mut self) -> Option<&mut Sid> { match self { FunctionPtrId::FPId(p0) => Some(p0), _ => None, } } pub fn as_fpclass_const_mut(&mut self) -> Option<(&mut ClassId<Ex, En>, &mut Pstring)> { match self { FunctionPtrId::FPClassConst(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_fpid_into(self) -> Option<Sid> { match self { FunctionPtrId::FPId(p0) => Some(p0), _ => None, } } pub fn as_fpclass_const_into(self) -> Option<(ClassId<Ex, En>, Pstring)> { match self { FunctionPtrId::FPClassConst(p0, p1) => Some((p0, p1)), _ => None, } } } impl<Ex, En> Expr_<Ex, En> { pub fn mk_darray( p0: Option<(Targ<Ex>, Targ<Ex>)>, p1: Vec<(Expr<Ex, En>, Expr<Ex, En>)>, ) -> Self { Expr_::Darray(Box::new((p0, p1))) } pub fn mk_varray(p0: Option<Targ<Ex>>, p1: Vec<Expr<Ex, En>>) -> Self { Expr_::Varray(Box::new((p0, p1))) } pub fn mk_shape(p0: Vec<(ast_defs::ShapeFieldName, Expr<Ex, En>)>) -> Self { Expr_::Shape(p0) } pub fn mk_val_collection( p0: (Pos, VcKind), p1: Option<Targ<Ex>>, p2: Vec<Expr<Ex, En>>, ) -> Self { Expr_::ValCollection(Box::new((p0, p1, p2))) } pub fn mk_key_val_collection( p0: (Pos, KvcKind), p1: Option<(Targ<Ex>, Targ<Ex>)>, p2: Vec<Field<Ex, En>>, ) -> Self { Expr_::KeyValCollection(Box::new((p0, p1, p2))) } pub fn mk_null() -> Self { Expr_::Null } pub fn mk_this() -> Self { Expr_::This } pub fn mk_true() -> Self { Expr_::True } pub fn mk_false() -> Self { Expr_::False } pub fn mk_omitted() -> Self { Expr_::Omitted } pub fn mk_invalid(p0: Option<Expr<Ex, En>>) -> Self { Expr_::Invalid(Box::new(p0)) } pub fn mk_id(p0: Sid) -> Self { Expr_::Id(Box::new(p0)) } pub fn mk_lvar(p0: Lid) -> Self { Expr_::Lvar(Box::new(p0)) } pub fn mk_dollardollar(p0: Lid) -> Self { Expr_::Dollardollar(Box::new(p0)) } pub fn mk_clone(p0: Expr<Ex, En>) -> Self { Expr_::Clone(Box::new(p0)) } pub fn mk_array_get(p0: Expr<Ex, En>, p1: Option<Expr<Ex, En>>) -> Self { Expr_::ArrayGet(Box::new((p0, p1))) } pub fn mk_obj_get( p0: Expr<Ex, En>, p1: Expr<Ex, En>, p2: OgNullFlavor, p3: PropOrMethod, ) -> Self { Expr_::ObjGet(Box::new((p0, p1, p2, p3))) } pub fn mk_class_get(p0: ClassId<Ex, En>, p1: ClassGetExpr<Ex, En>, p2: PropOrMethod) -> Self { Expr_::ClassGet(Box::new((p0, p1, p2))) } pub fn mk_class_const(p0: ClassId<Ex, En>, p1: Pstring) -> Self { Expr_::ClassConst(Box::new((p0, p1))) } pub fn mk_call(p0: CallExpr<Ex, En>) -> Self { Expr_::Call(Box::new(p0)) } pub fn mk_function_pointer(p0: FunctionPtrId<Ex, En>, p1: Vec<Targ<Ex>>) -> Self { Expr_::FunctionPointer(Box::new((p0, p1))) } pub fn mk_int(p0: String) -> Self { Expr_::Int(p0) } pub fn mk_float(p0: String) -> Self { Expr_::Float(p0) } pub fn mk_string(p0: bstr::BString) -> Self { Expr_::String(p0) } pub fn mk_string2(p0: Vec<Expr<Ex, En>>) -> Self { Expr_::String2(p0) } pub fn mk_prefixed_string(p0: String, p1: Expr<Ex, En>) -> Self { Expr_::PrefixedString(Box::new((p0, p1))) } pub fn mk_yield(p0: Afield<Ex, En>) -> Self { Expr_::Yield(Box::new(p0)) } pub fn mk_await(p0: Expr<Ex, En>) -> Self { Expr_::Await(Box::new(p0)) } pub fn mk_readonly_expr(p0: Expr<Ex, En>) -> Self { Expr_::ReadonlyExpr(Box::new(p0)) } pub fn mk_tuple(p0: Vec<Expr<Ex, En>>) -> Self { Expr_::Tuple(p0) } pub fn mk_list(p0: Vec<Expr<Ex, En>>) -> Self { Expr_::List(p0) } pub fn mk_cast(p0: Hint, p1: Expr<Ex, En>) -> Self { Expr_::Cast(Box::new((p0, p1))) } pub fn mk_unop(p0: ast_defs::Uop, p1: Expr<Ex, En>) -> Self { Expr_::Unop(Box::new((p0, p1))) } pub fn mk_binop(p0: Binop<Ex, En>) -> Self { Expr_::Binop(Box::new(p0)) } pub fn mk_pipe(p0: Lid, p1: Expr<Ex, En>, p2: Expr<Ex, En>) -> Self { Expr_::Pipe(Box::new((p0, p1, p2))) } pub fn mk_eif(p0: Expr<Ex, En>, p1: Option<Expr<Ex, En>>, p2: Expr<Ex, En>) -> Self { Expr_::Eif(Box::new((p0, p1, p2))) } pub fn mk_is(p0: Expr<Ex, En>, p1: Hint) -> Self { Expr_::Is(Box::new((p0, p1))) } pub fn mk_as(p0: Expr<Ex, En>, p1: Hint, p2: bool) -> Self { Expr_::As(Box::new((p0, p1, p2))) } pub fn mk_upcast(p0: Expr<Ex, En>, p1: Hint) -> Self { Expr_::Upcast(Box::new((p0, p1))) } pub fn mk_new( p0: ClassId<Ex, En>, p1: Vec<Targ<Ex>>, p2: Vec<Expr<Ex, En>>, p3: Option<Expr<Ex, En>>, p4: Ex, ) -> Self { Expr_::New(Box::new((p0, p1, p2, p3, p4))) } pub fn mk_efun(p0: Efun<Ex, En>) -> Self { Expr_::Efun(Box::new(p0)) } pub fn mk_lfun(p0: Fun_<Ex, En>, p1: Vec<CaptureLid<Ex>>) -> Self { Expr_::Lfun(Box::new((p0, p1))) } pub fn mk_xml(p0: ClassName, p1: Vec<XhpAttribute<Ex, En>>, p2: Vec<Expr<Ex, En>>) -> Self { Expr_::Xml(Box::new((p0, p1, p2))) } pub fn mk_import(p0: ImportFlavor, p1: Expr<Ex, En>) -> Self { Expr_::Import(Box::new((p0, p1))) } pub fn mk_collection( p0: ClassName, p1: Option<CollectionTarg<Ex>>, p2: Vec<Afield<Ex, En>>, ) -> Self { Expr_::Collection(Box::new((p0, p1, p2))) } pub fn mk_expression_tree(p0: ExpressionTree<Ex, En>) -> Self { Expr_::ExpressionTree(Box::new(p0)) } pub fn mk_lplaceholder(p0: Pos) -> Self { Expr_::Lplaceholder(Box::new(p0)) } pub fn mk_method_caller(p0: ClassName, p1: Pstring) -> Self { Expr_::MethodCaller(Box::new((p0, p1))) } pub fn mk_pair(p0: Option<(Targ<Ex>, Targ<Ex>)>, p1: Expr<Ex, En>, p2: Expr<Ex, En>) -> Self { Expr_::Pair(Box::new((p0, p1, p2))) } pub fn mk_etsplice(p0: Expr<Ex, En>) -> Self { Expr_::ETSplice(Box::new(p0)) } pub fn mk_enum_class_label(p0: Option<ClassName>, p1: String) -> Self { Expr_::EnumClassLabel(Box::new((p0, p1))) } pub fn mk_hole(p0: Expr<Ex, En>, p1: Ex, p2: Ex, p3: HoleSource) -> Self { Expr_::Hole(Box::new((p0, p1, p2, p3))) } pub fn mk_package(p0: Sid) -> Self { Expr_::Package(Box::new(p0)) } pub fn is_darray(&self) -> bool { match self { Expr_::Darray(..) => true, _ => false, } } pub fn is_varray(&self) -> bool { match self { Expr_::Varray(..) => true, _ => false, } } pub fn is_shape(&self) -> bool { match self { Expr_::Shape(..) => true, _ => false, } } pub fn is_val_collection(&self) -> bool { match self { Expr_::ValCollection(..) => true, _ => false, } } pub fn is_key_val_collection(&self) -> bool { match self { Expr_::KeyValCollection(..) => true, _ => false, } } pub fn is_null(&self) -> bool { match self { Expr_::Null => true, _ => false, } } pub fn is_this(&self) -> bool { match self { Expr_::This => true, _ => false, } } pub fn is_true(&self) -> bool { match self { Expr_::True => true, _ => false, } } pub fn is_false(&self) -> bool { match self { Expr_::False => true, _ => false, } } pub fn is_omitted(&self) -> bool { match self { Expr_::Omitted => true, _ => false, } } pub fn is_invalid(&self) -> bool { match self { Expr_::Invalid(..) => true, _ => false, } } pub fn is_id(&self) -> bool { match self { Expr_::Id(..) => true, _ => false, } } pub fn is_lvar(&self) -> bool { match self { Expr_::Lvar(..) => true, _ => false, } } pub fn is_dollardollar(&self) -> bool { match self { Expr_::Dollardollar(..) => true, _ => false, } } pub fn is_clone(&self) -> bool { match self { Expr_::Clone(..) => true, _ => false, } } pub fn is_array_get(&self) -> bool { match self { Expr_::ArrayGet(..) => true, _ => false, } } pub fn is_obj_get(&self) -> bool { match self { Expr_::ObjGet(..) => true, _ => false, } } pub fn is_class_get(&self) -> bool { match self { Expr_::ClassGet(..) => true, _ => false, } } pub fn is_class_const(&self) -> bool { match self { Expr_::ClassConst(..) => true, _ => false, } } pub fn is_call(&self) -> bool { match self { Expr_::Call(..) => true, _ => false, } } pub fn is_function_pointer(&self) -> bool { match self { Expr_::FunctionPointer(..) => true, _ => false, } } pub fn is_int(&self) -> bool { match self { Expr_::Int(..) => true, _ => false, } } pub fn is_float(&self) -> bool { match self { Expr_::Float(..) => true, _ => false, } } pub fn is_string(&self) -> bool { match self { Expr_::String(..) => true, _ => false, } } pub fn is_string2(&self) -> bool { match self { Expr_::String2(..) => true, _ => false, } } pub fn is_prefixed_string(&self) -> bool { match self { Expr_::PrefixedString(..) => true, _ => false, } } pub fn is_yield(&self) -> bool { match self { Expr_::Yield(..) => true, _ => false, } } pub fn is_await(&self) -> bool { match self { Expr_::Await(..) => true, _ => false, } } pub fn is_readonly_expr(&self) -> bool { match self { Expr_::ReadonlyExpr(..) => true, _ => false, } } pub fn is_tuple(&self) -> bool { match self { Expr_::Tuple(..) => true, _ => false, } } pub fn is_list(&self) -> bool { match self { Expr_::List(..) => true, _ => false, } } pub fn is_cast(&self) -> bool { match self { Expr_::Cast(..) => true, _ => false, } } pub fn is_unop(&self) -> bool { match self { Expr_::Unop(..) => true, _ => false, } } pub fn is_binop(&self) -> bool { match self { Expr_::Binop(..) => true, _ => false, } } pub fn is_pipe(&self) -> bool { match self { Expr_::Pipe(..) => true, _ => false, } } pub fn is_eif(&self) -> bool { match self { Expr_::Eif(..) => true, _ => false, } } pub fn is_is(&self) -> bool { match self { Expr_::Is(..) => true, _ => false, } } pub fn is_as(&self) -> bool { match self { Expr_::As(..) => true, _ => false, } } pub fn is_upcast(&self) -> bool { match self { Expr_::Upcast(..) => true, _ => false, } } pub fn is_new(&self) -> bool { match self { Expr_::New(..) => true, _ => false, } } pub fn is_efun(&self) -> bool { match self { Expr_::Efun(..) => true, _ => false, } } pub fn is_lfun(&self) -> bool { match self { Expr_::Lfun(..) => true, _ => false, } } pub fn is_xml(&self) -> bool { match self { Expr_::Xml(..) => true, _ => false, } } pub fn is_import(&self) -> bool { match self { Expr_::Import(..) => true, _ => false, } } pub fn is_collection(&self) -> bool { match self { Expr_::Collection(..) => true, _ => false, } } pub fn is_expression_tree(&self) -> bool { match self { Expr_::ExpressionTree(..) => true, _ => false, } } pub fn is_lplaceholder(&self) -> bool { match self { Expr_::Lplaceholder(..) => true, _ => false, } } pub fn is_method_caller(&self) -> bool { match self { Expr_::MethodCaller(..) => true, _ => false, } } pub fn is_pair(&self) -> bool { match self { Expr_::Pair(..) => true, _ => false, } } pub fn is_etsplice(&self) -> bool { match self { Expr_::ETSplice(..) => true, _ => false, } } pub fn is_enum_class_label(&self) -> bool { match self { Expr_::EnumClassLabel(..) => true, _ => false, } } pub fn is_hole(&self) -> bool { match self { Expr_::Hole(..) => true, _ => false, } } pub fn is_package(&self) -> bool { match self { Expr_::Package(..) => true, _ => false, } } pub fn as_darray( &self, ) -> Option<( &Option<(Targ<Ex>, Targ<Ex>)>, &Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )> { match self { Expr_::Darray(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_varray(&self) -> Option<(&Option<Targ<Ex>>, &Vec<Expr<Ex, En>>)> { match self { Expr_::Varray(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_shape(&self) -> Option<&Vec<(ast_defs::ShapeFieldName, Expr<Ex, En>)>> { match self { Expr_::Shape(p0) => Some(p0), _ => None, } } pub fn as_val_collection( &self, ) -> Option<(&(Pos, VcKind), &Option<Targ<Ex>>, &Vec<Expr<Ex, En>>)> { match self { Expr_::ValCollection(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_key_val_collection( &self, ) -> Option<( &(Pos, KvcKind), &Option<(Targ<Ex>, Targ<Ex>)>, &Vec<Field<Ex, En>>, )> { match self { Expr_::KeyValCollection(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_invalid(&self) -> Option<&Option<Expr<Ex, En>>> { match self { Expr_::Invalid(p0) => Some(&p0), _ => None, } } pub fn as_id(&self) -> Option<&Sid> { match self { Expr_::Id(p0) => Some(&p0), _ => None, } } pub fn as_lvar(&self) -> Option<&Lid> { match self { Expr_::Lvar(p0) => Some(&p0), _ => None, } } pub fn as_dollardollar(&self) -> Option<&Lid> { match self { Expr_::Dollardollar(p0) => Some(&p0), _ => None, } } pub fn as_clone(&self) -> Option<&Expr<Ex, En>> { match self { Expr_::Clone(p0) => Some(&p0), _ => None, } } pub fn as_array_get(&self) -> Option<(&Expr<Ex, En>, &Option<Expr<Ex, En>>)> { match self { Expr_::ArrayGet(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_obj_get( &self, ) -> Option<(&Expr<Ex, En>, &Expr<Ex, En>, &OgNullFlavor, &PropOrMethod)> { match self { Expr_::ObjGet(p0) => Some((&p0.0, &p0.1, &p0.2, &p0.3)), _ => None, } } pub fn as_class_get(&self) -> Option<(&ClassId<Ex, En>, &ClassGetExpr<Ex, En>, &PropOrMethod)> { match self { Expr_::ClassGet(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_class_const(&self) -> Option<(&ClassId<Ex, En>, &Pstring)> { match self { Expr_::ClassConst(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_call(&self) -> Option<&CallExpr<Ex, En>> { match self { Expr_::Call(p0) => Some(&p0), _ => None, } } pub fn as_function_pointer(&self) -> Option<(&FunctionPtrId<Ex, En>, &Vec<Targ<Ex>>)> { match self { Expr_::FunctionPointer(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_int(&self) -> Option<&String> { match self { Expr_::Int(p0) => Some(p0), _ => None, } } pub fn as_float(&self) -> Option<&String> { match self { Expr_::Float(p0) => Some(p0), _ => None, } } pub fn as_string(&self) -> Option<&bstr::BString> { match self { Expr_::String(p0) => Some(p0), _ => None, } } pub fn as_string2(&self) -> Option<&Vec<Expr<Ex, En>>> { match self { Expr_::String2(p0) => Some(p0), _ => None, } } pub fn as_prefixed_string(&self) -> Option<(&String, &Expr<Ex, En>)> { match self { Expr_::PrefixedString(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_yield(&self) -> Option<&Afield<Ex, En>> { match self { Expr_::Yield(p0) => Some(&p0), _ => None, } } pub fn as_await(&self) -> Option<&Expr<Ex, En>> { match self { Expr_::Await(p0) => Some(&p0), _ => None, } } pub fn as_readonly_expr(&self) -> Option<&Expr<Ex, En>> { match self { Expr_::ReadonlyExpr(p0) => Some(&p0), _ => None, } } pub fn as_tuple(&self) -> Option<&Vec<Expr<Ex, En>>> { match self { Expr_::Tuple(p0) => Some(p0), _ => None, } } pub fn as_list(&self) -> Option<&Vec<Expr<Ex, En>>> { match self { Expr_::List(p0) => Some(p0), _ => None, } } pub fn as_cast(&self) -> Option<(&Hint, &Expr<Ex, En>)> { match self { Expr_::Cast(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_unop(&self) -> Option<(&ast_defs::Uop, &Expr<Ex, En>)> { match self { Expr_::Unop(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_binop(&self) -> Option<&Binop<Ex, En>> { match self { Expr_::Binop(p0) => Some(&p0), _ => None, } } pub fn as_pipe(&self) -> Option<(&Lid, &Expr<Ex, En>, &Expr<Ex, En>)> { match self { Expr_::Pipe(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_eif(&self) -> Option<(&Expr<Ex, En>, &Option<Expr<Ex, En>>, &Expr<Ex, En>)> { match self { Expr_::Eif(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_is(&self) -> Option<(&Expr<Ex, En>, &Hint)> { match self { Expr_::Is(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_as(&self) -> Option<(&Expr<Ex, En>, &Hint, &bool)> { match self { Expr_::As(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_upcast(&self) -> Option<(&Expr<Ex, En>, &Hint)> { match self { Expr_::Upcast(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_new( &self, ) -> Option<( &ClassId<Ex, En>, &Vec<Targ<Ex>>, &Vec<Expr<Ex, En>>, &Option<Expr<Ex, En>>, &Ex, )> { match self { Expr_::New(p0) => Some((&p0.0, &p0.1, &p0.2, &p0.3, &p0.4)), _ => None, } } pub fn as_efun(&self) -> Option<&Efun<Ex, En>> { match self { Expr_::Efun(p0) => Some(&p0), _ => None, } } pub fn as_lfun(&self) -> Option<(&Fun_<Ex, En>, &Vec<CaptureLid<Ex>>)> { match self { Expr_::Lfun(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_xml(&self) -> Option<(&ClassName, &Vec<XhpAttribute<Ex, En>>, &Vec<Expr<Ex, En>>)> { match self { Expr_::Xml(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_import(&self) -> Option<(&ImportFlavor, &Expr<Ex, En>)> { match self { Expr_::Import(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_collection( &self, ) -> Option<( &ClassName, &Option<CollectionTarg<Ex>>, &Vec<Afield<Ex, En>>, )> { match self { Expr_::Collection(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_expression_tree(&self) -> Option<&ExpressionTree<Ex, En>> { match self { Expr_::ExpressionTree(p0) => Some(&p0), _ => None, } } pub fn as_lplaceholder(&self) -> Option<&Pos> { match self { Expr_::Lplaceholder(p0) => Some(&p0), _ => None, } } pub fn as_method_caller(&self) -> Option<(&ClassName, &Pstring)> { match self { Expr_::MethodCaller(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_pair(&self) -> Option<(&Option<(Targ<Ex>, Targ<Ex>)>, &Expr<Ex, En>, &Expr<Ex, En>)> { match self { Expr_::Pair(p0) => Some((&p0.0, &p0.1, &p0.2)), _ => None, } } pub fn as_etsplice(&self) -> Option<&Expr<Ex, En>> { match self { Expr_::ETSplice(p0) => Some(&p0), _ => None, } } pub fn as_enum_class_label(&self) -> Option<(&Option<ClassName>, &String)> { match self { Expr_::EnumClassLabel(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_hole(&self) -> Option<(&Expr<Ex, En>, &Ex, &Ex, &HoleSource)> { match self { Expr_::Hole(p0) => Some((&p0.0, &p0.1, &p0.2, &p0.3)), _ => None, } } pub fn as_package(&self) -> Option<&Sid> { match self { Expr_::Package(p0) => Some(&p0), _ => None, } } pub fn as_darray_mut( &mut self, ) -> Option<( &mut Option<(Targ<Ex>, Targ<Ex>)>, &mut Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )> { match self { Expr_::Darray(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_varray_mut(&mut self) -> Option<(&mut Option<Targ<Ex>>, &mut Vec<Expr<Ex, En>>)> { match self { Expr_::Varray(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_shape_mut(&mut self) -> Option<&mut Vec<(ast_defs::ShapeFieldName, Expr<Ex, En>)>> { match self { Expr_::Shape(p0) => Some(p0), _ => None, } } pub fn as_val_collection_mut( &mut self, ) -> Option<( &mut (Pos, VcKind), &mut Option<Targ<Ex>>, &mut Vec<Expr<Ex, En>>, )> { match self { Expr_::ValCollection(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_key_val_collection_mut( &mut self, ) -> Option<( &mut (Pos, KvcKind), &mut Option<(Targ<Ex>, Targ<Ex>)>, &mut Vec<Field<Ex, En>>, )> { match self { Expr_::KeyValCollection(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_invalid_mut(&mut self) -> Option<&mut Option<Expr<Ex, En>>> { match self { Expr_::Invalid(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_id_mut(&mut self) -> Option<&mut Sid> { match self { Expr_::Id(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_lvar_mut(&mut self) -> Option<&mut Lid> { match self { Expr_::Lvar(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_dollardollar_mut(&mut self) -> Option<&mut Lid> { match self { Expr_::Dollardollar(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_clone_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Expr_::Clone(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_array_get_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Option<Expr<Ex, En>>)> { match self { Expr_::ArrayGet(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_obj_get_mut( &mut self, ) -> Option<( &mut Expr<Ex, En>, &mut Expr<Ex, En>, &mut OgNullFlavor, &mut PropOrMethod, )> { match self { Expr_::ObjGet(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2, &mut p0.3)), _ => None, } } pub fn as_class_get_mut( &mut self, ) -> Option<( &mut ClassId<Ex, En>, &mut ClassGetExpr<Ex, En>, &mut PropOrMethod, )> { match self { Expr_::ClassGet(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_class_const_mut(&mut self) -> Option<(&mut ClassId<Ex, En>, &mut Pstring)> { match self { Expr_::ClassConst(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_call_mut(&mut self) -> Option<&mut CallExpr<Ex, En>> { match self { Expr_::Call(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_function_pointer_mut( &mut self, ) -> Option<(&mut FunctionPtrId<Ex, En>, &mut Vec<Targ<Ex>>)> { match self { Expr_::FunctionPointer(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_int_mut(&mut self) -> Option<&mut String> { match self { Expr_::Int(p0) => Some(p0), _ => None, } } pub fn as_float_mut(&mut self) -> Option<&mut String> { match self { Expr_::Float(p0) => Some(p0), _ => None, } } pub fn as_string_mut(&mut self) -> Option<&mut bstr::BString> { match self { Expr_::String(p0) => Some(p0), _ => None, } } pub fn as_string2_mut(&mut self) -> Option<&mut Vec<Expr<Ex, En>>> { match self { Expr_::String2(p0) => Some(p0), _ => None, } } pub fn as_prefixed_string_mut(&mut self) -> Option<(&mut String, &mut Expr<Ex, En>)> { match self { Expr_::PrefixedString(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_yield_mut(&mut self) -> Option<&mut Afield<Ex, En>> { match self { Expr_::Yield(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_await_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Expr_::Await(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_readonly_expr_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Expr_::ReadonlyExpr(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_tuple_mut(&mut self) -> Option<&mut Vec<Expr<Ex, En>>> { match self { Expr_::Tuple(p0) => Some(p0), _ => None, } } pub fn as_list_mut(&mut self) -> Option<&mut Vec<Expr<Ex, En>>> { match self { Expr_::List(p0) => Some(p0), _ => None, } } pub fn as_cast_mut(&mut self) -> Option<(&mut Hint, &mut Expr<Ex, En>)> { match self { Expr_::Cast(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_unop_mut(&mut self) -> Option<(&mut ast_defs::Uop, &mut Expr<Ex, En>)> { match self { Expr_::Unop(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_binop_mut(&mut self) -> Option<&mut Binop<Ex, En>> { match self { Expr_::Binop(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_pipe_mut(&mut self) -> Option<(&mut Lid, &mut Expr<Ex, En>, &mut Expr<Ex, En>)> { match self { Expr_::Pipe(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_eif_mut( &mut self, ) -> Option<( &mut Expr<Ex, En>, &mut Option<Expr<Ex, En>>, &mut Expr<Ex, En>, )> { match self { Expr_::Eif(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_is_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Hint)> { match self { Expr_::Is(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_as_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Hint, &mut bool)> { match self { Expr_::As(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_upcast_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Hint)> { match self { Expr_::Upcast(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_new_mut( &mut self, ) -> Option<( &mut ClassId<Ex, En>, &mut Vec<Targ<Ex>>, &mut Vec<Expr<Ex, En>>, &mut Option<Expr<Ex, En>>, &mut Ex, )> { match self { Expr_::New(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2, &mut p0.3, &mut p0.4)), _ => None, } } pub fn as_efun_mut(&mut self) -> Option<&mut Efun<Ex, En>> { match self { Expr_::Efun(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_lfun_mut(&mut self) -> Option<(&mut Fun_<Ex, En>, &mut Vec<CaptureLid<Ex>>)> { match self { Expr_::Lfun(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_xml_mut( &mut self, ) -> Option<( &mut ClassName, &mut Vec<XhpAttribute<Ex, En>>, &mut Vec<Expr<Ex, En>>, )> { match self { Expr_::Xml(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_import_mut(&mut self) -> Option<(&mut ImportFlavor, &mut Expr<Ex, En>)> { match self { Expr_::Import(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_collection_mut( &mut self, ) -> Option<( &mut ClassName, &mut Option<CollectionTarg<Ex>>, &mut Vec<Afield<Ex, En>>, )> { match self { Expr_::Collection(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_expression_tree_mut(&mut self) -> Option<&mut ExpressionTree<Ex, En>> { match self { Expr_::ExpressionTree(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_lplaceholder_mut(&mut self) -> Option<&mut Pos> { match self { Expr_::Lplaceholder(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_method_caller_mut(&mut self) -> Option<(&mut ClassName, &mut Pstring)> { match self { Expr_::MethodCaller(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_pair_mut( &mut self, ) -> Option<( &mut Option<(Targ<Ex>, Targ<Ex>)>, &mut Expr<Ex, En>, &mut Expr<Ex, En>, )> { match self { Expr_::Pair(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2)), _ => None, } } pub fn as_etsplice_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Expr_::ETSplice(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_enum_class_label_mut(&mut self) -> Option<(&mut Option<ClassName>, &mut String)> { match self { Expr_::EnumClassLabel(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_hole_mut( &mut self, ) -> Option<(&mut Expr<Ex, En>, &mut Ex, &mut Ex, &mut HoleSource)> { match self { Expr_::Hole(p0) => Some((&mut p0.0, &mut p0.1, &mut p0.2, &mut p0.3)), _ => None, } } pub fn as_package_mut(&mut self) -> Option<&mut Sid> { match self { Expr_::Package(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_darray_into( self, ) -> Option<( Option<(Targ<Ex>, Targ<Ex>)>, Vec<(Expr<Ex, En>, Expr<Ex, En>)>, )> { match self { Expr_::Darray(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_varray_into(self) -> Option<(Option<Targ<Ex>>, Vec<Expr<Ex, En>>)> { match self { Expr_::Varray(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_shape_into(self) -> Option<Vec<(ast_defs::ShapeFieldName, Expr<Ex, En>)>> { match self { Expr_::Shape(p0) => Some(p0), _ => None, } } pub fn as_val_collection_into( self, ) -> Option<((Pos, VcKind), Option<Targ<Ex>>, Vec<Expr<Ex, En>>)> { match self { Expr_::ValCollection(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_key_val_collection_into( self, ) -> Option<( (Pos, KvcKind), Option<(Targ<Ex>, Targ<Ex>)>, Vec<Field<Ex, En>>, )> { match self { Expr_::KeyValCollection(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_invalid_into(self) -> Option<Option<Expr<Ex, En>>> { match self { Expr_::Invalid(p0) => Some(*p0), _ => None, } } pub fn as_id_into(self) -> Option<Sid> { match self { Expr_::Id(p0) => Some(*p0), _ => None, } } pub fn as_lvar_into(self) -> Option<Lid> { match self { Expr_::Lvar(p0) => Some(*p0), _ => None, } } pub fn as_dollardollar_into(self) -> Option<Lid> { match self { Expr_::Dollardollar(p0) => Some(*p0), _ => None, } } pub fn as_clone_into(self) -> Option<Expr<Ex, En>> { match self { Expr_::Clone(p0) => Some(*p0), _ => None, } } pub fn as_array_get_into(self) -> Option<(Expr<Ex, En>, Option<Expr<Ex, En>>)> { match self { Expr_::ArrayGet(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_obj_get_into( self, ) -> Option<(Expr<Ex, En>, Expr<Ex, En>, OgNullFlavor, PropOrMethod)> { match self { Expr_::ObjGet(p0) => Some(((*p0).0, (*p0).1, (*p0).2, (*p0).3)), _ => None, } } pub fn as_class_get_into( self, ) -> Option<(ClassId<Ex, En>, ClassGetExpr<Ex, En>, PropOrMethod)> { match self { Expr_::ClassGet(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_class_const_into(self) -> Option<(ClassId<Ex, En>, Pstring)> { match self { Expr_::ClassConst(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_call_into(self) -> Option<CallExpr<Ex, En>> { match self { Expr_::Call(p0) => Some(*p0), _ => None, } } pub fn as_function_pointer_into(self) -> Option<(FunctionPtrId<Ex, En>, Vec<Targ<Ex>>)> { match self { Expr_::FunctionPointer(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_int_into(self) -> Option<String> { match self { Expr_::Int(p0) => Some(p0), _ => None, } } pub fn as_float_into(self) -> Option<String> { match self { Expr_::Float(p0) => Some(p0), _ => None, } } pub fn as_string_into(self) -> Option<bstr::BString> { match self { Expr_::String(p0) => Some(p0), _ => None, } } pub fn as_string2_into(self) -> Option<Vec<Expr<Ex, En>>> { match self { Expr_::String2(p0) => Some(p0), _ => None, } } pub fn as_prefixed_string_into(self) -> Option<(String, Expr<Ex, En>)> { match self { Expr_::PrefixedString(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_yield_into(self) -> Option<Afield<Ex, En>> { match self { Expr_::Yield(p0) => Some(*p0), _ => None, } } pub fn as_await_into(self) -> Option<Expr<Ex, En>> { match self { Expr_::Await(p0) => Some(*p0), _ => None, } } pub fn as_readonly_expr_into(self) -> Option<Expr<Ex, En>> { match self { Expr_::ReadonlyExpr(p0) => Some(*p0), _ => None, } } pub fn as_tuple_into(self) -> Option<Vec<Expr<Ex, En>>> { match self { Expr_::Tuple(p0) => Some(p0), _ => None, } } pub fn as_list_into(self) -> Option<Vec<Expr<Ex, En>>> { match self { Expr_::List(p0) => Some(p0), _ => None, } } pub fn as_cast_into(self) -> Option<(Hint, Expr<Ex, En>)> { match self { Expr_::Cast(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_unop_into(self) -> Option<(ast_defs::Uop, Expr<Ex, En>)> { match self { Expr_::Unop(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_binop_into(self) -> Option<Binop<Ex, En>> { match self { Expr_::Binop(p0) => Some(*p0), _ => None, } } pub fn as_pipe_into(self) -> Option<(Lid, Expr<Ex, En>, Expr<Ex, En>)> { match self { Expr_::Pipe(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_eif_into(self) -> Option<(Expr<Ex, En>, Option<Expr<Ex, En>>, Expr<Ex, En>)> { match self { Expr_::Eif(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_is_into(self) -> Option<(Expr<Ex, En>, Hint)> { match self { Expr_::Is(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_as_into(self) -> Option<(Expr<Ex, En>, Hint, bool)> { match self { Expr_::As(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_upcast_into(self) -> Option<(Expr<Ex, En>, Hint)> { match self { Expr_::Upcast(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_new_into( self, ) -> Option<( ClassId<Ex, En>, Vec<Targ<Ex>>, Vec<Expr<Ex, En>>, Option<Expr<Ex, En>>, Ex, )> { match self { Expr_::New(p0) => Some(((*p0).0, (*p0).1, (*p0).2, (*p0).3, (*p0).4)), _ => None, } } pub fn as_efun_into(self) -> Option<Efun<Ex, En>> { match self { Expr_::Efun(p0) => Some(*p0), _ => None, } } pub fn as_lfun_into(self) -> Option<(Fun_<Ex, En>, Vec<CaptureLid<Ex>>)> { match self { Expr_::Lfun(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_xml_into(self) -> Option<(ClassName, Vec<XhpAttribute<Ex, En>>, Vec<Expr<Ex, En>>)> { match self { Expr_::Xml(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_import_into(self) -> Option<(ImportFlavor, Expr<Ex, En>)> { match self { Expr_::Import(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_collection_into( self, ) -> Option<(ClassName, Option<CollectionTarg<Ex>>, Vec<Afield<Ex, En>>)> { match self { Expr_::Collection(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_expression_tree_into(self) -> Option<ExpressionTree<Ex, En>> { match self { Expr_::ExpressionTree(p0) => Some(*p0), _ => None, } } pub fn as_lplaceholder_into(self) -> Option<Pos> { match self { Expr_::Lplaceholder(p0) => Some(*p0), _ => None, } } pub fn as_method_caller_into(self) -> Option<(ClassName, Pstring)> { match self { Expr_::MethodCaller(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_pair_into( self, ) -> Option<(Option<(Targ<Ex>, Targ<Ex>)>, Expr<Ex, En>, Expr<Ex, En>)> { match self { Expr_::Pair(p0) => Some(((*p0).0, (*p0).1, (*p0).2)), _ => None, } } pub fn as_etsplice_into(self) -> Option<Expr<Ex, En>> { match self { Expr_::ETSplice(p0) => Some(*p0), _ => None, } } pub fn as_enum_class_label_into(self) -> Option<(Option<ClassName>, String)> { match self { Expr_::EnumClassLabel(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_hole_into(self) -> Option<(Expr<Ex, En>, Ex, Ex, HoleSource)> { match self { Expr_::Hole(p0) => Some(((*p0).0, (*p0).1, (*p0).2, (*p0).3)), _ => None, } } pub fn as_package_into(self) -> Option<Sid> { match self { Expr_::Package(p0) => Some(*p0), _ => None, } } } impl HoleSource { pub fn mk_typing() -> Self { HoleSource::Typing } pub fn mk_unsafe_cast(p0: Vec<Hint>) -> Self { HoleSource::UnsafeCast(p0) } pub fn mk_unsafe_nonnull_cast() -> Self { HoleSource::UnsafeNonnullCast } pub fn mk_enforced_cast(p0: Vec<Hint>) -> Self { HoleSource::EnforcedCast(p0) } pub fn is_typing(&self) -> bool { match self { HoleSource::Typing => true, _ => false, } } pub fn is_unsafe_cast(&self) -> bool { match self { HoleSource::UnsafeCast(..) => true, _ => false, } } pub fn is_unsafe_nonnull_cast(&self) -> bool { match self { HoleSource::UnsafeNonnullCast => true, _ => false, } } pub fn is_enforced_cast(&self) -> bool { match self { HoleSource::EnforcedCast(..) => true, _ => false, } } pub fn as_unsafe_cast(&self) -> Option<&Vec<Hint>> { match self { HoleSource::UnsafeCast(p0) => Some(p0), _ => None, } } pub fn as_enforced_cast(&self) -> Option<&Vec<Hint>> { match self { HoleSource::EnforcedCast(p0) => Some(p0), _ => None, } } pub fn as_unsafe_cast_mut(&mut self) -> Option<&mut Vec<Hint>> { match self { HoleSource::UnsafeCast(p0) => Some(p0), _ => None, } } pub fn as_enforced_cast_mut(&mut self) -> Option<&mut Vec<Hint>> { match self { HoleSource::EnforcedCast(p0) => Some(p0), _ => None, } } pub fn as_unsafe_cast_into(self) -> Option<Vec<Hint>> { match self { HoleSource::UnsafeCast(p0) => Some(p0), _ => None, } } pub fn as_enforced_cast_into(self) -> Option<Vec<Hint>> { match self { HoleSource::EnforcedCast(p0) => Some(p0), _ => None, } } } impl<Ex, En> ClassGetExpr<Ex, En> { pub fn mk_cgstring(p0: Pstring) -> Self { ClassGetExpr::CGstring(p0) } pub fn mk_cgexpr(p0: Expr<Ex, En>) -> Self { ClassGetExpr::CGexpr(p0) } pub fn is_cgstring(&self) -> bool { match self { ClassGetExpr::CGstring(..) => true, _ => false, } } pub fn is_cgexpr(&self) -> bool { match self { ClassGetExpr::CGexpr(..) => true, _ => false, } } pub fn as_cgstring(&self) -> Option<&Pstring> { match self { ClassGetExpr::CGstring(p0) => Some(p0), _ => None, } } pub fn as_cgexpr(&self) -> Option<&Expr<Ex, En>> { match self { ClassGetExpr::CGexpr(p0) => Some(p0), _ => None, } } pub fn as_cgstring_mut(&mut self) -> Option<&mut Pstring> { match self { ClassGetExpr::CGstring(p0) => Some(p0), _ => None, } } pub fn as_cgexpr_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { ClassGetExpr::CGexpr(p0) => Some(p0), _ => None, } } pub fn as_cgstring_into(self) -> Option<Pstring> { match self { ClassGetExpr::CGstring(p0) => Some(p0), _ => None, } } pub fn as_cgexpr_into(self) -> Option<Expr<Ex, En>> { match self { ClassGetExpr::CGexpr(p0) => Some(p0), _ => None, } } } impl<Ex, En> GenCase<Ex, En> { pub fn mk_case(p0: Case<Ex, En>) -> Self { GenCase::Case(p0) } pub fn mk_default(p0: DefaultCase<Ex, En>) -> Self { GenCase::Default(p0) } pub fn is_case(&self) -> bool { match self { GenCase::Case(..) => true, _ => false, } } pub fn is_default(&self) -> bool { match self { GenCase::Default(..) => true, _ => false, } } pub fn as_case(&self) -> Option<&Case<Ex, En>> { match self { GenCase::Case(p0) => Some(p0), _ => None, } } pub fn as_default(&self) -> Option<&DefaultCase<Ex, En>> { match self { GenCase::Default(p0) => Some(p0), _ => None, } } pub fn as_case_mut(&mut self) -> Option<&mut Case<Ex, En>> { match self { GenCase::Case(p0) => Some(p0), _ => None, } } pub fn as_default_mut(&mut self) -> Option<&mut DefaultCase<Ex, En>> { match self { GenCase::Default(p0) => Some(p0), _ => None, } } pub fn as_case_into(self) -> Option<Case<Ex, En>> { match self { GenCase::Case(p0) => Some(p0), _ => None, } } pub fn as_default_into(self) -> Option<DefaultCase<Ex, En>> { match self { GenCase::Default(p0) => Some(p0), _ => None, } } } impl<Ex, En> Afield<Ex, En> { pub fn mk_afvalue(p0: Expr<Ex, En>) -> Self { Afield::AFvalue(p0) } pub fn mk_afkvalue(p0: Expr<Ex, En>, p1: Expr<Ex, En>) -> Self { Afield::AFkvalue(p0, p1) } pub fn is_afvalue(&self) -> bool { match self { Afield::AFvalue(..) => true, _ => false, } } pub fn is_afkvalue(&self) -> bool { match self { Afield::AFkvalue(..) => true, _ => false, } } pub fn as_afvalue(&self) -> Option<&Expr<Ex, En>> { match self { Afield::AFvalue(p0) => Some(p0), _ => None, } } pub fn as_afkvalue(&self) -> Option<(&Expr<Ex, En>, &Expr<Ex, En>)> { match self { Afield::AFkvalue(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_afvalue_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { Afield::AFvalue(p0) => Some(p0), _ => None, } } pub fn as_afkvalue_mut(&mut self) -> Option<(&mut Expr<Ex, En>, &mut Expr<Ex, En>)> { match self { Afield::AFkvalue(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_afvalue_into(self) -> Option<Expr<Ex, En>> { match self { Afield::AFvalue(p0) => Some(p0), _ => None, } } pub fn as_afkvalue_into(self) -> Option<(Expr<Ex, En>, Expr<Ex, En>)> { match self { Afield::AFkvalue(p0, p1) => Some((p0, p1)), _ => None, } } } impl<Ex, En> XhpAttribute<Ex, En> { pub fn mk_xhp_simple(p0: XhpSimple<Ex, En>) -> Self { XhpAttribute::XhpSimple(p0) } pub fn mk_xhp_spread(p0: Expr<Ex, En>) -> Self { XhpAttribute::XhpSpread(p0) } pub fn is_xhp_simple(&self) -> bool { match self { XhpAttribute::XhpSimple(..) => true, _ => false, } } pub fn is_xhp_spread(&self) -> bool { match self { XhpAttribute::XhpSpread(..) => true, _ => false, } } pub fn as_xhp_simple(&self) -> Option<&XhpSimple<Ex, En>> { match self { XhpAttribute::XhpSimple(p0) => Some(p0), _ => None, } } pub fn as_xhp_spread(&self) -> Option<&Expr<Ex, En>> { match self { XhpAttribute::XhpSpread(p0) => Some(p0), _ => None, } } pub fn as_xhp_simple_mut(&mut self) -> Option<&mut XhpSimple<Ex, En>> { match self { XhpAttribute::XhpSimple(p0) => Some(p0), _ => None, } } pub fn as_xhp_spread_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { XhpAttribute::XhpSpread(p0) => Some(p0), _ => None, } } pub fn as_xhp_simple_into(self) -> Option<XhpSimple<Ex, En>> { match self { XhpAttribute::XhpSimple(p0) => Some(p0), _ => None, } } pub fn as_xhp_spread_into(self) -> Option<Expr<Ex, En>> { match self { XhpAttribute::XhpSpread(p0) => Some(p0), _ => None, } } } impl RequireKind { pub fn mk_require_extends() -> Self { RequireKind::RequireExtends } pub fn mk_require_implements() -> Self { RequireKind::RequireImplements } pub fn mk_require_class() -> Self { RequireKind::RequireClass } pub fn is_require_extends(&self) -> bool { match self { RequireKind::RequireExtends => true, _ => false, } } pub fn is_require_implements(&self) -> bool { match self { RequireKind::RequireImplements => true, _ => false, } } pub fn is_require_class(&self) -> bool { match self { RequireKind::RequireClass => true, _ => false, } } } impl EmitId { pub fn mk_emit_id(p0: isize) -> Self { EmitId::EmitId(p0) } pub fn mk_anonymous() -> Self { EmitId::Anonymous } pub fn is_emit_id(&self) -> bool { match self { EmitId::EmitId(..) => true, _ => false, } } pub fn is_anonymous(&self) -> bool { match self { EmitId::Anonymous => true, _ => false, } } pub fn as_emit_id(&self) -> Option<&isize> { match self { EmitId::EmitId(p0) => Some(p0), _ => None, } } pub fn as_emit_id_mut(&mut self) -> Option<&mut isize> { match self { EmitId::EmitId(p0) => Some(p0), _ => None, } } pub fn as_emit_id_into(self) -> Option<isize> { match self { EmitId::EmitId(p0) => Some(p0), _ => None, } } } impl XhpAttrTag { pub fn mk_required() -> Self { XhpAttrTag::Required } pub fn mk_late_init() -> Self { XhpAttrTag::LateInit } pub fn is_required(&self) -> bool { match self { XhpAttrTag::Required => true, _ => false, } } pub fn is_late_init(&self) -> bool { match self { XhpAttrTag::LateInit => true, _ => false, } } } impl<Ex, En> ClassConstKind<Ex, En> { pub fn mk_ccabstract(p0: Option<Expr<Ex, En>>) -> Self { ClassConstKind::CCAbstract(p0) } pub fn mk_ccconcrete(p0: Expr<Ex, En>) -> Self { ClassConstKind::CCConcrete(p0) } pub fn is_ccabstract(&self) -> bool { match self { ClassConstKind::CCAbstract(..) => true, _ => false, } } pub fn is_ccconcrete(&self) -> bool { match self { ClassConstKind::CCConcrete(..) => true, _ => false, } } pub fn as_ccabstract(&self) -> Option<&Option<Expr<Ex, En>>> { match self { ClassConstKind::CCAbstract(p0) => Some(p0), _ => None, } } pub fn as_ccconcrete(&self) -> Option<&Expr<Ex, En>> { match self { ClassConstKind::CCConcrete(p0) => Some(p0), _ => None, } } pub fn as_ccabstract_mut(&mut self) -> Option<&mut Option<Expr<Ex, En>>> { match self { ClassConstKind::CCAbstract(p0) => Some(p0), _ => None, } } pub fn as_ccconcrete_mut(&mut self) -> Option<&mut Expr<Ex, En>> { match self { ClassConstKind::CCConcrete(p0) => Some(p0), _ => None, } } pub fn as_ccabstract_into(self) -> Option<Option<Expr<Ex, En>>> { match self { ClassConstKind::CCAbstract(p0) => Some(p0), _ => None, } } pub fn as_ccconcrete_into(self) -> Option<Expr<Ex, En>> { match self { ClassConstKind::CCConcrete(p0) => Some(p0), _ => None, } } } impl ClassTypeconst { pub fn mk_tcabstract(p0: ClassAbstractTypeconst) -> Self { ClassTypeconst::TCAbstract(p0) } pub fn mk_tcconcrete(p0: ClassConcreteTypeconst) -> Self { ClassTypeconst::TCConcrete(p0) } pub fn is_tcabstract(&self) -> bool { match self { ClassTypeconst::TCAbstract(..) => true, _ => false, } } pub fn is_tcconcrete(&self) -> bool { match self { ClassTypeconst::TCConcrete(..) => true, _ => false, } } pub fn as_tcabstract(&self) -> Option<&ClassAbstractTypeconst> { match self { ClassTypeconst::TCAbstract(p0) => Some(p0), _ => None, } } pub fn as_tcconcrete(&self) -> Option<&ClassConcreteTypeconst> { match self { ClassTypeconst::TCConcrete(p0) => Some(p0), _ => None, } } pub fn as_tcabstract_mut(&mut self) -> Option<&mut ClassAbstractTypeconst> { match self { ClassTypeconst::TCAbstract(p0) => Some(p0), _ => None, } } pub fn as_tcconcrete_mut(&mut self) -> Option<&mut ClassConcreteTypeconst> { match self { ClassTypeconst::TCConcrete(p0) => Some(p0), _ => None, } } pub fn as_tcabstract_into(self) -> Option<ClassAbstractTypeconst> { match self { ClassTypeconst::TCAbstract(p0) => Some(p0), _ => None, } } pub fn as_tcconcrete_into(self) -> Option<ClassConcreteTypeconst> { match self { ClassTypeconst::TCConcrete(p0) => Some(p0), _ => None, } } } impl MdNameKind { pub fn mk_mdname_global(p0: Pos) -> Self { MdNameKind::MDNameGlobal(p0) } pub fn mk_mdname_prefix(p0: Sid) -> Self { MdNameKind::MDNamePrefix(p0) } pub fn mk_mdname_exact(p0: Sid) -> Self { MdNameKind::MDNameExact(p0) } pub fn is_mdname_global(&self) -> bool { match self { MdNameKind::MDNameGlobal(..) => true, _ => false, } } pub fn is_mdname_prefix(&self) -> bool { match self { MdNameKind::MDNamePrefix(..) => true, _ => false, } } pub fn is_mdname_exact(&self) -> bool { match self { MdNameKind::MDNameExact(..) => true, _ => false, } } pub fn as_mdname_global(&self) -> Option<&Pos> { match self { MdNameKind::MDNameGlobal(p0) => Some(p0), _ => None, } } pub fn as_mdname_prefix(&self) -> Option<&Sid> { match self { MdNameKind::MDNamePrefix(p0) => Some(p0), _ => None, } } pub fn as_mdname_exact(&self) -> Option<&Sid> { match self { MdNameKind::MDNameExact(p0) => Some(p0), _ => None, } } pub fn as_mdname_global_mut(&mut self) -> Option<&mut Pos> { match self { MdNameKind::MDNameGlobal(p0) => Some(p0), _ => None, } } pub fn as_mdname_prefix_mut(&mut self) -> Option<&mut Sid> { match self { MdNameKind::MDNamePrefix(p0) => Some(p0), _ => None, } } pub fn as_mdname_exact_mut(&mut self) -> Option<&mut Sid> { match self { MdNameKind::MDNameExact(p0) => Some(p0), _ => None, } } pub fn as_mdname_global_into(self) -> Option<Pos> { match self { MdNameKind::MDNameGlobal(p0) => Some(p0), _ => None, } } pub fn as_mdname_prefix_into(self) -> Option<Sid> { match self { MdNameKind::MDNamePrefix(p0) => Some(p0), _ => None, } } pub fn as_mdname_exact_into(self) -> Option<Sid> { match self { MdNameKind::MDNameExact(p0) => Some(p0), _ => None, } } } impl<Ex, En> Def<Ex, En> { pub fn mk_fun(p0: FunDef<Ex, En>) -> Self { Def::Fun(Box::new(p0)) } pub fn mk_class(p0: Class_<Ex, En>) -> Self { Def::Class(Box::new(p0)) } pub fn mk_stmt(p0: Stmt<Ex, En>) -> Self { Def::Stmt(Box::new(p0)) } pub fn mk_typedef(p0: Typedef<Ex, En>) -> Self { Def::Typedef(Box::new(p0)) } pub fn mk_constant(p0: Gconst<Ex, En>) -> Self { Def::Constant(Box::new(p0)) } pub fn mk_namespace(p0: Sid, p1: Vec<Def<Ex, En>>) -> Self { Def::Namespace(Box::new((p0, p1))) } pub fn mk_namespace_use(p0: Vec<(NsKind, Sid, Sid)>) -> Self { Def::NamespaceUse(p0) } pub fn mk_set_namespace_env(p0: Nsenv) -> Self { Def::SetNamespaceEnv(Box::new(p0)) } pub fn mk_file_attributes(p0: FileAttribute<Ex, En>) -> Self { Def::FileAttributes(Box::new(p0)) } pub fn mk_module(p0: ModuleDef<Ex, En>) -> Self { Def::Module(Box::new(p0)) } pub fn mk_set_module(p0: Sid) -> Self { Def::SetModule(Box::new(p0)) } pub fn is_fun(&self) -> bool { match self { Def::Fun(..) => true, _ => false, } } pub fn is_class(&self) -> bool { match self { Def::Class(..) => true, _ => false, } } pub fn is_stmt(&self) -> bool { match self { Def::Stmt(..) => true, _ => false, } } pub fn is_typedef(&self) -> bool { match self { Def::Typedef(..) => true, _ => false, } } pub fn is_constant(&self) -> bool { match self { Def::Constant(..) => true, _ => false, } } pub fn is_namespace(&self) -> bool { match self { Def::Namespace(..) => true, _ => false, } } pub fn is_namespace_use(&self) -> bool { match self { Def::NamespaceUse(..) => true, _ => false, } } pub fn is_set_namespace_env(&self) -> bool { match self { Def::SetNamespaceEnv(..) => true, _ => false, } } pub fn is_file_attributes(&self) -> bool { match self { Def::FileAttributes(..) => true, _ => false, } } pub fn is_module(&self) -> bool { match self { Def::Module(..) => true, _ => false, } } pub fn is_set_module(&self) -> bool { match self { Def::SetModule(..) => true, _ => false, } } pub fn as_fun(&self) -> Option<&FunDef<Ex, En>> { match self { Def::Fun(p0) => Some(&p0), _ => None, } } pub fn as_class(&self) -> Option<&Class_<Ex, En>> { match self { Def::Class(p0) => Some(&p0), _ => None, } } pub fn as_stmt(&self) -> Option<&Stmt<Ex, En>> { match self { Def::Stmt(p0) => Some(&p0), _ => None, } } pub fn as_typedef(&self) -> Option<&Typedef<Ex, En>> { match self { Def::Typedef(p0) => Some(&p0), _ => None, } } pub fn as_constant(&self) -> Option<&Gconst<Ex, En>> { match self { Def::Constant(p0) => Some(&p0), _ => None, } } pub fn as_namespace(&self) -> Option<(&Sid, &Vec<Def<Ex, En>>)> { match self { Def::Namespace(p0) => Some((&p0.0, &p0.1)), _ => None, } } pub fn as_namespace_use(&self) -> Option<&Vec<(NsKind, Sid, Sid)>> { match self { Def::NamespaceUse(p0) => Some(p0), _ => None, } } pub fn as_set_namespace_env(&self) -> Option<&Nsenv> { match self { Def::SetNamespaceEnv(p0) => Some(&p0), _ => None, } } pub fn as_file_attributes(&self) -> Option<&FileAttribute<Ex, En>> { match self { Def::FileAttributes(p0) => Some(&p0), _ => None, } } pub fn as_module(&self) -> Option<&ModuleDef<Ex, En>> { match self { Def::Module(p0) => Some(&p0), _ => None, } } pub fn as_set_module(&self) -> Option<&Sid> { match self { Def::SetModule(p0) => Some(&p0), _ => None, } } pub fn as_fun_mut(&mut self) -> Option<&mut FunDef<Ex, En>> { match self { Def::Fun(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_class_mut(&mut self) -> Option<&mut Class_<Ex, En>> { match self { Def::Class(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_stmt_mut(&mut self) -> Option<&mut Stmt<Ex, En>> { match self { Def::Stmt(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_typedef_mut(&mut self) -> Option<&mut Typedef<Ex, En>> { match self { Def::Typedef(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_constant_mut(&mut self) -> Option<&mut Gconst<Ex, En>> { match self { Def::Constant(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_namespace_mut(&mut self) -> Option<(&mut Sid, &mut Vec<Def<Ex, En>>)> { match self { Def::Namespace(p0) => Some((&mut p0.0, &mut p0.1)), _ => None, } } pub fn as_namespace_use_mut(&mut self) -> Option<&mut Vec<(NsKind, Sid, Sid)>> { match self { Def::NamespaceUse(p0) => Some(p0), _ => None, } } pub fn as_set_namespace_env_mut(&mut self) -> Option<&mut Nsenv> { match self { Def::SetNamespaceEnv(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_file_attributes_mut(&mut self) -> Option<&mut FileAttribute<Ex, En>> { match self { Def::FileAttributes(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_module_mut(&mut self) -> Option<&mut ModuleDef<Ex, En>> { match self { Def::Module(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_set_module_mut(&mut self) -> Option<&mut Sid> { match self { Def::SetModule(p0) => Some(p0.as_mut()), _ => None, } } pub fn as_fun_into(self) -> Option<FunDef<Ex, En>> { match self { Def::Fun(p0) => Some(*p0), _ => None, } } pub fn as_class_into(self) -> Option<Class_<Ex, En>> { match self { Def::Class(p0) => Some(*p0), _ => None, } } pub fn as_stmt_into(self) -> Option<Stmt<Ex, En>> { match self { Def::Stmt(p0) => Some(*p0), _ => None, } } pub fn as_typedef_into(self) -> Option<Typedef<Ex, En>> { match self { Def::Typedef(p0) => Some(*p0), _ => None, } } pub fn as_constant_into(self) -> Option<Gconst<Ex, En>> { match self { Def::Constant(p0) => Some(*p0), _ => None, } } pub fn as_namespace_into(self) -> Option<(Sid, Vec<Def<Ex, En>>)> { match self { Def::Namespace(p0) => Some(((*p0).0, (*p0).1)), _ => None, } } pub fn as_namespace_use_into(self) -> Option<Vec<(NsKind, Sid, Sid)>> { match self { Def::NamespaceUse(p0) => Some(p0), _ => None, } } pub fn as_set_namespace_env_into(self) -> Option<Nsenv> { match self { Def::SetNamespaceEnv(p0) => Some(*p0), _ => None, } } pub fn as_file_attributes_into(self) -> Option<FileAttribute<Ex, En>> { match self { Def::FileAttributes(p0) => Some(*p0), _ => None, } } pub fn as_module_into(self) -> Option<ModuleDef<Ex, En>> { match self { Def::Module(p0) => Some(*p0), _ => None, } } pub fn as_set_module_into(self) -> Option<Sid> { match self { Def::SetModule(p0) => Some(*p0), _ => None, } } } impl NsKind { pub fn mk_nsnamespace() -> Self { NsKind::NSNamespace } pub fn mk_nsclass() -> Self { NsKind::NSClass } pub fn mk_nsclass_and_namespace() -> Self { NsKind::NSClassAndNamespace } pub fn mk_nsfun() -> Self { NsKind::NSFun } pub fn mk_nsconst() -> Self { NsKind::NSConst } pub fn is_nsnamespace(&self) -> bool { match self { NsKind::NSNamespace => true, _ => false, } } pub fn is_nsclass(&self) -> bool { match self { NsKind::NSClass => true, _ => false, } } pub fn is_nsclass_and_namespace(&self) -> bool { match self { NsKind::NSClassAndNamespace => true, _ => false, } } pub fn is_nsfun(&self) -> bool { match self { NsKind::NSFun => true, _ => false, } } pub fn is_nsconst(&self) -> bool { match self { NsKind::NSConst => true, _ => false, } } } impl ImportFlavor { pub fn mk_include() -> Self { ImportFlavor::Include } pub fn mk_require() -> Self { ImportFlavor::Require } pub fn mk_include_once() -> Self { ImportFlavor::IncludeOnce } pub fn mk_require_once() -> Self { ImportFlavor::RequireOnce } pub fn is_include(&self) -> bool { match self { ImportFlavor::Include => true, _ => false, } } pub fn is_require(&self) -> bool { match self { ImportFlavor::Require => true, _ => false, } } pub fn is_include_once(&self) -> bool { match self { ImportFlavor::IncludeOnce => true, _ => false, } } pub fn is_require_once(&self) -> bool { match self { ImportFlavor::RequireOnce => true, _ => false, } } } impl XhpChild { pub fn mk_child_name(p0: Sid) -> Self { XhpChild::ChildName(p0) } pub fn mk_child_list(p0: Vec<XhpChild>) -> Self { XhpChild::ChildList(p0) } pub fn mk_child_unary(p0: XhpChild, p1: XhpChildOp) -> Self { XhpChild::ChildUnary(Box::new(p0), p1) } pub fn mk_child_binary(p0: XhpChild, p1: XhpChild) -> Self { XhpChild::ChildBinary(Box::new(p0), Box::new(p1)) } pub fn is_child_name(&self) -> bool { match self { XhpChild::ChildName(..) => true, _ => false, } } pub fn is_child_list(&self) -> bool { match self { XhpChild::ChildList(..) => true, _ => false, } } pub fn is_child_unary(&self) -> bool { match self { XhpChild::ChildUnary(..) => true, _ => false, } } pub fn is_child_binary(&self) -> bool { match self { XhpChild::ChildBinary(..) => true, _ => false, } } pub fn as_child_name(&self) -> Option<&Sid> { match self { XhpChild::ChildName(p0) => Some(p0), _ => None, } } pub fn as_child_list(&self) -> Option<&Vec<XhpChild>> { match self { XhpChild::ChildList(p0) => Some(p0), _ => None, } } pub fn as_child_unary(&self) -> Option<(&XhpChild, &XhpChildOp)> { match self { XhpChild::ChildUnary(p0, p1) => Some((&p0, p1)), _ => None, } } pub fn as_child_binary(&self) -> Option<(&XhpChild, &XhpChild)> { match self { XhpChild::ChildBinary(p0, p1) => Some((&p0, &p1)), _ => None, } } pub fn as_child_name_mut(&mut self) -> Option<&mut Sid> { match self { XhpChild::ChildName(p0) => Some(p0), _ => None, } } pub fn as_child_list_mut(&mut self) -> Option<&mut Vec<XhpChild>> { match self { XhpChild::ChildList(p0) => Some(p0), _ => None, } } pub fn as_child_unary_mut(&mut self) -> Option<(&mut XhpChild, &mut XhpChildOp)> { match self { XhpChild::ChildUnary(p0, p1) => Some((p0.as_mut(), p1)), _ => None, } } pub fn as_child_binary_mut(&mut self) -> Option<(&mut XhpChild, &mut XhpChild)> { match self { XhpChild::ChildBinary(p0, p1) => Some((p0.as_mut(), p1.as_mut())), _ => None, } } pub fn as_child_name_into(self) -> Option<Sid> { match self { XhpChild::ChildName(p0) => Some(p0), _ => None, } } pub fn as_child_list_into(self) -> Option<Vec<XhpChild>> { match self { XhpChild::ChildList(p0) => Some(p0), _ => None, } } pub fn as_child_unary_into(self) -> Option<(XhpChild, XhpChildOp)> { match self { XhpChild::ChildUnary(p0, p1) => Some((*p0, p1)), _ => None, } } pub fn as_child_binary_into(self) -> Option<(XhpChild, XhpChild)> { match self { XhpChild::ChildBinary(p0, p1) => Some((*p0, *p1)), _ => None, } } } impl XhpChildOp { pub fn mk_child_star() -> Self { XhpChildOp::ChildStar } pub fn mk_child_plus() -> Self { XhpChildOp::ChildPlus } pub fn mk_child_question() -> Self { XhpChildOp::ChildQuestion } pub fn is_child_star(&self) -> bool { match self { XhpChildOp::ChildStar => true, _ => false, } } pub fn is_child_plus(&self) -> bool { match self { XhpChildOp::ChildPlus => true, _ => false, } } pub fn is_child_question(&self) -> bool { match self { XhpChildOp::ChildQuestion => true, _ => false, } } } impl Hint_ { pub fn mk_hoption(p0: Hint) -> Self { Hint_::Hoption(p0) } pub fn mk_hlike(p0: Hint) -> Self { Hint_::Hlike(p0) } pub fn mk_hfun(p0: HintFun) -> Self { Hint_::Hfun(p0) } pub fn mk_htuple(p0: Vec<Hint>) -> Self { Hint_::Htuple(p0) } pub fn mk_happly(p0: ClassName, p1: Vec<Hint>) -> Self { Hint_::Happly(p0, p1) } pub fn mk_hshape(p0: NastShapeInfo) -> Self { Hint_::Hshape(p0) } pub fn mk_haccess(p0: Hint, p1: Vec<Sid>) -> Self { Hint_::Haccess(p0, p1) } pub fn mk_hsoft(p0: Hint) -> Self { Hint_::Hsoft(p0) } pub fn mk_hrefinement(p0: Hint, p1: Vec<Refinement>) -> Self { Hint_::Hrefinement(p0, p1) } pub fn mk_hany() -> Self { Hint_::Hany } pub fn mk_herr() -> Self { Hint_::Herr } pub fn mk_hmixed() -> Self { Hint_::Hmixed } pub fn mk_hwildcard() -> Self { Hint_::Hwildcard } pub fn mk_hnonnull() -> Self { Hint_::Hnonnull } pub fn mk_habstr(p0: String, p1: Vec<Hint>) -> Self { Hint_::Habstr(p0, p1) } pub fn mk_hvec_or_dict(p0: Option<Hint>, p1: Hint) -> Self { Hint_::HvecOrDict(p0, p1) } pub fn mk_hprim(p0: Tprim) -> Self { Hint_::Hprim(p0) } pub fn mk_hthis() -> Self { Hint_::Hthis } pub fn mk_hdynamic() -> Self { Hint_::Hdynamic } pub fn mk_hnothing() -> Self { Hint_::Hnothing } pub fn mk_hunion(p0: Vec<Hint>) -> Self { Hint_::Hunion(p0) } pub fn mk_hintersection(p0: Vec<Hint>) -> Self { Hint_::Hintersection(p0) } pub fn mk_hfun_context(p0: String) -> Self { Hint_::HfunContext(p0) } pub fn mk_hvar(p0: String) -> Self { Hint_::Hvar(p0) } pub fn is_hoption(&self) -> bool { match self { Hint_::Hoption(..) => true, _ => false, } } pub fn is_hlike(&self) -> bool { match self { Hint_::Hlike(..) => true, _ => false, } } pub fn is_hfun(&self) -> bool { match self { Hint_::Hfun(..) => true, _ => false, } } pub fn is_htuple(&self) -> bool { match self { Hint_::Htuple(..) => true, _ => false, } } pub fn is_happly(&self) -> bool { match self { Hint_::Happly(..) => true, _ => false, } } pub fn is_hshape(&self) -> bool { match self { Hint_::Hshape(..) => true, _ => false, } } pub fn is_haccess(&self) -> bool { match self { Hint_::Haccess(..) => true, _ => false, } } pub fn is_hsoft(&self) -> bool { match self { Hint_::Hsoft(..) => true, _ => false, } } pub fn is_hrefinement(&self) -> bool { match self { Hint_::Hrefinement(..) => true, _ => false, } } pub fn is_hany(&self) -> bool { match self { Hint_::Hany => true, _ => false, } } pub fn is_herr(&self) -> bool { match self { Hint_::Herr => true, _ => false, } } pub fn is_hmixed(&self) -> bool { match self { Hint_::Hmixed => true, _ => false, } } pub fn is_hwildcard(&self) -> bool { match self { Hint_::Hwildcard => true, _ => false, } } pub fn is_hnonnull(&self) -> bool { match self { Hint_::Hnonnull => true, _ => false, } } pub fn is_habstr(&self) -> bool { match self { Hint_::Habstr(..) => true, _ => false, } } pub fn is_hvec_or_dict(&self) -> bool { match self { Hint_::HvecOrDict(..) => true, _ => false, } } pub fn is_hprim(&self) -> bool { match self { Hint_::Hprim(..) => true, _ => false, } } pub fn is_hthis(&self) -> bool { match self { Hint_::Hthis => true, _ => false, } } pub fn is_hdynamic(&self) -> bool { match self { Hint_::Hdynamic => true, _ => false, } } pub fn is_hnothing(&self) -> bool { match self { Hint_::Hnothing => true, _ => false, } } pub fn is_hunion(&self) -> bool { match self { Hint_::Hunion(..) => true, _ => false, } } pub fn is_hintersection(&self) -> bool { match self { Hint_::Hintersection(..) => true, _ => false, } } pub fn is_hfun_context(&self) -> bool { match self { Hint_::HfunContext(..) => true, _ => false, } } pub fn is_hvar(&self) -> bool { match self { Hint_::Hvar(..) => true, _ => false, } } pub fn as_hoption(&self) -> Option<&Hint> { match self { Hint_::Hoption(p0) => Some(p0), _ => None, } } pub fn as_hlike(&self) -> Option<&Hint> { match self { Hint_::Hlike(p0) => Some(p0), _ => None, } } pub fn as_hfun(&self) -> Option<&HintFun> { match self { Hint_::Hfun(p0) => Some(p0), _ => None, } } pub fn as_htuple(&self) -> Option<&Vec<Hint>> { match self { Hint_::Htuple(p0) => Some(p0), _ => None, } } pub fn as_happly(&self) -> Option<(&ClassName, &Vec<Hint>)> { match self { Hint_::Happly(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hshape(&self) -> Option<&NastShapeInfo> { match self { Hint_::Hshape(p0) => Some(p0), _ => None, } } pub fn as_haccess(&self) -> Option<(&Hint, &Vec<Sid>)> { match self { Hint_::Haccess(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hsoft(&self) -> Option<&Hint> { match self { Hint_::Hsoft(p0) => Some(p0), _ => None, } } pub fn as_hrefinement(&self) -> Option<(&Hint, &Vec<Refinement>)> { match self { Hint_::Hrefinement(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_habstr(&self) -> Option<(&String, &Vec<Hint>)> { match self { Hint_::Habstr(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hvec_or_dict(&self) -> Option<(&Option<Hint>, &Hint)> { match self { Hint_::HvecOrDict(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hprim(&self) -> Option<&Tprim> { match self { Hint_::Hprim(p0) => Some(p0), _ => None, } } pub fn as_hunion(&self) -> Option<&Vec<Hint>> { match self { Hint_::Hunion(p0) => Some(p0), _ => None, } } pub fn as_hintersection(&self) -> Option<&Vec<Hint>> { match self { Hint_::Hintersection(p0) => Some(p0), _ => None, } } pub fn as_hfun_context(&self) -> Option<&String> { match self { Hint_::HfunContext(p0) => Some(p0), _ => None, } } pub fn as_hvar(&self) -> Option<&String> { match self { Hint_::Hvar(p0) => Some(p0), _ => None, } } pub fn as_hoption_mut(&mut self) -> Option<&mut Hint> { match self { Hint_::Hoption(p0) => Some(p0), _ => None, } } pub fn as_hlike_mut(&mut self) -> Option<&mut Hint> { match self { Hint_::Hlike(p0) => Some(p0), _ => None, } } pub fn as_hfun_mut(&mut self) -> Option<&mut HintFun> { match self { Hint_::Hfun(p0) => Some(p0), _ => None, } } pub fn as_htuple_mut(&mut self) -> Option<&mut Vec<Hint>> { match self { Hint_::Htuple(p0) => Some(p0), _ => None, } } pub fn as_happly_mut(&mut self) -> Option<(&mut ClassName, &mut Vec<Hint>)> { match self { Hint_::Happly(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hshape_mut(&mut self) -> Option<&mut NastShapeInfo> { match self { Hint_::Hshape(p0) => Some(p0), _ => None, } } pub fn as_haccess_mut(&mut self) -> Option<(&mut Hint, &mut Vec<Sid>)> { match self { Hint_::Haccess(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hsoft_mut(&mut self) -> Option<&mut Hint> { match self { Hint_::Hsoft(p0) => Some(p0), _ => None, } } pub fn as_hrefinement_mut(&mut self) -> Option<(&mut Hint, &mut Vec<Refinement>)> { match self { Hint_::Hrefinement(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_habstr_mut(&mut self) -> Option<(&mut String, &mut Vec<Hint>)> { match self { Hint_::Habstr(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hvec_or_dict_mut(&mut self) -> Option<(&mut Option<Hint>, &mut Hint)> { match self { Hint_::HvecOrDict(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hprim_mut(&mut self) -> Option<&mut Tprim> { match self { Hint_::Hprim(p0) => Some(p0), _ => None, } } pub fn as_hunion_mut(&mut self) -> Option<&mut Vec<Hint>> { match self { Hint_::Hunion(p0) => Some(p0), _ => None, } } pub fn as_hintersection_mut(&mut self) -> Option<&mut Vec<Hint>> { match self { Hint_::Hintersection(p0) => Some(p0), _ => None, } } pub fn as_hfun_context_mut(&mut self) -> Option<&mut String> { match self { Hint_::HfunContext(p0) => Some(p0), _ => None, } } pub fn as_hvar_mut(&mut self) -> Option<&mut String> { match self { Hint_::Hvar(p0) => Some(p0), _ => None, } } pub fn as_hoption_into(self) -> Option<Hint> { match self { Hint_::Hoption(p0) => Some(p0), _ => None, } } pub fn as_hlike_into(self) -> Option<Hint> { match self { Hint_::Hlike(p0) => Some(p0), _ => None, } } pub fn as_hfun_into(self) -> Option<HintFun> { match self { Hint_::Hfun(p0) => Some(p0), _ => None, } } pub fn as_htuple_into(self) -> Option<Vec<Hint>> { match self { Hint_::Htuple(p0) => Some(p0), _ => None, } } pub fn as_happly_into(self) -> Option<(ClassName, Vec<Hint>)> { match self { Hint_::Happly(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hshape_into(self) -> Option<NastShapeInfo> { match self { Hint_::Hshape(p0) => Some(p0), _ => None, } } pub fn as_haccess_into(self) -> Option<(Hint, Vec<Sid>)> { match self { Hint_::Haccess(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hsoft_into(self) -> Option<Hint> { match self { Hint_::Hsoft(p0) => Some(p0), _ => None, } } pub fn as_hrefinement_into(self) -> Option<(Hint, Vec<Refinement>)> { match self { Hint_::Hrefinement(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_habstr_into(self) -> Option<(String, Vec<Hint>)> { match self { Hint_::Habstr(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hvec_or_dict_into(self) -> Option<(Option<Hint>, Hint)> { match self { Hint_::HvecOrDict(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_hprim_into(self) -> Option<Tprim> { match self { Hint_::Hprim(p0) => Some(p0), _ => None, } } pub fn as_hunion_into(self) -> Option<Vec<Hint>> { match self { Hint_::Hunion(p0) => Some(p0), _ => None, } } pub fn as_hintersection_into(self) -> Option<Vec<Hint>> { match self { Hint_::Hintersection(p0) => Some(p0), _ => None, } } pub fn as_hfun_context_into(self) -> Option<String> { match self { Hint_::HfunContext(p0) => Some(p0), _ => None, } } pub fn as_hvar_into(self) -> Option<String> { match self { Hint_::Hvar(p0) => Some(p0), _ => None, } } } impl Refinement { pub fn mk_rctx(p0: Sid, p1: CtxRefinement) -> Self { Refinement::Rctx(p0, p1) } pub fn mk_rtype(p0: Sid, p1: TypeRefinement) -> Self { Refinement::Rtype(p0, p1) } pub fn is_rctx(&self) -> bool { match self { Refinement::Rctx(..) => true, _ => false, } } pub fn is_rtype(&self) -> bool { match self { Refinement::Rtype(..) => true, _ => false, } } pub fn as_rctx(&self) -> Option<(&Sid, &CtxRefinement)> { match self { Refinement::Rctx(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_rtype(&self) -> Option<(&Sid, &TypeRefinement)> { match self { Refinement::Rtype(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_rctx_mut(&mut self) -> Option<(&mut Sid, &mut CtxRefinement)> { match self { Refinement::Rctx(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_rtype_mut(&mut self) -> Option<(&mut Sid, &mut TypeRefinement)> { match self { Refinement::Rtype(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_rctx_into(self) -> Option<(Sid, CtxRefinement)> { match self { Refinement::Rctx(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_rtype_into(self) -> Option<(Sid, TypeRefinement)> { match self { Refinement::Rtype(p0, p1) => Some((p0, p1)), _ => None, } } } impl TypeRefinement { pub fn mk_trexact(p0: Hint) -> Self { TypeRefinement::TRexact(p0) } pub fn mk_trloose(p0: TypeRefinementBounds) -> Self { TypeRefinement::TRloose(p0) } pub fn is_trexact(&self) -> bool { match self { TypeRefinement::TRexact(..) => true, _ => false, } } pub fn is_trloose(&self) -> bool { match self { TypeRefinement::TRloose(..) => true, _ => false, } } pub fn as_trexact(&self) -> Option<&Hint> { match self { TypeRefinement::TRexact(p0) => Some(p0), _ => None, } } pub fn as_trloose(&self) -> Option<&TypeRefinementBounds> { match self { TypeRefinement::TRloose(p0) => Some(p0), _ => None, } } pub fn as_trexact_mut(&mut self) -> Option<&mut Hint> { match self { TypeRefinement::TRexact(p0) => Some(p0), _ => None, } } pub fn as_trloose_mut(&mut self) -> Option<&mut TypeRefinementBounds> { match self { TypeRefinement::TRloose(p0) => Some(p0), _ => None, } } pub fn as_trexact_into(self) -> Option<Hint> { match self { TypeRefinement::TRexact(p0) => Some(p0), _ => None, } } pub fn as_trloose_into(self) -> Option<TypeRefinementBounds> { match self { TypeRefinement::TRloose(p0) => Some(p0), _ => None, } } } impl CtxRefinement { pub fn mk_crexact(p0: Hint) -> Self { CtxRefinement::CRexact(p0) } pub fn mk_crloose(p0: CtxRefinementBounds) -> Self { CtxRefinement::CRloose(p0) } pub fn is_crexact(&self) -> bool { match self { CtxRefinement::CRexact(..) => true, _ => false, } } pub fn is_crloose(&self) -> bool { match self { CtxRefinement::CRloose(..) => true, _ => false, } } pub fn as_crexact(&self) -> Option<&Hint> { match self { CtxRefinement::CRexact(p0) => Some(p0), _ => None, } } pub fn as_crloose(&self) -> Option<&CtxRefinementBounds> { match self { CtxRefinement::CRloose(p0) => Some(p0), _ => None, } } pub fn as_crexact_mut(&mut self) -> Option<&mut Hint> { match self { CtxRefinement::CRexact(p0) => Some(p0), _ => None, } } pub fn as_crloose_mut(&mut self) -> Option<&mut CtxRefinementBounds> { match self { CtxRefinement::CRloose(p0) => Some(p0), _ => None, } } pub fn as_crexact_into(self) -> Option<Hint> { match self { CtxRefinement::CRexact(p0) => Some(p0), _ => None, } } pub fn as_crloose_into(self) -> Option<CtxRefinementBounds> { match self { CtxRefinement::CRloose(p0) => Some(p0), _ => None, } } } impl KvcKind { pub fn mk_map() -> Self { KvcKind::Map } pub fn mk_imm_map() -> Self { KvcKind::ImmMap } pub fn mk_dict() -> Self { KvcKind::Dict } pub fn is_map(&self) -> bool { match self { KvcKind::Map => true, _ => false, } } pub fn is_imm_map(&self) -> bool { match self { KvcKind::ImmMap => true, _ => false, } } pub fn is_dict(&self) -> bool { match self { KvcKind::Dict => true, _ => false, } } } impl VcKind { pub fn mk_vector() -> Self { VcKind::Vector } pub fn mk_imm_vector() -> Self { VcKind::ImmVector } pub fn mk_vec() -> Self { VcKind::Vec } pub fn mk_set() -> Self { VcKind::Set } pub fn mk_imm_set() -> Self { VcKind::ImmSet } pub fn mk_keyset() -> Self { VcKind::Keyset } pub fn is_vector(&self) -> bool { match self { VcKind::Vector => true, _ => false, } } pub fn is_imm_vector(&self) -> bool { match self { VcKind::ImmVector => true, _ => false, } } pub fn is_vec(&self) -> bool { match self { VcKind::Vec => true, _ => false, } } pub fn is_set(&self) -> bool { match self { VcKind::Set => true, _ => false, } } pub fn is_imm_set(&self) -> bool { match self { VcKind::ImmSet => true, _ => false, } } pub fn is_keyset(&self) -> bool { match self { VcKind::Keyset => true, _ => false, } } }
Rust
hhvm/hphp/hack/src/oxidized/impl_gen/ast_defs_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<<55a487601dee782c6c59f502f9a6b6e9>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use crate::ast_defs::*; impl ShapeFieldName { pub fn mk_sflit_int(p0: Pstring) -> Self { ShapeFieldName::SFlitInt(p0) } pub fn mk_sflit_str(p0: PositionedByteString) -> Self { ShapeFieldName::SFlitStr(p0) } pub fn mk_sfclass_const(p0: Id, p1: Pstring) -> Self { ShapeFieldName::SFclassConst(p0, p1) } pub fn is_sflit_int(&self) -> bool { match self { ShapeFieldName::SFlitInt(..) => true, _ => false, } } pub fn is_sflit_str(&self) -> bool { match self { ShapeFieldName::SFlitStr(..) => true, _ => false, } } pub fn is_sfclass_const(&self) -> bool { match self { ShapeFieldName::SFclassConst(..) => true, _ => false, } } pub fn as_sflit_int(&self) -> Option<&Pstring> { match self { ShapeFieldName::SFlitInt(p0) => Some(p0), _ => None, } } pub fn as_sflit_str(&self) -> Option<&PositionedByteString> { match self { ShapeFieldName::SFlitStr(p0) => Some(p0), _ => None, } } pub fn as_sfclass_const(&self) -> Option<(&Id, &Pstring)> { match self { ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_sflit_int_mut(&mut self) -> Option<&mut Pstring> { match self { ShapeFieldName::SFlitInt(p0) => Some(p0), _ => None, } } pub fn as_sflit_str_mut(&mut self) -> Option<&mut PositionedByteString> { match self { ShapeFieldName::SFlitStr(p0) => Some(p0), _ => None, } } pub fn as_sfclass_const_mut(&mut self) -> Option<(&mut Id, &mut Pstring)> { match self { ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)), _ => None, } } pub fn as_sflit_int_into(self) -> Option<Pstring> { match self { ShapeFieldName::SFlitInt(p0) => Some(p0), _ => None, } } pub fn as_sflit_str_into(self) -> Option<PositionedByteString> { match self { ShapeFieldName::SFlitStr(p0) => Some(p0), _ => None, } } pub fn as_sfclass_const_into(self) -> Option<(Id, Pstring)> { match self { ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)), _ => None, } } } impl Variance { pub fn mk_covariant() -> Self { Variance::Covariant } pub fn mk_contravariant() -> Self { Variance::Contravariant } pub fn mk_invariant() -> Self { Variance::Invariant } pub fn is_covariant(&self) -> bool { match self { Variance::Covariant => true, _ => false, } } pub fn is_contravariant(&self) -> bool { match self { Variance::Contravariant => true, _ => false, } } pub fn is_invariant(&self) -> bool { match self { Variance::Invariant => true, _ => false, } } } impl ConstraintKind { pub fn mk_constraint_as() -> Self { ConstraintKind::ConstraintAs } pub fn mk_constraint_eq() -> Self { ConstraintKind::ConstraintEq } pub fn mk_constraint_super() -> Self { ConstraintKind::ConstraintSuper } pub fn is_constraint_as(&self) -> bool { match self { ConstraintKind::ConstraintAs => true, _ => false, } } pub fn is_constraint_eq(&self) -> bool { match self { ConstraintKind::ConstraintEq => true, _ => false, } } pub fn is_constraint_super(&self) -> bool { match self { ConstraintKind::ConstraintSuper => true, _ => false, } } } impl Abstraction { pub fn mk_concrete() -> Self { Abstraction::Concrete } pub fn mk_abstract() -> Self { Abstraction::Abstract } pub fn is_concrete(&self) -> bool { match self { Abstraction::Concrete => true, _ => false, } } pub fn is_abstract(&self) -> bool { match self { Abstraction::Abstract => true, _ => false, } } } impl ClassishKind { pub fn mk_cclass(p0: Abstraction) -> Self { ClassishKind::Cclass(p0) } pub fn mk_cinterface() -> Self { ClassishKind::Cinterface } pub fn mk_ctrait() -> Self { ClassishKind::Ctrait } pub fn mk_cenum() -> Self { ClassishKind::Cenum } pub fn mk_cenum_class(p0: Abstraction) -> Self { ClassishKind::CenumClass(p0) } pub fn is_cclass(&self) -> bool { match self { ClassishKind::Cclass(..) => true, _ => false, } } pub fn is_cinterface(&self) -> bool { match self { ClassishKind::Cinterface => true, _ => false, } } pub fn is_ctrait(&self) -> bool { match self { ClassishKind::Ctrait => true, _ => false, } } pub fn is_cenum(&self) -> bool { match self { ClassishKind::Cenum => true, _ => false, } } pub fn is_cenum_class(&self) -> bool { match self { ClassishKind::CenumClass(..) => true, _ => false, } } pub fn as_cclass(&self) -> Option<&Abstraction> { match self { ClassishKind::Cclass(p0) => Some(p0), _ => None, } } pub fn as_cenum_class(&self) -> Option<&Abstraction> { match self { ClassishKind::CenumClass(p0) => Some(p0), _ => None, } } pub fn as_cclass_mut(&mut self) -> Option<&mut Abstraction> { match self { ClassishKind::Cclass(p0) => Some(p0), _ => None, } } pub fn as_cenum_class_mut(&mut self) -> Option<&mut Abstraction> { match self { ClassishKind::CenumClass(p0) => Some(p0), _ => None, } } pub fn as_cclass_into(self) -> Option<Abstraction> { match self { ClassishKind::Cclass(p0) => Some(p0), _ => None, } } pub fn as_cenum_class_into(self) -> Option<Abstraction> { match self { ClassishKind::CenumClass(p0) => Some(p0), _ => None, } } } impl ParamKind { pub fn mk_pinout(p0: Pos) -> Self { ParamKind::Pinout(p0) } pub fn mk_pnormal() -> Self { ParamKind::Pnormal } pub fn is_pinout(&self) -> bool { match self { ParamKind::Pinout(..) => true, _ => false, } } pub fn is_pnormal(&self) -> bool { match self { ParamKind::Pnormal => true, _ => false, } } pub fn as_pinout(&self) -> Option<&Pos> { match self { ParamKind::Pinout(p0) => Some(p0), _ => None, } } pub fn as_pinout_mut(&mut self) -> Option<&mut Pos> { match self { ParamKind::Pinout(p0) => Some(p0), _ => None, } } pub fn as_pinout_into(self) -> Option<Pos> { match self { ParamKind::Pinout(p0) => Some(p0), _ => None, } } } impl ReadonlyKind { pub fn mk_readonly() -> Self { ReadonlyKind::Readonly } pub fn is_readonly(&self) -> bool { true } } impl OgNullFlavor { pub fn mk_ognullthrows() -> Self { OgNullFlavor::OGNullthrows } pub fn mk_ognullsafe() -> Self { OgNullFlavor::OGNullsafe } pub fn is_ognullthrows(&self) -> bool { match self { OgNullFlavor::OGNullthrows => true, _ => false, } } pub fn is_ognullsafe(&self) -> bool { match self { OgNullFlavor::OGNullsafe => true, _ => false, } } } impl PropOrMethod { pub fn mk_is_prop() -> Self { PropOrMethod::IsProp } pub fn mk_is_method() -> Self { PropOrMethod::IsMethod } pub fn is_is_prop(&self) -> bool { match self { PropOrMethod::IsProp => true, _ => false, } } pub fn is_is_method(&self) -> bool { match self { PropOrMethod::IsMethod => true, _ => false, } } } impl FunKind { pub fn mk_fsync() -> Self { FunKind::FSync } pub fn mk_fasync() -> Self { FunKind::FAsync } pub fn mk_fgenerator() -> Self { FunKind::FGenerator } pub fn mk_fasync_generator() -> Self { FunKind::FAsyncGenerator } pub fn is_fsync(&self) -> bool { match self { FunKind::FSync => true, _ => false, } } pub fn is_fasync(&self) -> bool { match self { FunKind::FAsync => true, _ => false, } } pub fn is_fgenerator(&self) -> bool { match self { FunKind::FGenerator => true, _ => false, } } pub fn is_fasync_generator(&self) -> bool { match self { FunKind::FAsyncGenerator => true, _ => false, } } } impl Bop { pub fn mk_plus() -> Self { Bop::Plus } pub fn mk_minus() -> Self { Bop::Minus } pub fn mk_star() -> Self { Bop::Star } pub fn mk_slash() -> Self { Bop::Slash } pub fn mk_eqeq() -> Self { Bop::Eqeq } pub fn mk_eqeqeq() -> Self { Bop::Eqeqeq } pub fn mk_starstar() -> Self { Bop::Starstar } pub fn mk_diff() -> Self { Bop::Diff } pub fn mk_diff2() -> Self { Bop::Diff2 } pub fn mk_ampamp() -> Self { Bop::Ampamp } pub fn mk_barbar() -> Self { Bop::Barbar } pub fn mk_lt() -> Self { Bop::Lt } pub fn mk_lte() -> Self { Bop::Lte } pub fn mk_gt() -> Self { Bop::Gt } pub fn mk_gte() -> Self { Bop::Gte } pub fn mk_dot() -> Self { Bop::Dot } pub fn mk_amp() -> Self { Bop::Amp } pub fn mk_bar() -> Self { Bop::Bar } pub fn mk_ltlt() -> Self { Bop::Ltlt } pub fn mk_gtgt() -> Self { Bop::Gtgt } pub fn mk_percent() -> Self { Bop::Percent } pub fn mk_xor() -> Self { Bop::Xor } pub fn mk_cmp() -> Self { Bop::Cmp } pub fn mk_question_question() -> Self { Bop::QuestionQuestion } pub fn mk_eq(p0: Option<Box<Bop>>) -> Self { Bop::Eq(p0) } pub fn is_plus(&self) -> bool { match self { Bop::Plus => true, _ => false, } } pub fn is_minus(&self) -> bool { match self { Bop::Minus => true, _ => false, } } pub fn is_star(&self) -> bool { match self { Bop::Star => true, _ => false, } } pub fn is_slash(&self) -> bool { match self { Bop::Slash => true, _ => false, } } pub fn is_eqeq(&self) -> bool { match self { Bop::Eqeq => true, _ => false, } } pub fn is_eqeqeq(&self) -> bool { match self { Bop::Eqeqeq => true, _ => false, } } pub fn is_starstar(&self) -> bool { match self { Bop::Starstar => true, _ => false, } } pub fn is_diff(&self) -> bool { match self { Bop::Diff => true, _ => false, } } pub fn is_diff2(&self) -> bool { match self { Bop::Diff2 => true, _ => false, } } pub fn is_ampamp(&self) -> bool { match self { Bop::Ampamp => true, _ => false, } } pub fn is_barbar(&self) -> bool { match self { Bop::Barbar => true, _ => false, } } pub fn is_lt(&self) -> bool { match self { Bop::Lt => true, _ => false, } } pub fn is_lte(&self) -> bool { match self { Bop::Lte => true, _ => false, } } pub fn is_gt(&self) -> bool { match self { Bop::Gt => true, _ => false, } } pub fn is_gte(&self) -> bool { match self { Bop::Gte => true, _ => false, } } pub fn is_dot(&self) -> bool { match self { Bop::Dot => true, _ => false, } } pub fn is_amp(&self) -> bool { match self { Bop::Amp => true, _ => false, } } pub fn is_bar(&self) -> bool { match self { Bop::Bar => true, _ => false, } } pub fn is_ltlt(&self) -> bool { match self { Bop::Ltlt => true, _ => false, } } pub fn is_gtgt(&self) -> bool { match self { Bop::Gtgt => true, _ => false, } } pub fn is_percent(&self) -> bool { match self { Bop::Percent => true, _ => false, } } pub fn is_xor(&self) -> bool { match self { Bop::Xor => true, _ => false, } } pub fn is_cmp(&self) -> bool { match self { Bop::Cmp => true, _ => false, } } pub fn is_question_question(&self) -> bool { match self { Bop::QuestionQuestion => true, _ => false, } } pub fn is_eq(&self) -> bool { match self { Bop::Eq(..) => true, _ => false, } } pub fn as_eq(&self) -> Option<&Option<Box<Bop>>> { match self { Bop::Eq(p0) => Some(p0), _ => None, } } pub fn as_eq_mut(&mut self) -> Option<&mut Option<Box<Bop>>> { match self { Bop::Eq(p0) => Some(p0), _ => None, } } pub fn as_eq_into(self) -> Option<Option<Box<Bop>>> { match self { Bop::Eq(p0) => Some(p0), _ => None, } } } impl Uop { pub fn mk_utild() -> Self { Uop::Utild } pub fn mk_unot() -> Self { Uop::Unot } pub fn mk_uplus() -> Self { Uop::Uplus } pub fn mk_uminus() -> Self { Uop::Uminus } pub fn mk_uincr() -> Self { Uop::Uincr } pub fn mk_udecr() -> Self { Uop::Udecr } pub fn mk_upincr() -> Self { Uop::Upincr } pub fn mk_updecr() -> Self { Uop::Updecr } pub fn mk_usilence() -> Self { Uop::Usilence } pub fn is_utild(&self) -> bool { match self { Uop::Utild => true, _ => false, } } pub fn is_unot(&self) -> bool { match self { Uop::Unot => true, _ => false, } } pub fn is_uplus(&self) -> bool { match self { Uop::Uplus => true, _ => false, } } pub fn is_uminus(&self) -> bool { match self { Uop::Uminus => true, _ => false, } } pub fn is_uincr(&self) -> bool { match self { Uop::Uincr => true, _ => false, } } pub fn is_udecr(&self) -> bool { match self { Uop::Udecr => true, _ => false, } } pub fn is_upincr(&self) -> bool { match self { Uop::Upincr => true, _ => false, } } pub fn is_updecr(&self) -> bool { match self { Uop::Updecr => true, _ => false, } } pub fn is_usilence(&self) -> bool { match self { Uop::Usilence => true, _ => false, } } } impl Visibility { pub fn mk_private() -> Self { Visibility::Private } pub fn mk_public() -> Self { Visibility::Public } pub fn mk_protected() -> Self { Visibility::Protected } pub fn mk_internal() -> Self { Visibility::Internal } pub fn is_private(&self) -> bool { match self { Visibility::Private => true, _ => false, } } pub fn is_public(&self) -> bool { match self { Visibility::Public => true, _ => false, } } pub fn is_protected(&self) -> bool { match self { Visibility::Protected => true, _ => false, } } pub fn is_internal(&self) -> bool { match self { Visibility::Internal => true, _ => false, } } } impl XhpEnumValue { pub fn mk_xevint(p0: isize) -> Self { XhpEnumValue::XEVInt(p0) } pub fn mk_xevstring(p0: String) -> Self { XhpEnumValue::XEVString(p0) } pub fn is_xevint(&self) -> bool { match self { XhpEnumValue::XEVInt(..) => true, _ => false, } } pub fn is_xevstring(&self) -> bool { match self { XhpEnumValue::XEVString(..) => true, _ => false, } } pub fn as_xevint(&self) -> Option<&isize> { match self { XhpEnumValue::XEVInt(p0) => Some(p0), _ => None, } } pub fn as_xevstring(&self) -> Option<&String> { match self { XhpEnumValue::XEVString(p0) => Some(p0), _ => None, } } pub fn as_xevint_mut(&mut self) -> Option<&mut isize> { match self { XhpEnumValue::XEVInt(p0) => Some(p0), _ => None, } } pub fn as_xevstring_mut(&mut self) -> Option<&mut String> { match self { XhpEnumValue::XEVString(p0) => Some(p0), _ => None, } } pub fn as_xevint_into(self) -> Option<isize> { match self { XhpEnumValue::XEVInt(p0) => Some(p0), _ => None, } } pub fn as_xevstring_into(self) -> Option<String> { match self { XhpEnumValue::XEVString(p0) => Some(p0), _ => None, } } } impl Tprim { pub fn mk_tnull() -> Self { Tprim::Tnull } pub fn mk_tvoid() -> Self { Tprim::Tvoid } pub fn mk_tint() -> Self { Tprim::Tint } pub fn mk_tbool() -> Self { Tprim::Tbool } pub fn mk_tfloat() -> Self { Tprim::Tfloat } pub fn mk_tstring() -> Self { Tprim::Tstring } pub fn mk_tresource() -> Self { Tprim::Tresource } pub fn mk_tnum() -> Self { Tprim::Tnum } pub fn mk_tarraykey() -> Self { Tprim::Tarraykey } pub fn mk_tnoreturn() -> Self { Tprim::Tnoreturn } pub fn is_tnull(&self) -> bool { match self { Tprim::Tnull => true, _ => false, } } pub fn is_tvoid(&self) -> bool { match self { Tprim::Tvoid => true, _ => false, } } pub fn is_tint(&self) -> bool { match self { Tprim::Tint => true, _ => false, } } pub fn is_tbool(&self) -> bool { match self { Tprim::Tbool => true, _ => false, } } pub fn is_tfloat(&self) -> bool { match self { Tprim::Tfloat => true, _ => false, } } pub fn is_tstring(&self) -> bool { match self { Tprim::Tstring => true, _ => false, } } pub fn is_tresource(&self) -> bool { match self { Tprim::Tresource => true, _ => false, } } pub fn is_tnum(&self) -> bool { match self { Tprim::Tnum => true, _ => false, } } pub fn is_tarraykey(&self) -> bool { match self { Tprim::Tarraykey => true, _ => false, } } pub fn is_tnoreturn(&self) -> bool { match self { Tprim::Tnoreturn => true, _ => false, } } } impl TypedefVisibility { pub fn mk_transparent() -> Self { TypedefVisibility::Transparent } pub fn mk_opaque() -> Self { TypedefVisibility::Opaque } pub fn mk_opaque_module() -> Self { TypedefVisibility::OpaqueModule } pub fn mk_case_type() -> Self { TypedefVisibility::CaseType } pub fn is_transparent(&self) -> bool { match self { TypedefVisibility::Transparent => true, _ => false, } } pub fn is_opaque(&self) -> bool { match self { TypedefVisibility::Opaque => true, _ => false, } } pub fn is_opaque_module(&self) -> bool { match self { TypedefVisibility::OpaqueModule => true, _ => false, } } pub fn is_case_type(&self) -> bool { match self { TypedefVisibility::CaseType => true, _ => false, } } } impl ReifyKind { pub fn mk_erased() -> Self { ReifyKind::Erased } pub fn mk_soft_reified() -> Self { ReifyKind::SoftReified } pub fn mk_reified() -> Self { ReifyKind::Reified } pub fn is_erased(&self) -> bool { match self { ReifyKind::Erased => true, _ => false, } } pub fn is_soft_reified(&self) -> bool { match self { ReifyKind::SoftReified => true, _ => false, } } pub fn is_reified(&self) -> bool { match self { ReifyKind::Reified => true, _ => false, } } }
Rust
hhvm/hphp/hack/src/oxidized/impl_gen/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. // // @generated SignedSource<<83c2b8796c29266af09243ccce223f95>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub mod aast_defs_impl_gen; pub mod ast_defs_impl_gen;
Rust
hhvm/hphp/hack/src/oxidized/manual/aast_defs_impl.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 crate::aast_defs::*; use crate::ast_defs::*; use crate::pos::Pos; impl Lid { pub fn new(p: Pos, s: String) -> Self { Self(p, (0, s)) } pub fn from_counter(p: Pos, counter: isize, s: &str) -> Self { Self(p, (counter, String::from(s))) } pub fn name(&self) -> &String { crate::local_id::get_name(&self.1) } pub fn pos(&self) -> &Pos { &self.0 } pub fn as_local_id(&self) -> &LocalId { &self.1 } } impl Hint { pub fn new(p: Pos, h: Hint_) -> Self { Self(p, Box::new(h)) } pub fn as_happly(&self) -> Option<(&Sid, &Vec<Hint>)> { self.1.as_happly() } pub fn is_hlike(&self) -> bool { self.1.is_hlike() } } impl AsRef<Hint> for Hint { fn as_ref(&self) -> &Self { self } } impl AsRef<str> for Id { fn as_ref(&self) -> &str { &self.1 } } impl AsRef<str> for Visibility { fn as_ref(&self) -> &str { use Visibility::*; match self { Private => "private", Public => "public", Protected => "protected", Internal => "internal", } } } impl std::fmt::Display for Visibility { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.as_ref()) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/aast_impl.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::borrow::Cow; use crate::aast::*; use crate::ast_defs; use crate::pos::Pos; macro_rules! vec_wrapper { (<$($tparam:ident),* $(,)?> $ty:ty , $elem:ty) => { impl<$($tparam,)*> $ty { #[inline] pub fn as_slice(&self) -> &[$elem] { self.0.as_slice() } #[inline] pub fn as_mut_slice(&mut self) -> &mut [$elem] { self.0.as_mut_slice() } #[inline] pub fn len(&self) -> usize { self.0.len() } #[inline] pub fn is_empty(&self) -> bool { self.0.is_empty() } #[inline] pub fn push(&mut self, stmt: $elem) { self.0.push(stmt) } #[inline] pub fn insert(&mut self, index: usize, stmt: $elem) { self.0.insert(index, stmt) } #[inline] pub fn drain<R>(&mut self, range: R) -> std::vec::Drain<'_, $elem> where R: std::ops::RangeBounds<usize>, { self.0.drain(range) } #[inline] pub fn clear(&mut self) { self.0.clear() } #[inline] pub fn iter(&self) -> std::slice::Iter<'_, $elem> { self.0.iter() } #[inline] pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, $elem> { self.0.iter_mut() } } impl<$($tparam,)*> IntoIterator for $ty { type Item = $elem; type IntoIter = std::vec::IntoIter<$elem>; #[inline] fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } impl<'a, $($tparam,)*> IntoIterator for &'a $ty { type Item = &'a $elem; type IntoIter = std::slice::Iter<'a, $elem>; #[inline] fn into_iter(self) -> Self::IntoIter { self.iter() } } impl<'a, $($tparam,)*> IntoIterator for &'a mut $ty { type Item = &'a mut $elem; type IntoIter = std::slice::IterMut<'a, $elem>; #[inline] fn into_iter(self) -> Self::IntoIter { self.iter_mut() } } impl<$($tparam,)*> AsRef<[$elem]> for $ty { #[inline] fn as_ref(&self) -> &[$elem] { self.as_slice() } } impl<$($tparam,)*> AsMut<[$elem]> for $ty { #[inline] fn as_mut(&mut self) -> &mut [$elem] { self.as_mut_slice() } } impl<$($tparam,)*> std::borrow::Borrow<[$elem]> for $ty { #[inline] fn borrow(&self) -> &[$elem] { self.as_slice() } } impl<$($tparam,)*> std::borrow::BorrowMut<[$elem]> for $ty { #[inline] fn borrow_mut(&mut self) -> &mut [$elem] { self.as_mut_slice() } } impl<$($tparam,)*> std::ops::Deref for $ty { type Target = [$elem]; #[inline] fn deref(&self) -> &Self::Target { self.as_slice() } } impl<$($tparam,)*> std::ops::DerefMut for $ty { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { self.as_mut_slice() } } impl<I, $($tparam,)*> std::ops::Index<I> for $ty where I: std::slice::SliceIndex<[$elem]> { type Output = <I as std::slice::SliceIndex<[$elem]>>::Output; #[inline] fn index(&self, index: I) -> &Self::Output { std::ops::Index::index(&self.0, index) } } impl<I, $($tparam,)*> std::ops::IndexMut<I> for $ty where I: std::slice::SliceIndex<[$elem]> { #[inline] fn index_mut(&mut self, index: I) -> &mut Self::Output { std::ops::IndexMut::index_mut(&mut self.0, index) } } impl<$($tparam,)*> Default for $ty { #[inline] fn default() -> Self { Self(Default::default()) } } impl<$($tparam,)*> From<Vec<$elem>> for $ty { #[inline] fn from(vec: Vec<$elem>) -> Self { Self(vec) } } impl<$($tparam,)*> From<$ty> for Vec<$elem> { #[inline] fn from(x: $ty) -> Vec<$elem> { x.0 } } impl<$($tparam,)*> FromIterator<$elem> for $ty { #[inline] fn from_iter<I>(iter: I) -> Self where I: IntoIterator<Item = $elem> { Self(Vec::from_iter(iter)) } } impl<$($tparam,)*> Extend<$elem> for $ty { #[inline] fn extend<T>(&mut self, iter: T) where T: IntoIterator<Item = $elem> { self.0.extend(iter) } } } } vec_wrapper!(<Ex, En> Program<Ex, En>, Def<Ex, En>); vec_wrapper!(<Ex, En> Block<Ex, En>, Stmt<Ex, En>); vec_wrapper!(<Ex, En> FinallyBlock<Ex, En>, Stmt<Ex, En>); vec_wrapper!(<Ex, En> UserAttributes<Ex, En>, UserAttribute<Ex, En>); impl<Ex, En> Program<Ex, En> { pub fn defs(&self) -> DefsIterator<'_, Ex, En> { let iter = match self.0.as_slice() { [Def::Namespace(defs)] => defs.1.iter(), _ => self.iter(), }; DefsIterator { stack: vec![iter] } } pub fn first_pos(&self) -> Option<&Pos> { self.iter().find_map(|def| match def { Def::Fun(fd) => Some(fd.name.pos()), Def::Class(class) => Some(class.name.pos()), Def::Stmt(stmt) => Some(&stmt.0), Def::Typedef(td) => Some(td.name.pos()), Def::Constant(gc) => Some(gc.name.pos()), Def::Namespace(ns) => Some(ns.0.pos()), Def::Module(md) => Some(md.name.pos()), Def::SetModule(sid) => Some(sid.pos()), Def::NamespaceUse(sids) => sids.first().map(|(_, sid, _)| sid.pos()), Def::SetNamespaceEnv(..) => None, Def::FileAttributes(fa) => fa.user_attributes.first().map(|ua| ua.name.pos()), }) } } pub struct DefsIterator<'a, Ex, En> { stack: Vec<std::slice::Iter<'a, Def<Ex, En>>>, } impl<'a, Ex, En> Iterator for DefsIterator<'a, Ex, En> { type Item = &'a Def<Ex, En>; #[inline] fn next(&mut self) -> Option<Self::Item> { loop { let iter = match self.stack.last_mut() { Some(iter) => iter, None => return None, }; let def = match iter.next() { Some(def) => def, None => { self.stack.pop(); continue; } }; match def { def @ (Def::Fun(_) | Def::Class(_) | Def::Typedef(_) | Def::Constant(_)) => { return Some(def); } Def::Namespace(defs) => self.stack.push(defs.1.iter()), Def::Stmt(_) | Def::Module(_) | Def::SetModule(_) | Def::NamespaceUse(_) | Def::SetNamespaceEnv(_) | Def::FileAttributes(_) => {} } } } } impl<Ex, En> Stmt<Ex, En> { pub fn new(pos: Pos, s: Stmt_<Ex, En>) -> Self { Self(pos, s) } pub fn noop(pos: Pos) -> Self { Self::new(pos, Stmt_::Noop) } pub fn is_assign_expr(&self) -> bool { if let Some(Expr(_, _, Expr_::Binop(binop))) = &self.1.as_expr() { if let ast_defs::Bop::Eq(_) = binop.as_ref().bop { return true; } } false } pub fn is_declare_local_stmt(&self) -> bool { if let Stmt(_, Stmt_::DeclareLocal(_)) = self { true } else { false } } } impl<Ex, En> Expr<Ex, En> { pub fn new(ex: Ex, pos: Pos, e: Expr_<Ex, En>) -> Self { Self(ex, pos, e) } pub fn pos(&self) -> &Pos { &self.1 } pub fn lvar_name(&self) -> Option<&str> { match &self.2 { Expr_::Lvar(lid) => Some(&(lid.1).1), _ => None, } } pub fn is_import(&self) -> bool { match &self.2 { Expr_::Import(_) => true, _ => false, } } } impl<En> Expr<(), En> { pub fn mk_lvar(p: &Pos, n: &str) -> Self { Self::new( (), p.clone(), Expr_::Lvar(Box::new(Lid(p.clone(), (0, String::from(n))))), ) } pub fn as_class_get(&self) -> Option<(&ClassId<(), En>, &ClassGetExpr<(), En>, &PropOrMethod)> { self.2.as_class_get() } pub fn as_class_const(&self) -> Option<(&ClassId<(), En>, &Pstring)> { self.2.as_class_const() } pub fn as_id(&self) -> Option<&Sid> { self.2.as_id() } } impl<Ex, En> Expr_<Ex, En> { pub fn make_string(s: Vec<u8>) -> Self { Expr_::String(s.into()) } } impl<Ex, En> ClassId<Ex, En> { pub fn annot(&self) -> &Ex { &self.0 } pub fn get(&self) -> &ClassId_<Ex, En> { &self.2 } pub fn as_ciexpr(&self) -> Option<&Expr<Ex, En>> { self.2.as_ciexpr() } } impl<Hi> Targ<Hi> { pub fn hint(&self) -> &Hint { &self.1 } pub fn annot(&self) -> &Hi { &self.0 } } impl<Hi> TypeHint<Hi> { pub fn get_hint(&self) -> &TypeHint_ { &self.1 } } // This wrapper constructor can avoid other crates (HackNative, etc) // depends on ocamlrep. pub fn new_nsenv(env: crate::namespace_env::Env) -> Nsenv { std::sync::Arc::new(env) } impl<Ex, En> Afield<Ex, En> { pub fn value(&self) -> &Expr<Ex, En> { match self { Self::AFvalue(e) => e, Self::AFkvalue(_, e) => e, } } } // TODO(hrust): consider codegen the following impl<Ex: Clone, En: Clone> From<Method_<Ex, En>> for Cow<'_, Method_<Ex, En>> { fn from(x: Method_<Ex, En>) -> Self { Cow::Owned(x) } } impl<'a, Ex: Clone, En: Clone> From<&'a Method_<Ex, En>> for Cow<'a, Method_<Ex, En>> { fn from(x: &'a Method_<Ex, En>) -> Self { Cow::Borrowed(x) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/ast_defs_impl.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 bstr::BStr; use crate::ast_defs::*; use crate::naming_error; use crate::pos::Pos; impl ShapeFieldName { pub fn get_name(&self) -> &BStr { use ShapeFieldName::*; match self { SFlitInt((_, name)) | SFclassConst(_, (_, name)) => name.as_bytes().into(), SFlitStr((_, name)) => name.as_ref(), } } pub fn get_pos(&self) -> &Pos { use ShapeFieldName::*; match self { SFlitInt((p, _)) | SFlitStr((p, _)) | SFclassConst(_, (p, _)) => p, } } } impl FunKind { pub fn is_async(self) -> bool { self == FunKind::FAsync || self == FunKind::FAsyncGenerator } } impl Id { pub fn pos(&self) -> &Pos { &self.0 } pub fn name(&self) -> &str { &self.1 } } #[allow(clippy::derivable_impls)] impl Default for Id { fn default() -> Self { Id(Default::default(), Default::default()) } } impl std::fmt::Debug for Id { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Id({:?}, {:?})", self.pos(), self.name()) } } impl Bop { pub fn is_any_eq(&self) -> bool { match self { Self::Eq(_) => true, _ => false, } } } impl Variance { pub fn negate(&self) -> Self { match self { Variance::Covariant => Variance::Contravariant, Variance::Contravariant => Variance::Covariant, Variance::Invariant => Variance::Invariant, } } } impl From<Visibility> for naming_error::Visibility { fn from(val: Visibility) -> Self { match val { Visibility::Internal => naming_error::Visibility::Vinternal, Visibility::Private => naming_error::Visibility::Vprivate, Visibility::Protected => naming_error::Visibility::Vprotected, Visibility::Public => naming_error::Visibility::Vprivate, } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/blame_set.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::cmp::Ordering; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; use crate::local_id::LocalId; use crate::typing_reason::Blame; #[derive(Clone, Debug, Eq, Hash, Ord)] #[derive(Deserialize, FromOcamlRep, NoPosHash, Serialize, ToOcamlRep)] pub struct IdWithBlame(pub LocalId, Blame); impl PartialEq for IdWithBlame { fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } } impl PartialOrd for IdWithBlame { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { self.0.partial_cmp(&other.0) } } /// A set of LocalIds which treats blame as metadata pub type BlameSet = std::collections::BTreeSet<IdWithBlame>;
Rust
hhvm/hphp/hack/src/oxidized/manual/custom_error_config_impl.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 std::fs::File; use std::io::BufReader; use std::path::Path; use std::str::FromStr; use anyhow::Context; use anyhow::Result; use hash::HashMap; use hash::HashSet; use serde_json; use crate::custom_error::CustomError; use crate::custom_error::VersionedErrorMessage; use crate::custom_error::VersionedPattError; use crate::custom_error_config::CustomErrorConfig; use crate::error_message::Elem; use crate::error_message::ErrorMessage; use crate::patt_binding_ty::PattBindingTy; use crate::patt_error::Callback; use crate::patt_error::PattError; use crate::patt_error::Primary; use crate::patt_error::ReasonsCallback; use crate::patt_error::Secondary; use crate::patt_locl_ty::Params; use crate::patt_locl_ty::PattLoclTy; use crate::patt_locl_ty::Prim; use crate::patt_locl_ty::ShapeField; use crate::patt_locl_ty::ShapeFields; use crate::patt_locl_ty::ShapeLabel; use crate::patt_name::Namespace; use crate::patt_name::PattName; use crate::patt_string::PattString; use crate::validation_err::ValidationErr; impl CustomErrorConfig { pub fn new(mut errors: Vec<CustomError>) -> Self { let invalid = errors .drain_filter(|e| { let mut env = ValidationEnv::default(); !e.validate(&mut env) }) .collect(); Self { valid: errors, invalid, } } pub fn from_path(path: &Path) -> Result<CustomErrorConfig> { if path.exists() { let file = File::open(path).with_context(|| path.display().to_string())?; let reader = BufReader::new(file); let errors = serde_json::from_reader(reader)?; Ok(Self::new(errors)) } else { Ok(Self::default()) } } } impl Default for CustomErrorConfig { fn default() -> Self { Self { valid: vec![], invalid: vec![], } } } impl FromStr for CustomErrorConfig { type Err = anyhow::Error; fn from_str(contents: &str) -> Result<Self, Self::Err> { let errors: Vec<CustomError> = serde_json::from_str(contents)?; Ok(Self::new(errors)) } } // -- Trait for types that can be validated ------------------------------------ pub trait Validatable { fn validate(&mut self, env: &mut ValidationEnv) -> bool; } trait Invalidatable { fn invalidate(&mut self, errs: &[ValidationErr]); } // -- Validation environment --------------------------------------------------- #[derive(Debug, Default, Clone)] pub struct ValidationEnv(HashMap<String, PattBindingTy>); impl ValidationEnv { fn add(&mut self, name: &str, ty: PattBindingTy) -> Option<ValidationErr> { if self.0.contains_key(name) { Some(ValidationErr::Shadowed(name.to_string())) } else { self.0.insert(name.to_string(), ty); None } } fn get(&self, name: &str) -> Option<&PattBindingTy> { self.0.get(name) } fn join(&mut self, other: &Self) -> (Vec<ValidationErr>, Vec<ValidationErr>) { let mut errs1 = vec![]; let mut errs2 = vec![]; let ks1: HashSet<_> = self.0.keys().cloned().collect(); let ks2: HashSet<_> = other.0.keys().cloned().collect(); ks1.union(&ks2) .for_each(|k| match (self.0.get(k), other.0.get(k)) { (Some(PattBindingTy::Name), Some(PattBindingTy::Name)) => (), (Some(PattBindingTy::Ty), Some(PattBindingTy::Ty)) => (), (Some(l), Some(r)) => errs2.push(ValidationErr::Mismatch(l.clone(), r.clone())), (Some(_), _) => errs2.push(ValidationErr::Unbound(k.to_string())), (_, Some(b)) => { self.0.insert(k.to_string(), b.clone()); errs1.push(ValidationErr::Unbound(k.to_string())) } _ => panic!("Impossible"), }); (errs1, errs2) } } // -- Individual errors -------------------------------------------------------- impl Validatable for VersionedErrorMessage { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::MessageV1(msg) => msg.validate(env), } } } impl Validatable for VersionedPattError { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::ErrorV1(msg) => msg.validate(env), } } } impl Validatable for CustomError { fn validate(&mut self, env: &mut ValidationEnv) -> bool { self.patt.validate(env) && self.error_message.validate(env) } } // -- Error patterns ----------------------------------------------------------- impl Validatable for PattError { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::Invalid { .. } => false, Self::Primary(prim) => prim.validate(env), Self::Apply { cb, err } => cb.validate(env) && err.validate(env), Self::ApplyReasons { rsns_cb, secondary } => { rsns_cb.validate(env) && secondary.validate(env) } Self::Or { fst, snd } => { let mut env_snd = env.clone(); let fst_valid = fst.validate(env); let snd_valid = snd.validate(&mut env_snd); // Determine the errors in the left- and right-hand side patterns // and add bindings present in the right but not the left side // to the environment let (errs_fst, errs_snd) = env.join(&env_snd); // Wrap the left and right side in an invalid marker based on the // join errors fst.invalidate(&errs_fst); snd.invalidate(&errs_snd); fst_valid && snd_valid && errs_fst.is_empty() && errs_snd.is_empty() } } } } impl Invalidatable for PattError { fn invalidate(&mut self, errs_in: &[ValidationErr]) { if !errs_in.is_empty() { match self { Self::Invalid { errs, .. } => errs.extend(errs_in.to_vec()), _ => { let patt = std::mem::replace(self, PattError::Primary(Primary::AnyPrim)); *self = PattError::Invalid { errs: errs_in.to_vec(), patt: Box::new(patt), }; } } } } } impl Validatable for Secondary { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::AnySnd => true, Self::OfError(err) => err.validate(env), Self::ViolatedConstraint { cstr, ty_sub, ty_sup, } => cstr.validate(env) && ty_sub.validate(env) && ty_sup.validate(env), Self::SubtypingError { sub, sup } => sub.validate(env) && sup.validate(env), } } } impl Validatable for Primary { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } impl Validatable for Callback { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } impl Validatable for ReasonsCallback { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } // -- Type patterns ------------------------------------------------------------ impl Validatable for PattLoclTy { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::Invalid(..) => false, Self::Dynamic | Self::Nonnull | Self::Any => true, Self::Apply { name, params } => name.validate(env) && params.validate(env), Self::Prim(prim) => prim.validate(env), Self::Shape(fields) => fields.validate(env), Self::Option(patt) => patt.validate(env), Self::Tuple(patts) => patts.validate(env), Self::As { lbl, patt } => { let errs = env.add(lbl, PattBindingTy::Ty).map_or(vec![], |e| vec![e]); let valid = patt.validate(env); self.invalidate(&errs); valid && errs.is_empty() } Self::Or { fst, snd } => { let mut env_snd = env.clone(); let fst_valid = fst.validate(env); let snd_valid = snd.validate(&mut env_snd); // Determine the errors in the left- and right-hand side patterns // and add bindings present in the right but not the left side // to the environment let (errs_fst, errs_snd) = env.join(&env_snd); // Wrap the left and right side in an invalid marker based on the // join errors fst.invalidate(&errs_fst); snd.invalidate(&errs_snd); fst_valid && snd_valid && errs_fst.is_empty() && errs_snd.is_empty() } } } } impl Invalidatable for PattLoclTy { fn invalidate(&mut self, errs_in: &[ValidationErr]) { if !errs_in.is_empty() { match self { Self::Invalid(errs, _patt) => errs.extend(errs_in.to_vec()), _ => { let patt = std::mem::replace(self, PattLoclTy::Any); *self = PattLoclTy::Invalid(errs_in.to_vec(), Box::new(patt)); } } } } } impl Validatable for Params { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::Nil | Self::Wildcard => true, Self::Exists(patt) => patt.validate(env), Self::Cons { hd, tl } => hd.validate(env) && tl.validate(env), } } } impl Validatable for Prim { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } impl Validatable for ShapeLabel { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } impl Validatable for ShapeField { fn validate(&mut self, env: &mut ValidationEnv) -> bool { self.lbl.validate(env) && self.patt.validate(env) } } impl Validatable for ShapeFields { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::Fld { fld, rest } => fld.validate(env) && rest.validate(env), Self::Open | Self::Closed => true, } } } // -- Name patterns ------------------------------------------------------------ impl Validatable for PattName { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::As { lbl, patt } => { let errs = env .add(lbl, PattBindingTy::Name) .map_or(vec![], |e| vec![e]); let valid = patt.validate(env); self.invalidate(&errs); valid && errs.is_empty() } Self::Name { namespace, name } => namespace.validate(env) && name.validate(env), Self::Invalid { .. } => false, Self::Wildcard => true, } } } impl Invalidatable for PattName { fn invalidate(&mut self, errs_in: &[ValidationErr]) { if !errs_in.is_empty() { match self { Self::Invalid { errs, .. } => errs.extend(errs_in.to_vec()), _ => { let patt = std::mem::replace(self, PattName::Wildcard); *self = PattName::Invalid { errs: errs_in.to_vec(), patt: Box::new(patt), }; } } } } } impl Validatable for Namespace { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } // -- String patterns ---------------------------------------------------------- impl Validatable for PattString { fn validate(&mut self, _env: &mut ValidationEnv) -> bool { true } } // -- Error messages ----------------------------------------------------------- impl Validatable for ErrorMessage { fn validate(&mut self, env: &mut ValidationEnv) -> bool { self.message.validate(env) } } impl Validatable for Elem { fn validate(&mut self, env: &mut ValidationEnv) -> bool { match self { Self::TyVar(name) => matches!(env.get(name), Some(PattBindingTy::Ty)), Self::NameVar(name) => matches!(env.get(name), Some(PattBindingTy::Name)), Self::Lit(_) => true, } } } // -- Trait helpers ------------------------------------------------------------ impl<T> Validatable for Box<T> where T: Validatable, { fn validate(&mut self, env: &mut ValidationEnv) -> bool { (**self).validate(env) } } impl<T> Validatable for Vec<T> where T: Validatable, { fn validate(&mut self, env: &mut ValidationEnv) -> bool { let mut valid = true; for x in self { valid &= x.validate(env); } valid } } // -- Tests -------------------------------------------------------------------- #[cfg(test)] mod tests { use super::*; #[test] fn test_validate_ty_unbound_right() { let fst = Box::new(PattLoclTy::As { lbl: "x".to_string(), patt: Box::new(PattLoclTy::Dynamic), }); let snd = Box::new(PattLoclTy::Nonnull); let mut patt = PattLoclTy::Or { fst, snd }; let mut env = ValidationEnv::default(); let valid = patt.validate(&mut env); assert!(!valid); assert!(matches!( patt, PattLoclTy::Or { snd: box PattLoclTy::Invalid(..), .. } )); } #[test] fn test_validate_ty_unbound_left() { let snd = Box::new(PattLoclTy::As { lbl: "x".to_string(), patt: Box::new(PattLoclTy::Dynamic), }); let fst = Box::new(PattLoclTy::Nonnull); let mut patt = PattLoclTy::Or { fst, snd }; let mut env = ValidationEnv::default(); let valid = patt.validate(&mut env); assert!(!valid); assert!(matches!( patt, PattLoclTy::Or { fst: box PattLoclTy::Invalid(..), .. } )); } #[test] fn test_validate_ty_shadow() { let name = PattName::As { lbl: "x".to_string(), patt: Box::new(PattName::Name { namespace: Namespace::Root, name: PattString::Exactly("Classy".to_string()), }), }; let hd = PattLoclTy::As { lbl: "x".to_string(), patt: Box::new(PattLoclTy::Dynamic), }; let tl = Box::new(Params::Nil); let params = Box::new(Params::Cons { hd, tl }); let mut patt = PattLoclTy::Apply { name, params }; let valid = patt.validate(&mut ValidationEnv::default()); assert!(!valid); assert!(matches!( patt, PattLoclTy::Apply { params: box Params::Cons { hd: PattLoclTy::Invalid(..), .. }, .. } )) } #[test] fn test_validate_ty_mismatch() { let name = PattName::As { lbl: "x".to_string(), patt: Box::new(PattName::Name { namespace: Namespace::Root, name: PattString::Exactly("Classy".to_string()), }), }; let hd = PattLoclTy::Dynamic; let tl = Box::new(Params::Nil); let params = Box::new(Params::Cons { hd, tl }); let fst = Box::new(PattLoclTy::Apply { name, params }); let snd = Box::new(PattLoclTy::As { lbl: "x".to_string(), patt: Box::new(PattLoclTy::Dynamic), }); let mut patt = PattLoclTy::Or { fst, snd }; let valid = patt.validate(&mut ValidationEnv::default()); assert!(!valid); assert!(matches!( patt, PattLoclTy::Or { snd: box PattLoclTy::Invalid(..), .. } )); } }
Rust
hhvm/hphp/hack/src/oxidized/manual/decl_counters.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. pub type TracingInfo = ();
Rust
hhvm/hphp/hack/src/oxidized/manual/decl_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. pub type Env = ();
Rust
hhvm/hphp/hack/src/oxidized/manual/decl_parser_options_impl.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 parser_core_types::parser_env::ParserEnv; use crate::decl_parser_options::DeclParserOptions; use crate::parser_options::ParserOptions; impl Default for DeclParserOptions { fn default() -> Self { Self::from_parser_options(&ParserOptions::default()) } } impl DeclParserOptions { pub fn from_parser_options(opts: &ParserOptions) -> Self { Self { auto_namespace_map: opts.po_auto_namespace_map.clone(), disable_xhp_element_mangling: opts.po_disable_xhp_element_mangling, interpret_soft_types_as_like_types: opts.po_interpret_soft_types_as_like_types, allow_new_attribute_syntax: opts.po_allow_new_attribute_syntax, enable_xhp_class_modifier: opts.po_enable_xhp_class_modifier, everything_sdt: opts.tco_everything_sdt, php5_compat_mode: false, hhvm_compat_mode: false, keep_user_attributes: false, } } } impl From<&DeclParserOptions> for ParserEnv { fn from(opts: &DeclParserOptions) -> Self { Self { hhvm_compat_mode: opts.hhvm_compat_mode, php5_compat_mode: opts.php5_compat_mode, disable_xhp_element_mangling: opts.disable_xhp_element_mangling, interpret_soft_types_as_like_types: opts.interpret_soft_types_as_like_types, allow_new_attribute_syntax: opts.allow_new_attribute_syntax, enable_xhp_class_modifier: opts.enable_xhp_class_modifier, ..Default::default() } } } #[cfg(test)] mod test { #[test] fn test_default_opts() { // Make sure ParserOptions and DeclParserOptions defaults don't drift // even if someone hand-edits or auto-derives Default for DeclParserOptions. assert_eq!( super::DeclParserOptions::default(), super::DeclParserOptions::from_parser_options(&Default::default()) ); } }
Rust
hhvm/hphp/hack/src/oxidized/manual/direct_decl_parser.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 no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use shallow_decl_defs::Decl; use crate::file_info; use crate::file_info::NameType; use crate::shallow_decl_defs; use crate::typing_defs; /// WARNING: This type has not undergone the processing that you often expect in the typechecker, /// e.g. deregistering PHPStdLib symbols, or putting into forward lexical order, or removing /// duplicates. It's often a good idea to use ParsedFileWithHashes instead (or rather, one of /// its wrappers). /// NB: Must keep in sync with OCaml type Direct_decl_parser.parsed_file #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Deserialize, FromOcamlRep, NoPosHash, Serialize, ToOcamlRep)] pub struct ParsedFile { /// Was the file Hack or HHI? pub mode: Option<file_info::Mode>, pub file_attributes: Vec<typing_defs::UserAttribute>, pub decls: Decls, /// How did the parser handle xhp elements? This is a copy of /// the setting from DeclParserOptions, for use when converting /// Decls to Facts. pub disable_xhp_element_mangling: bool, /// True if the FFP detected parse errors while parsing. Other parse errors /// are detected in a second pass over the CST, and this field does not /// indicate whether errors would be detected in that second pass. pub has_first_pass_parse_errors: bool, } /// This is a store of decls. It allows iteration of decls in forward lexical order, /// and you can .rev() to iterate in reverse lexical order. /// By construction, you can safely trust that whoever constructed this object has explicitly /// passed `deregister_php_stdlib`, which we hope and trust they got from .hhconfig. #[derive(Clone, Debug)] pub struct ParsedFileWithHashes { pub mode: Option<file_info::Mode>, /// `file_decls_hash` is computed before php stdlib decls and duplicates /// are removed, as is computed over the decls in reverse lexical order /// (the hash is order-sensitive) pub file_decls_hash: hh24_types::FileDeclsHash, /// Decls along with a position insensitive hash. Internally they're stored in reverse /// lexical order. The choice of what to go into this list (remove dupes? remove php_stdlib /// in hhi files? transform class decls by removing php_stdlib members?) is determined /// by how it was constructed. The field is private: the only way to access it /// are through accessors .iter() and .into_iter(), which give the illusion of it being /// in forward lexical order. pub decls: Vec<(String, Decl, hh24_types::DeclHash)>, } impl ParsedFileWithHashes { pub fn new( parsed_file: ParsedFile, deregister_php_stdlib_if_hhi: bool, prefix: relative_path::Prefix, ) -> Self { let file_decls_hash = hh24_types::FileDeclsHash::from_u64( hh_hash::position_insensitive_hash(&parsed_file.decls), ); // Note: parsed_file.decls is in reverse lexical order, and our self.decls must // also be in reverse lexical order, so that as `OcamlReverseParsedFileWithHashes` // we ffi correctly to ocaml. let decls = parsed_file .decls .into_iter() .filter_map(|(name, mut decl)| { if deregister_php_stdlib_if_hhi && prefix == relative_path::Prefix::Hhi { match filter_php_stdlib_decls(decl) { Some(altered_decl) => decl = altered_decl, None => return None, } } let hash = hh24_types::DeclHash::from_u64(hh_hash::hash(&decl)); Some((name, decl, hash)) }) .collect(); Self { mode: parsed_file.mode, file_decls_hash, decls, } } /// This method is a code smell. It shows that the caller didn't take into account /// the .hhconfig flag `deregister_php_stdlib`. pub fn new_without_deregistering_do_not_use(parsed_file: ParsedFile) -> Self { let file_decls_hash = hh24_types::FileDeclsHash::from_u64( hh_hash::position_insensitive_hash(&parsed_file.decls), ); let decls = parsed_file .decls .into_iter() .map(|(name, decl)| { let hash = hh24_types::DeclHash::from_u64(hh_hash::hash(&decl)); (name, decl, hash) }) .collect(); Self { mode: parsed_file.mode, file_decls_hash, decls, } } /// This iterates the decls in forward lexical order /// (Use iter().rev() if you want reverse order) pub fn iter(&self) -> impl DoubleEndedIterator<Item = &(String, Decl, hh24_types::DeclHash)> { // Note that our `self.decls` are stored in reverse order, so we have to reverse now. self.decls.iter().rev() } } impl IntoIterator for ParsedFileWithHashes { type Item = (String, Decl, hh24_types::DeclHash); type IntoIter = std::iter::Rev<std::vec::IntoIter<Self::Item>>; /// This iterates the decls in forward lexical order /// (Use into_iter().rev() if you want reverse order) fn into_iter(self) -> Self::IntoIter { // Note that our `self.decls` are stored in reverse order, so we have to reverse now. self.decls.into_iter().rev() } } // NB: Must keep in sync with OCaml type Direct_decl_parser.decls #[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Deserialize, FromOcamlRep, NoPosHash, Serialize, ToOcamlRep)] pub struct Decls(pub Vec<(String, Decl)>); /// WARNING! These decls do not respect the `deregister_php_stdlib` flag in .hhconfig, /// and are in reverse declaration order, and have not been de-duped. You should /// probably be consuming ParsedFileWithHashes instead. impl Decls { pub fn empty() -> Self { Self(Vec::new()) } pub fn get(&self, kind: NameType, symbol: &str) -> Option<&Decl> { self.iter().find_map(|(name, decl)| { if decl.kind() == kind && name == symbol { Some(decl) } else { None } }) } pub fn add(&mut self, name: String, decl: Decl) { self.0.push((name, decl)) } pub fn rev(&mut self) { self.0.reverse() } pub fn iter(&self) -> impl Iterator<Item = &(String, Decl)> { self.0.iter() } pub fn classes(&self) -> impl Iterator<Item = (&str, &shallow_decl_defs::ShallowClass)> { self.iter().filter_map(|(name, decl)| match decl { Decl::Class(decl) => Some((name.as_str(), decl)), Decl::Fun(_) | Decl::Typedef(_) | Decl::Const(_) | Decl::Module(_) => None, }) } pub fn funs(&self) -> impl Iterator<Item = (&str, &typing_defs::FunElt)> { self.iter().filter_map(|(name, decl)| match decl { Decl::Fun(decl) => Some((name.as_str(), decl)), Decl::Class(_) | Decl::Typedef(_) | Decl::Const(_) | Decl::Module(_) => None, }) } pub fn typedefs(&self) -> impl Iterator<Item = (&str, &typing_defs::TypedefType)> { self.iter().filter_map(|(name, decl)| match decl { Decl::Typedef(decl) => Some((name.as_str(), decl)), Decl::Class(_) | Decl::Fun(_) | Decl::Const(_) | Decl::Module(_) => None, }) } pub fn consts(&self) -> impl Iterator<Item = (&str, &typing_defs::ConstDecl)> { self.iter().filter_map(|(name, decl)| match decl { Decl::Const(decl) => Some((name.as_str(), decl)), Decl::Class(_) | Decl::Fun(_) | Decl::Typedef(_) | Decl::Module(_) => None, }) } pub fn types(&self) -> impl Iterator<Item = &(String, Decl)> { self.iter().filter(|(_, decl)| match decl.kind() { NameType::Class | NameType::Typedef => true, NameType::Fun | NameType::Const | NameType::Module => false, }) } pub fn modules(&self) -> impl Iterator<Item = (&str, &typing_defs::ModuleDefType)> { self.iter().filter_map(|(name, decl)| match decl { Decl::Module(decl) => Some((name.as_str(), decl)), _ => None, }) } } // c.f. `hphp/hack/src/providers/direct_decl_utils.ml` fn filter_php_stdlib_decls(decl: Decl) -> Option<Decl> { use crate::method_flags::MethodFlags; use crate::prop_flags::PropFlags; match decl { Decl::Fun(f) if f.php_std_lib => None, Decl::Class(c) if (c.user_attributes.iter()).any(|ua| ua.name.1 == "__PHPStdLib") => None, Decl::Class(mut c) => { (c.props).retain(|p| !p.flags.contains(PropFlags::PHP_STD_LIB)); (c.sprops).retain(|p| !p.flags.contains(PropFlags::PHP_STD_LIB)); (c.methods).retain(|m| !m.flags.contains(MethodFlags::PHP_STD_LIB)); (c.static_methods).retain(|m| !m.flags.contains(MethodFlags::PHP_STD_LIB)); Some(Decl::Class(c)) } _ => Some(decl), } } impl IntoIterator for Decls { type Item = (String, Decl); type IntoIter = std::vec::IntoIter<Self::Item>; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } impl std::fmt::Debug for Decls { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fmt.debug_map() .entries(self.iter().map(|(k, v)| (k, v))) .finish() } }
Rust
hhvm/hphp/hack/src/oxidized/manual/errors_impl.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::cmp::Ordering; use crate::errors::*; use crate::message::Message; use crate::pos::Pos; use crate::quickfix::Edit; use crate::quickfix::QfPos; use crate::quickfix::Quickfix; use crate::user_error::UserError; impl<PP, P> UserError<PP, P> { pub fn new( code: ErrorCode, claim: Message<PP>, reasons: Vec<Message<P>>, custom_msgs: Vec<String>, quickfixes: Vec<Quickfix<PP>>, ) -> Self { Self { code, claim, reasons, quickfixes, custom_msgs, is_fixmed: false, } } pub fn pos(&self) -> &PP { let Message(pos, _msg) = &self.claim; pos } pub fn msg(&self) -> &bstr::BStr { let Message(_, msg) = &self.claim; msg.as_ref() } pub fn code(&self) -> ErrorCode { self.code } } impl<PP: Ord + FileOrd, P: Ord + FileOrd> UserError<PP, P> { // Intended to match the implementation of `compare` in `Errors.sort` in OCaml. pub fn cmp_impl(&self, other: &Self, by_phase: bool) -> Ordering { let Self { code: self_code, claim: Message(self_pos, self_msg), reasons: self_reasons, custom_msgs: _, quickfixes: _, is_fixmed: _, } = self; let Self { code: other_code, claim: Message(other_pos, other_msg), reasons: other_reasons, custom_msgs: _, quickfixes: _, is_fixmed: _, } = other; let compare_code = |self_code: ErrorCode, other_code: ErrorCode| { if by_phase { (self_code / 1000).cmp(&{ other_code / 1000 }) } else { self_code.cmp(&other_code) } }; // The primary sort order is by file of the claim (main message). self_pos .cmp_file(other_pos) // If the files are the same, sort by error code or phase, depending on parameter. .then(compare_code(*self_code, *other_code)) // If the phases are the same, sort by position. .then(self_pos.cmp(other_pos)) // If the positions are the same, sort by claim message text. .then(self_msg.cmp(other_msg)) // If the claim message text is the same, compare the reason // messages (which contain further explanation for the error // reported in the claim message). .then(self_reasons.iter().cmp(other_reasons.iter())) } } pub trait FileOrd { fn cmp_file(&self, other: &Self) -> Ordering; } impl FileOrd for Pos { fn cmp_file(&self, other: &Self) -> Ordering { self.filename().cmp(other.filename()) } } impl<PP: Ord + FileOrd, P: Ord + FileOrd> Ord for UserError<PP, P> { fn cmp(&self, other: &Self) -> Ordering { self.cmp_impl(other, false) } } impl<PP: Ord + FileOrd, P: Ord + FileOrd> PartialOrd for UserError<PP, P> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp_impl(other, false)) } } impl Naming { pub fn fd_name_already_bound(p: Pos) -> Error { UserError::new( Self::FdNameAlreadyBound as isize, Message(p, "Field name already bound".into()), vec![], vec![], vec![], ) } pub fn bad_builtin_type(p: Pos, name: &str, correct_name: &str) -> Error { UserError::new( Self::InvalidBuiltinType as isize, Message( p.clone(), format!("No such type `{}`, did you mean `{}`?", name, correct_name).into(), ), vec![], vec![], vec![Quickfix { title: format!("Change to `{}`", correct_name), edits: vec![Edit(correct_name.into(), QfPos::Qpos(p))], }], ) } pub fn method_needs_visibility(first_token_p: Pos, name_p: Pos) -> Error { // Create a zero width position at the start of the first token. let file = first_token_p.filename_rc(); let mut p_span = first_token_p.to_raw_span(); p_span.end = p_span.start; let fix_pos = Pos::from_raw_span(file, p_span); UserError::new( Self::MethodNeedsVisibility as isize, Message( name_p, "Methods need to be marked `public`, `private`, or `protected`.".into(), ), vec![], vec![], vec![ Quickfix { title: "Add `private` modifier".into(), edits: vec![Edit("private ".into(), QfPos::Qpos(fix_pos.clone()))], }, Quickfix { title: "Add `protected` modifier".into(), edits: vec![Edit("protected ".into(), QfPos::Qpos(fix_pos.clone()))], }, Quickfix { title: "Add `public` modifier".into(), edits: vec![Edit("public ".into(), QfPos::Qpos(fix_pos))], }, ], ) } pub fn unsupported_trait_use_as(p: Pos) -> Error { UserError::new( Self::UnsupportedTraitUseAs as isize, Message( p, "Trait use as is a PHP feature that is unsupported in Hack".into(), ), vec![], vec![], vec![], ) } pub fn unsupported_instead_of(p: Pos) -> Error { UserError::new( Self::UnsupportedInsteadOf as isize, Message( p, "insteadof is a PHP feature that is unsupported in Hack".into(), ), vec![], vec![], vec![], ) } } impl NastCheck { pub fn not_abstract_without_typeconst(p: Pos) -> Error { UserError::new( Self::NotAbstractWithoutTypeconst as isize, Message( p, "This type constant is not declared as abstract, it must have an assigned type" .into(), ), vec![], vec![], vec![], ) } pub fn multiple_xhp_category(p: Pos) -> Error { UserError::new( Self::MultipleXhpCategory as isize, Message( p, "XHP classes can only contain one category declaration".into(), ), vec![], vec![], vec![], ) } pub fn partially_abstract_typeconst_definition(p: Pos, kind: &str) -> Error { UserError::new( Self::PartiallyAbstractTypeconstDefinition as isize, Message( p, format!( "`{}` constraints are only legal on abstract type constants", kind ) .into(), ), vec![], vec![], vec![], ) } } #[derive(Debug)] pub struct ParseFormatError; impl std::str::FromStr for Format { type Err = ParseFormatError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "context" => Ok(Self::Context), "raw" => Ok(Self::Raw), "highlighted" => Ok(Self::Highlighted), "plain" => Ok(Self::Plain), _ => Err(ParseFormatError), } } } impl std::fmt::Display for Format { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Context => "context".fmt(f), Self::Raw => "raw".fmt(f), Self::Highlighted => "highlighted".fmt(f), Self::Plain => "plain".fmt(f), } } } impl std::error::Error for ParseFormatError {} impl std::fmt::Display for ParseFormatError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { "Unrecognized error format".fmt(f) } } impl Default for Format { fn default() -> Self { Format::Plain } }
Rust
hhvm/hphp/hack/src/oxidized/manual/full_fidelity_parser_env_impl.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 parser_core_types::parser_env::ParserEnv; use crate::full_fidelity_parser_env::FullFidelityParserEnv; impl From<FullFidelityParserEnv> for ParserEnv { fn from(env: FullFidelityParserEnv) -> Self { Self { hhvm_compat_mode: env.hhvm_compat_mode, php5_compat_mode: env.php5_compat_mode, codegen: env.codegen, allow_new_attribute_syntax: env.allow_new_attribute_syntax, enable_xhp_class_modifier: env.enable_xhp_class_modifier, disable_xhp_element_mangling: env.disable_xhp_element_mangling, disable_xhp_children_declarations: env.disable_xhp_children_declarations, interpret_soft_types_as_like_types: env.interpret_soft_types_as_like_types, } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/global_options_impl.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 crate::custom_error_config::CustomErrorConfig; use crate::gen::global_options::GlobalOptions; use crate::gen::global_options::SavedState; use crate::gen::global_options::SavedStateLoading; use crate::gen::package_info::PackageInfo; use crate::gen::saved_state_rollouts::SavedStateRollouts; use crate::i_set; use crate::s_map; use crate::s_set; impl Default for SavedStateLoading { fn default() -> Self { Self { saved_state_manifold_api_key: None, log_saved_state_age_and_distance: false, use_manifold_cython_client: false, } } } impl Default for SavedState { fn default() -> Self { Self { loading: SavedStateLoading::default(), rollouts: SavedStateRollouts::default(), project_metadata_w_flags: true, } } } impl Default for GlobalOptions { fn default() -> Self { Self { tco_saved_state: SavedState::default(), tco_experimental_features: s_set::SSet::new(), tco_migration_flags: s_set::SSet::new(), 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: vec![], po_codegen: false, po_deregister_php_stdlib: false, po_disallow_toplevel_requires: false, po_allow_unstable_features: false, // true in /etc/hh.conf tco_log_large_fanouts_threshold: None, tco_log_inference_constraints: false, tco_language_feature_logging: false, tco_timeout: 0, tco_disallow_invalid_arraykey: false, // true in ocaml, true in .hhconfig tco_disallow_byref_dynamic_calls: false, tco_disallow_byref_calls: true, code_agnostic_fixme: false, allowed_fixme_codes_strict: i_set::ISet::new(), log_levels: s_map::SMap::new(), po_disable_lval_as_an_expression: false, // true in ocaml 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: CustomErrorConfig::default(), po_enable_class_level_where_clauses: false, po_disable_legacy_soft_typehints: true, po_allowed_decl_fixme_codes: i_set::ISet::new(), 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, po_disallow_func_ptrs_in_constants: false, tco_error_php_lambdas: false, tco_disallow_discarded_nullable_awaitables: false, po_enable_xhp_class_modifier: false, // true in ocaml po_disable_xhp_element_mangling: false, // true in ocaml po_disable_xhp_children_declarations: false, // true in ocaml po_keep_user_attributes: false, glean_reponame: String::new(), // "www.autocomplete" in ocaml symbol_write_index_inherited_members: true, symbol_write_ownership: false, symbol_write_root_path: String::new(), // "www" in ocaml symbol_write_hhi_path: String::new(), // "hhi" in ocaml symbol_write_ignore_paths: vec![], symbol_write_index_paths: vec![], symbol_write_index_paths_file: None, symbol_write_include_hhi: false, symbol_write_index_paths_file_output: None, symbol_write_sym_hash_in: None, symbol_write_exclude_out: None, symbol_write_referenced_out: None, symbol_write_sym_hash_out: false, po_disable_hh_ignore_error: 0, 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: vec![], 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_modules: false, tco_enable_expression_trees: false, tco_allowed_expression_tree_visitors: vec![], 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: false, tco_allowed_files_for_module_declarations: vec![], 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::default(), po_unwrap_concurrent: false, tco_log_exhaustivity_check: false, } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/ident.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. pub type Ident = isize;
Rust
hhvm/hphp/hack/src/oxidized/manual/internal_type_set.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 crate::typing_defs::InternalType; pub type ITySet = std::collections::BTreeSet<InternalType>;
Rust
hhvm/hphp/hack/src/oxidized/manual/i_map.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. pub type IMap<T> = std::collections::BTreeMap<isize, T>;
Rust
hhvm/hphp/hack/src/oxidized/manual/i_set.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. pub type ISet = std::collections::BTreeSet<isize>;
Rust
hhvm/hphp/hack/src/oxidized/manual/lazy.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 eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Clone, Debug, Deserialize, Eq, Hash, EqModuloPos, NoPosHash, Ord, PartialEq, PartialOrd, Serialize )] pub struct Lazy<T>(pub T); impl<T: ToOcamlRep> ToOcamlRep for Lazy<T> { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { unimplemented!() } } impl<T: FromOcamlRep> FromOcamlRep for Lazy<T> { fn from_ocamlrep(_value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { unimplemented!() } }
Rust
hhvm/hphp/hack/src/oxidized/manual/local_id.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. pub type LocalId = (isize, String); pub fn make_unscoped(name: impl Into<String>) -> LocalId { (0, name.into()) } pub mod map { pub type Map<T> = std::collections::BTreeMap<super::LocalId, T>; } pub mod set { pub type Set = std::collections::BTreeSet<super::LocalId>; } pub fn get_name((_, name): &LocalId) -> &String { name }
Rust
hhvm/hphp/hack/src/oxidized/manual/local_id_map.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 no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRep, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] pub struct LocalIdMap<Ex>(pub crate::local_id::map::Map<Ex>);
Rust
hhvm/hphp/hack/src/oxidized/manual/method_flags.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 bitflags::bitflags; use eq_modulo_pos::EqModuloPos; // NB: Keep the values of these flags in sync with shallow_decl_defs.ml. bitflags! { #[derive(EqModuloPos)] pub struct MethodFlags: u8 { const ABSTRACT = 1 << 0; const FINAL = 1 << 1; const OVERRIDE = 1 << 2; const DYNAMICALLYCALLABLE = 1 << 3; const PHP_STD_LIB = 1 << 4; const SUPPORT_DYNAMIC_TYPE = 1 << 5; } } impl MethodFlags { pub fn is_abstract(&self) -> bool { self.contains(Self::ABSTRACT) } pub fn is_final(&self) -> bool { self.contains(Self::FINAL) } pub fn is_dynamicallycallable(&self) -> bool { self.contains(Self::DYNAMICALLYCALLABLE) } pub fn is_override(&self) -> bool { self.contains(Self::OVERRIDE) } pub fn supports_dynamic_type(&self) -> bool { self.contains(Self::SUPPORT_DYNAMIC_TYPE) } } impl ocamlrep::ToOcamlRep for MethodFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for MethodFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for MethodFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for MethodFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for MethodFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u8(self.bits()) } } impl<'de> serde::Deserialize<'de> for MethodFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = MethodFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u8 for MethodFlags") } fn visit_u8<E: serde::de::Error>(self, value: u8) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u8::try_from(value).expect("expect an u8, but got u64"), )) } } deserializer.deserialize_u8(Visitor) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/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. pub use crate::gen::aast_defs as aast; pub mod aast_defs_impl; pub mod aast_impl; pub mod ast_defs_impl; pub mod custom_error_config_impl; pub mod direct_decl_parser; pub mod errors_impl; pub mod global_options_impl; pub mod i_map; pub mod i_set; pub mod ident; pub mod internal_type_set; pub mod lazy; pub mod local_id; pub mod local_id_map; pub mod method_flags; pub mod namespace_env_impl; pub mod package_info_impl; pub mod prop_flags; pub mod s_map; pub mod s_set; pub mod saved_state_rollouts_impl; pub mod scoured_comments_impl; pub mod shallow_decl_defs_impl; pub mod shape_map; pub mod symbol_name; pub mod t_shape_map; pub mod tany_sentinel; pub mod typing_defs_core_impl; pub mod typing_defs_flags; pub mod typing_env; pub mod typing_logic; pub mod typing_reason_impl; pub mod typing_set; mod decl_parser_options_impl; mod full_fidelity_parser_env_impl; mod naming_phase_error_impl;
Rust
hhvm/hphp/hack/src/oxidized/manual/namespace_env_impl.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 hh_autoimport_rust as hh_autoimport; use crate::gen::namespace_env::Env; impl Env { pub fn empty( auto_ns_map: Vec<(String, String)>, is_codegen: bool, disable_xhp_element_mangling: bool, ) -> Self { let mut ns_uses = hh_autoimport::NAMESPACES_MAP.clone(); auto_ns_map.iter().for_each(|(k, v)| { ns_uses.insert(k.into(), v.into()); }); Env { ns_uses, class_uses: hh_autoimport::TYPES_MAP.clone(), fun_uses: hh_autoimport::FUNCS_MAP.clone(), const_uses: hh_autoimport::CONSTS_MAP.clone(), name: None, is_codegen, disable_xhp_element_mangling, } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/naming_phase_error_impl.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 crate::naming_error::NamingError; use crate::naming_phase_error::ExperimentalFeature; use crate::naming_phase_error::NamingPhaseError; use crate::nast_check_error::NastCheckError; use crate::parsing_error::ParsingError; impl From<NamingError> for NamingPhaseError { fn from(err: NamingError) -> Self { Self::Naming(err) } } impl From<NastCheckError> for NamingPhaseError { fn from(err: NastCheckError) -> Self { Self::NastCheck(err) } } impl From<ExperimentalFeature> for NamingPhaseError { fn from(err: ExperimentalFeature) -> Self { Self::ExperimentalFeature(err) } } impl From<ParsingError> for NamingPhaseError { fn from(err: ParsingError) -> Self { Self::Parsing(err) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/package_info_impl.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 crate::gen::package_info::PackageInfo; use crate::manual::s_map::SMap; impl Default for PackageInfo { fn default() -> Self { Self { glob_to_package: SMap::default(), existing_packages: SMap::default(), } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/prop_flags.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 bitflags::bitflags; use eq_modulo_pos::EqModuloPos; // NB: Keep the values of these flags in sync with shallow_decl_defs.ml. bitflags! { #[derive(EqModuloPos)] pub struct PropFlags: u16 { const ABSTRACT = 1 << 0; const CONST = 1 << 1; const LATEINIT = 1 << 2; const LSB = 1 << 3; const NEEDS_INIT = 1 << 4; const PHP_STD_LIB = 1 << 5; const READONLY = 1 << 6; const SAFE_GLOBAL_VARIABLE = 1 << 7; const NO_AUTO_LIKES = 1 << 8; } } impl PropFlags { pub fn is_abstract(&self) -> bool { self.contains(Self::ABSTRACT) } pub fn is_const(&self) -> bool { self.contains(Self::CONST) } pub fn is_lateinit(&self) -> bool { self.contains(Self::LATEINIT) } pub fn is_readonly(&self) -> bool { self.contains(Self::READONLY) } pub fn needs_init(&self) -> bool { self.contains(Self::NEEDS_INIT) } pub fn is_lsb(&self) -> bool { self.contains(Self::LSB) } pub fn is_safe_global_variable(&self) -> bool { self.contains(Self::SAFE_GLOBAL_VARIABLE) } pub fn no_auto_likes(&self) -> bool { self.contains(Self::NO_AUTO_LIKES) } } impl ocamlrep::ToOcamlRep for PropFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for PropFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for PropFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for PropFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for PropFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u16(self.bits()) } } impl<'de> serde::Deserialize<'de> for PropFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = PropFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u8 for PropFlags") } fn visit_u16<E: serde::de::Error>(self, value: u16) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u16::try_from(value).expect("expect an u16, but got u64"), )) } } deserializer.deserialize_u8(Visitor) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/saved_state_rollouts_impl.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 std::fmt::Debug; use crate::gen::saved_state_rollouts::Flag; use crate::gen::saved_state_rollouts::FlagName; use crate::gen::saved_state_rollouts::SavedStateRollouts; impl Default for SavedStateRollouts { fn default() -> Self { Self::make(isize::MIN, false, None, |_| Ok(false)).expect("default had errors") } } /* 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. What follows allows to restrict the number of possible combinations per www revision to just two (one for the production saved state, one for the candidate saved state). We specify a rollout order below, and .hhconfig provides current_saved_state_rollout_flag_index = N which specifies which flag is currently being rolled out for that www revision using that order (current_saved_state_rollout_flag_index is an integer). Only that flag 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 there values set to true, while flags whose order is greater are yet to be rollout and therefore have their values set to false. */ impl Flag { /// These need to be specified manually instead of auto-numbering /// because we want the indices to stay consistent when we remove flags. pub fn rollout_order(&self) -> isize { match self { Self::DummyOne => 0, Self::DummyTwo => 1, Self::DummyThree => 2, Self::NoAncestorEdges => 3, } } pub fn flag_name(&self) -> &'static str { match self { Self::DummyOne => "dummy_one", Self::DummyTwo => "dummy_two", Self::DummyThree => "dummy_three", Self::NoAncestorEdges => "no_ancestor_edges", } } } impl SavedStateRollouts { pub fn make( current_rolled_out_flag_idx: isize, deactivate_saved_state_rollout: bool, force_flag_value: Option<&str>, mut get_default: impl FnMut(&str) -> Result<bool, std::str::ParseBoolError>, ) -> Result<Self, RolloutsError> { use std::cmp::Ordering; let force_prod_or_candidate = ForcedFlags::parse(force_flag_value)?; let mut get_flag_value = |flag: Flag| { let i = flag.rollout_order(); let flag_name = flag.flag_name(); match current_rolled_out_flag_idx.cmp(&i) { Ordering::Equal => match force_prod_or_candidate.rollout_flag_value() { Some(b) => Ok(b), None => { if deactivate_saved_state_rollout { Ok(false) } else { get_default(flag_name) } } }, Ordering::Less => { // This flag will be rolled out next, set to false unless forced to true. Ok(force_prod_or_candidate.is_forced(flag_name)) } Ordering::Greater => { // This flag has already been rolled out Ok(true) } } }; Ok(Self { dummy_one: get_flag_value(Flag::DummyOne)?, dummy_two: get_flag_value(Flag::DummyTwo)?, dummy_three: get_flag_value(Flag::DummyThree)?, no_ancestor_edges: get_flag_value(Flag::NoAncestorEdges)?, }) } } /// This enum handles the config flag 'ss_force', which can have the following values: /// * 'prod' or 'production' /// * 'candidate' /// * 'prod_with_flag_on:my_flag_name' or 'production_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 for testing /// (with 'prod_with_flag_on:my_flag_name') enum ForcedFlags { Prod(Option<FlagName>), Candidate, None, } impl ForcedFlags { /// Parse value of config flag 'ss_force' fn parse(force_flag_value: Option<&str>) -> Result<Self, RolloutsError> { match force_flag_value { None => Ok(Self::None), Some("production" | "prod") => Ok(Self::Prod(None)), Some("candidate") => Ok(Self::Candidate), Some(forced) => match &forced.split(':').collect::<Vec<_>>()[..] { ["prod_with_flag_on" | "production_with_flag_on", forced_flag] => { Ok(Self::Prod(Some(forced_flag.to_string()))) } _ => Err(RolloutsError::ForceFlagError(forced.into())), }, } } /// Return the forced value of the current rollout flag, if any. /// Returning None means there is no forcing. fn rollout_flag_value(&self) -> Option<bool> { match self { Self::Prod(_) => Some(false), Self::Candidate => Some(true), Self::None => None, } } /// Whether a specific flag is forced to be on. fn is_forced(&self, flag_name: &str) -> bool { match self { Self::Prod(Some(forced)) => forced == flag_name, Self::Prod(None) | Self::Candidate | Self::None => false, } } } #[derive(Debug, thiserror::Error)] pub enum RolloutsError { #[error("Error parsing flag: {0}")] FlagError(#[from] std::str::ParseBoolError), #[error("Invalid value for flag ss_force: {0}")] ForceFlagError(String), }
Rust
hhvm/hphp/hack/src/oxidized/manual/scoured_comments_impl.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 crate::errors::ErrorCode; use crate::i_map::IMap; use crate::pos::Pos; use crate::scoured_comments::Fixmes; use crate::scoured_comments::ScouredComments; impl ScouredComments { pub fn new() -> Self { ScouredComments { comments: vec![], fixmes: IMap::new(), misuses: IMap::new(), error_pos: vec![], bad_ignore_pos: vec![], } } pub fn get_fixme(&self, pos: &Pos, code: ErrorCode) -> Option<&Pos> { let line = pos.info_pos().0 as isize; self.fixmes.get(&line).and_then(|m| m.get(&code)) } pub fn add_to_fixmes(&mut self, line: isize, code: isize, pos: Pos) { Self::add(&mut self.fixmes, line, code, pos) } pub fn add_to_misuses(&mut self, line: isize, code: isize, pos: Pos) { Self::add(&mut self.misuses, line, code, pos) } pub fn add_format_error(&mut self, pos: Pos) { self.error_pos.push(pos); } pub fn add_disallowed_ignore(&mut self, pos: Pos) { self.bad_ignore_pos.push(pos); } fn add(m: &mut Fixmes, line: isize, code: isize, pos: Pos) { match m.get_mut(&line) { None => { let mut code_to_pos = IMap::new(); code_to_pos.insert(code, pos); m.insert(line, code_to_pos); } Some(code_to_pos) => { code_to_pos.insert(code, pos); } } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/shallow_decl_defs_impl.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 crate::file_info::NameType; use crate::shallow_decl_defs::Decl; impl Decl { pub fn kind(&self) -> NameType { match self { Decl::Class(..) => NameType::Class, Decl::Fun(..) => NameType::Fun, Decl::Typedef(..) => NameType::Typedef, Decl::Const(..) => NameType::Const, Decl::Module(..) => NameType::Module, } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/shape_map.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::cmp::Ordering; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; use crate::ast_defs::Id; use crate::ast_defs::ShapeFieldName; #[derive(Clone, Debug, Deserialize, FromOcamlRep, ToOcamlRep, Serialize)] pub struct ShapeField(pub ShapeFieldName); impl Ord for ShapeField { fn cmp(&self, other: &Self) -> Ordering { use ShapeFieldName as SFN; match (&self.0, &other.0) { (SFN::SFlitInt((_, s1)), SFN::SFlitInt((_, s2))) => s1.cmp(s2), (SFN::SFlitStr((_, s1)), SFN::SFlitStr((_, s2))) => s1.cmp(s2), (SFN::SFclassConst(Id(_, c1), (_, m1)), SFN::SFclassConst(Id(_, c2), (_, m2))) => { (c1, m1).cmp(&(c2, m2)) } (SFN::SFlitInt(_), _) => Ordering::Less, (SFN::SFlitStr(_), SFN::SFlitInt(_)) => Ordering::Greater, (SFN::SFlitStr(_), _) => Ordering::Less, (SFN::SFclassConst(_, _), _) => Ordering::Greater, } } } impl PartialOrd for ShapeField { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) } } impl PartialEq for ShapeField { fn eq(&self, other: &Self) -> bool { self.cmp(other) == Ordering::Equal } } impl Eq for ShapeField {} // non-derived impl Hash because PartialEq and Eq are non-derived impl std::hash::Hash for ShapeField { fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) { self.0.hash(hasher) } } pub type ShapeMap<T> = std::collections::BTreeMap<ShapeField, T>;
Rust
hhvm/hphp/hack/src/oxidized/manual/symbol_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. pub mod fun_set { pub type FunSet = std::collections::BTreeSet<String>; } pub mod type_set { pub type TypeSet = std::collections::BTreeSet<String>; } pub mod const_set { pub type ConstSet = std::collections::BTreeSet<String>; } pub mod i_fun { pub type IFun = String; } pub mod i_type { pub type IType = String; } pub mod i_const { pub type IConst = String; }
Rust
hhvm/hphp/hack/src/oxidized/manual/s_map.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. pub type SMap<T> = std::collections::BTreeMap<String, T>;
Rust
hhvm/hphp/hack/src/oxidized/manual/s_set.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. pub type SSet = std::collections::BTreeSet<String>;
Rust
hhvm/hphp/hack/src/oxidized/manual/tany_sentinel.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 eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Copy, Clone, Debug, Deserialize, Eq, EqModuloPos, Hash, NoPosHash, Ord, PartialEq, PartialOrd, FromOcamlRep, FromOcamlRepIn, ToOcamlRep, Serialize )] pub struct TanySentinel;
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_defs_core_impl.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 crate::ast_defs::Id; use crate::pos::Pos; use crate::typing_defs_core::ConsistentKind; use crate::typing_defs_core::PosId; use crate::typing_defs_core::Ty; use crate::typing_defs_core::Ty_; use crate::typing_reason::Reason; impl From<Id> for PosId { fn from(Id(pos, id): Id) -> Self { (pos, id) } } impl ConsistentKind { /// If the parent's constructor is consistent via `<<__ConsistentConstruct>>`, /// then we want to carry this forward even if the child is final. Example: /// /// ``` /// <<__ConsistentConstruct>> /// class C { /// public static function f(): void { /// new static(); /// } /// } /// final class D<reify T> extends C {} /// ``` /// /// Even though D's consistency locally comes from the fact that D was /// declared as a final class, calling `new static()` via `D::f` will cause /// a runtime exception because D has reified generics. /// /// c.f. OCaml function `Decl_utils.coalesce_consistent` pub fn coalesce(parent: Self, current: Self) -> Self { match parent { Self::Inconsistent => current, Self::ConsistentConstruct => parent, // This case is unreachable in a correct program, because parent // would have to be a final class Self::FinalClass => parent, } } } impl Ty { pub fn get_reason(&self) -> &Reason { &self.0 } pub fn get_pos(&self) -> Option<&Pos> { self.get_reason().pos() } pub fn get_node(&self) -> &Ty_ { &self.1 } } impl std::fmt::Debug for Ty_ { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { use Ty_::*; match self { Tthis => write!(f, "Tthis"), Tapply(id, tys) => f.debug_tuple("Tapply").field(id).field(tys).finish(), Trefinement(ty, rs) => f.debug_tuple("Trefinement").field(ty).field(rs).finish(), Taccess(taccess) => f.debug_tuple("Taccess").field(taccess).finish(), Tmixed => write!(f, "Tmixed"), Twildcard => write!(f, "Twildcard"), Tlike(ty) => f.debug_tuple("Tlike").field(ty).finish(), Tany(_) => write!(f, "Tany"), Tnonnull => write!(f, "Tnonnull"), Tdynamic => write!(f, "Tdynamic"), TunappliedAlias(name) => write!(f, "TunappliedAlias({:?})", name), Toption(ty) => f.debug_tuple("Toption").field(ty).finish(), Tprim(tprim) => write!(f, "Tprim({:?})", tprim), Tneg(tprim) => write!(f, "Tneg({:?})", tprim), Tfun(fun_type) => f.debug_tuple("Tfun").field(fun_type).finish(), Ttuple(tys) => f.debug_tuple("Ttuple").field(tys).finish(), Tshape(shape) => f.debug_tuple("Tshape").field(shape).finish(), Tvar(ident) => f.debug_tuple("Tvar").field(ident).finish(), Tgeneric(name, tys) => write!(f, "Tgeneric({:?}, {:?})", name, tys), Tunion(tys) => f.debug_tuple("Tunion").field(tys).finish(), Tintersection(tys) => f.debug_tuple("Tintersection").field(tys).finish(), TvecOrDict(tk, tv) => f.debug_tuple("TvecOrDict").field(tk).field(tv).finish(), Tnewtype(name, tys, constraint) => f .debug_tuple("Tnewtype") .field(name) .field(tys) .field(constraint) .finish(), Tdependent(dependent_type, ty) => f .debug_tuple("Tdependent") .field(dependent_type) .field(ty) .finish(), Tclass(id, exact, tys) => f .debug_tuple("Tclass") .field(id) .field(exact) .field(tys) .finish(), } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_defs_flags.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 bitflags::bitflags; use eq_modulo_pos::EqModuloPos; use crate::xhp_attribute; use crate::xhp_attribute::XhpAttribute; // NB: Keep the values of these flags in sync with typing_defs_flags.ml. bitflags! { #[derive(EqModuloPos)] pub struct FunTypeFlags: u16 { const RETURN_DISPOSABLE = 1 << 0; const RETURNS_MUTABLE = 1 << 1; const RETURNS_VOID_TO_RX = 1 << 2; const IS_COROUTINE = 1 << 3; const ASYNC = 1 << 4; const GENERATOR = 1 << 5; // These flags apply to the self type on methods. const MUTABLE_FLAGS_OWNED = 1 << 6; const MUTABLE_FLAGS_BORROWED = 1 << 7; const MUTABLE_FLAGS_MAYBE = Self::MUTABLE_FLAGS_OWNED.bits | Self::MUTABLE_FLAGS_BORROWED.bits; const MUTABLE_FLAGS_MASK = Self::MUTABLE_FLAGS_OWNED.bits | Self::MUTABLE_FLAGS_BORROWED.bits; const INSTANTIATED_TARGS = 1 << 8; const IS_FUNCTION_POINTER = 1 << 9; const RETURNS_READONLY = 1 << 10; const READONLY_THIS = 1 << 11; const SUPPORT_DYNAMIC_TYPE = 1 << 12; const IS_MEMOIZED = 1 << 13; const VARIADIC = 1 << 14; } } bitflags! { #[derive(EqModuloPos)] pub struct FunParamFlags: u16 { const ACCEPT_DISPOSABLE = 1 << 0; const INOUT = 1 << 1; const HAS_DEFAULT = 1 << 2; const IFC_EXTERNAL = 1 << 3; const IFC_CAN_CALL = 1 << 4; // const VIA_LABEL_DEPRECATED = 1 << 5; // These flags apply to the parameter type. const MUTABLE_FLAGS_OWNED = 1 << 6; const MUTABLE_FLAGS_BORROWED = 1 << 7; const MUTABLE_FLAGS_MAYBE = Self::MUTABLE_FLAGS_OWNED.bits | Self::MUTABLE_FLAGS_BORROWED.bits; const MUTABLE_FLAGS_MASK = Self::MUTABLE_FLAGS_OWNED.bits | Self::MUTABLE_FLAGS_BORROWED.bits; const READONLY = 1 << 8; } } bitflags! { #[derive(EqModuloPos)] pub struct ClassEltFlags: u16 { const ABSTRACT = 1 << 0; const FINAL = 1 << 1; const SUPERFLUOUS_OVERRIDE = 1 << 2; //Whether the __Override attribute is erroneous, i.e. there is // nothing in parents to override. This is set during decling // (because that's the easiest place to spot this error) so // that an error can be emitted later during typing. const LSB = 1 << 3; const SYNTHESIZED = 1 << 4; const CONST = 1 << 5; const LATEINIT = 1 << 6; const DYNAMICALLYCALLABLE = 1 << 7; const SUPPORT_DYNAMIC_TYPE = 1 << 8; const XA_HAS_DEFAULT = 1 << 9; const XA_TAG_REQUIRED = 1 << 10; const XA_TAG_LATEINIT = 1 << 11; const READONLY_PROP = 1 << 12; const NEEDS_INIT = 1 << 13; const SAFE_GLOBAL_VARIABLE = 1 << 14; const XA_FLAGS_MASK = Self::XA_HAS_DEFAULT.bits | Self::XA_TAG_REQUIRED.bits | Self::XA_TAG_LATEINIT.bits; } } #[derive(Copy, Clone, Debug)] pub struct ClassEltFlagsArgs { pub xhp_attr: Option<XhpAttribute>, pub is_abstract: bool, pub is_final: bool, pub is_superfluous_override: bool, pub is_lsb: bool, pub is_synthesized: bool, pub is_const: bool, pub is_lateinit: bool, pub is_dynamicallycallable: bool, pub is_readonly_prop: bool, pub supports_dynamic_type: bool, pub needs_init: bool, pub safe_global_variable: bool, } impl From<xhp_attribute::Tag> for ClassEltFlags { fn from(tag: xhp_attribute::Tag) -> Self { use xhp_attribute::Tag; match tag { Tag::Required => Self::XA_TAG_REQUIRED, Tag::LateInit => Self::XA_TAG_LATEINIT, } } } impl From<Option<XhpAttribute>> for ClassEltFlags { fn from(xhp_attr: Option<XhpAttribute>) -> Self { let mut flags = Self::empty(); if let Some(XhpAttribute { tag, has_default }) = xhp_attr { if let Some(tag) = tag { flags.insert(Self::from(tag)); } else { flags.insert(Self::XA_TAG_REQUIRED | Self::XA_TAG_LATEINIT); } if has_default { flags.insert(Self::XA_HAS_DEFAULT); } } flags } } impl ClassEltFlags { pub fn new(args: ClassEltFlagsArgs) -> Self { let ClassEltFlagsArgs { xhp_attr, is_abstract, is_final, is_superfluous_override, is_lsb, is_synthesized, is_const, is_lateinit, is_dynamicallycallable, is_readonly_prop, supports_dynamic_type, needs_init, safe_global_variable, } = args; let mut flags = Self::empty(); flags.set(Self::ABSTRACT, is_abstract); flags.set(Self::FINAL, is_final); flags.set(Self::SUPERFLUOUS_OVERRIDE, is_superfluous_override); flags.set(Self::LSB, is_lsb); flags.set(Self::SYNTHESIZED, is_synthesized); flags.set(Self::CONST, is_const); flags.set(Self::LATEINIT, is_lateinit); flags.set(Self::DYNAMICALLYCALLABLE, is_dynamicallycallable); flags.set_xhp_attr(xhp_attr); flags.set(Self::READONLY_PROP, is_readonly_prop); flags.set(Self::SUPPORT_DYNAMIC_TYPE, supports_dynamic_type); flags.set(Self::NEEDS_INIT, needs_init); flags.set(Self::SAFE_GLOBAL_VARIABLE, safe_global_variable); flags } pub fn get_xhp_attr(&self) -> Option<XhpAttribute> { use xhp_attribute::Tag; if self.intersection(Self::XA_FLAGS_MASK).is_empty() { return None; } let has_default = self.contains(Self::XA_HAS_DEFAULT); let tag = match ( self.contains(Self::XA_TAG_REQUIRED), self.contains(Self::XA_TAG_LATEINIT), ) { (true, false) => Some(Tag::Required), (false, true) => Some(Tag::LateInit), // If both `XaTagRequired` and `XaTagLateinit` bits are set then // that's code for tag = None. (true, true) | (false, false) => None, }; Some(XhpAttribute { tag, has_default }) } fn set_xhp_attr(&mut self, xa: Option<XhpAttribute>) { self.remove(Self::XA_FLAGS_MASK); self.insert(Self::from(xa)); } } // This alias is only necessary because of how typing_defs.rs is // generated (T111144107). TODO(SF, 2022-02-01): Change // `typing_defs_flags.ml` so that this is no longer necessary. pub mod class_elt { use super::ClassEltFlags; pub type ClassElt = ClassEltFlags; } impl ocamlrep::ToOcamlRep for ClassEltFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for ClassEltFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for ClassEltFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for ClassEltFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for ClassEltFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u16(self.bits()) } } impl<'de> serde::Deserialize<'de> for ClassEltFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = ClassEltFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u16 for ClassEltFlags") } fn visit_u16<E: serde::de::Error>(self, value: u16) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u16::try_from(value).expect("expect an u16, but got u64"), )) } } deserializer.deserialize_u16(Visitor) } } impl ocamlrep::ToOcamlRep for FunTypeFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for FunTypeFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for FunTypeFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for FunTypeFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for FunTypeFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u16(self.bits()) } } impl<'de> serde::Deserialize<'de> for FunTypeFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = FunTypeFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u16 for FunTypeFlags") } fn visit_u16<E: serde::de::Error>(self, value: u16) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u16::try_from(value).expect("expect an u16, but got u64"), )) } } deserializer.deserialize_u16(Visitor) } } impl ocamlrep::ToOcamlRep for FunParamFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for FunParamFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for FunParamFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for FunParamFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for FunParamFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u16(self.bits()) } } impl<'de> serde::Deserialize<'de> for FunParamFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = FunParamFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u16 for FunParamFlags") } fn visit_u16<E: serde::de::Error>(self, value: u16) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u16::try_from(value).expect("expect an u16, but got u64"), )) } } deserializer.deserialize_u16(Visitor) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_env.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.
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_logic.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 no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; use crate::typing_defs::*; /// The reason why something is expected to have a certain type /// This has to be defined manually (not in oxidized/gen) because there is a function type in the original /// definition of Disj /// @TODO: work out what to do about this! #[derive( Clone, Debug, Deserialize, Eq, Hash, FromOcamlRep, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] pub enum SubtypeProp { Coerce(Ty, Ty), IsSubtype(InternalType, InternalType), Conj(Vec<SubtypeProp>), Disj(Vec<SubtypeProp>), } impl Default for SubtypeProp { fn default() -> Self { Self::Disj(vec![]) } }
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_reason_impl.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 crate::pos::Pos; use crate::typing_reason::*; impl Reason { pub fn pos(&self) -> Option<&Pos> { use T_::*; match self { Rnone => None, Rinvalid => None, Rwitness(p) | RwitnessFromDecl(p) | Ridx(p, _) | RidxVector(p) | RidxVectorFromDecl(p) | Rforeach(p) | Rasyncforeach(p) | Rarith(p) | RarithRet(p) | RarithDynamic(p) | Rcomp(p) | RconcatRet(p) | RlogicRet(p) | Rbitwise(p) | RbitwiseRet(p) | RnoReturn(p) | RnoReturnAsync(p) | RretFunKind(p, _) | RretFunKindFromDecl(p, _) | Rhint(p) | Rthrow(p) | Rplaceholder(p) | RretDiv(p) | RyieldGen(p) | RyieldAsyncgen(p) | RyieldAsyncnull(p) | RyieldSend(p) | Rformat(p, _, _) | RclassClass(p, _) | RunknownClass(p) | RvarParam(p) | RvarParamFromDecl(p) | RunpackParam(p, _, _) | RinoutParam(p) | Rtypeconst(box Rnone, (p, _), _, _) | RnullsafeOp(p) | RtconstNoCstr((p, _)) | Rpredicated(p, _) | Ris(p) | Ras(p) | Requal(p) | RvarrayOrDarrayKey(p) | RvecOrDictKey(p) | Rusing(p) | RdynamicProp(p) | RdynamicCall(p) | RdynamicConstruct(p) | RidxDict(p) | RsetElement(p) | RmissingOptionalField(p, _) | RunsetField(p, _) | Rregex(p) | RimplicitUpperBound(p, _) | RarithRetFloat(p, _, _) | RarithRetNum(p, _, _) | RarithRetInt(p) | RbitwiseDynamic(p) | RincdecDynamic(p) | RtypeVariable(p) | RtypeVariableGenerics(p, _, _) | RtypeVariableError(p) | RglobalTypeVariableGenerics(p, _, _) | RsolveFail(p) | RcstrOnGenerics(p, _) | RlambdaParam(p, _) | Rshape(p, _) | RshapeLiteral(p) | Renforceable(p) | Rdestructure(p) | RkeyValueCollectionKey(p) | RglobalClassProp(p) | RglobalFunParam(p) | RglobalFunRet(p) | Rsplice(p) | RetBoolean(p) | RdefaultCapability(p) | RconcatOperand(p) | RinterpOperand(p) | RsupportDynamicType(p) | RdynamicPartialEnforcement(p, _, _) | RrigidTvarEscape(p, _, _, _) | RmissingClass(p) => Some(p), RlostInfo(_, r, _) | Rinstantiate(_, _, r) | Rtypeconst(r, _, _, _) | RtypeAccess(r, _) | RexprDepType(r, _, _) | RcontravariantGeneric(r, _) | RinvariantGeneric(r, _) => r.pos(), RopaqueTypeFromModule(p, _, _) => Some(p), RdynamicCoercion(r) => r.pos(), } } }
Rust
hhvm/hphp/hack/src/oxidized/manual/typing_set.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 crate::typing_defs::Ty; pub type TySet = std::collections::BTreeSet<Ty>;
Rust
hhvm/hphp/hack/src/oxidized/manual/t_shape_map.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::cmp::Ordering; use std::hash::Hash; use std::hash::Hasher; use eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; use crate::typing_defs_core::PosByteString; use crate::typing_defs_core::PosString; use crate::typing_defs_core::TshapeFieldName; #[derive(Clone, Debug, Deserialize, Serialize)] #[derive(FromOcamlRep, EqModuloPos, NoPosHash, ToOcamlRep)] pub struct TShapeField(pub TshapeFieldName); /// Ord implementation that ignores pos impl Ord for TShapeField { fn cmp(&self, other: &Self) -> Ordering { use TshapeFieldName::*; match (&self.0, &other.0) { (TSFlitInt(PosString(_, s1)), TSFlitInt(PosString(_, s2))) => s1.cmp(s2), (TSFlitStr(PosByteString(_, s1)), TSFlitStr(PosByteString(_, s2))) => s1.cmp(s2), ( TSFclassConst((_, c1), PosString(_, m1)), TSFclassConst((_, c2), PosString(_, m2)), ) => (c1, m1).cmp(&(c2, m2)), (TSFlitInt(_), _) => Ordering::Less, (TSFlitStr(_), TSFlitInt(_)) => Ordering::Greater, (TSFlitStr(_), _) => Ordering::Less, (TSFclassConst(_, _), _) => Ordering::Greater, } } } impl PartialOrd for TShapeField { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) } } impl PartialEq for TShapeField { fn eq(&self, other: &Self) -> bool { self.cmp(other) == Ordering::Equal } } impl Eq for TShapeField {} // non-derived impl Hash because PartialEq and Eq are non-derived impl Hash for TShapeField { fn hash<H: Hasher>(&self, hasher: &mut H) { Hash::hash(&self.0, hasher) } } pub type TShapeMap<T> = std::collections::BTreeMap<TShapeField, T>;
Rust
hhvm/hphp/hack/src/oxidized/stubs/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. pub mod opaque_digest;
Rust
hhvm/hphp/hack/src/oxidized/stubs/opaque_digest.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 no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Clone, Debug, Deserialize, Eq, Hash, NoPosHash, Ord, PartialEq, PartialOrd, FromOcamlRep, FromOcamlRepIn, ToOcamlRep, Serialize )] pub struct OpaqueDigest(());
Rust
hhvm/hphp/hack/src/oxidized/stubs/stats_container.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 ocamlrep::OcamlRep; #[derive(Clone, Debug, OcamlRep)] pub struct StatsContainer(());
TOML
hhvm/hphp/hack/src/oxidized_by_ref/Cargo.toml
# @generated by autocargo [package] name = "oxidized_by_ref" version = "0.0.0" edition = "2021" [lib] path = "lib.rs" [dependencies] arena_collections = { version = "0.0.0", path = "../arena_collections" } 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" } hh24_types = { version = "0.0.0", path = "../utils/hh24_types" } hh_hash = { version = "0.0.0", path = "../utils/hh_hash" } 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" } ocamlrep_caml_builtins = { 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" } rust_to_ocaml_attr = { version = "0.0.0", path = "../rust_to_ocaml/rust_to_ocaml_attr" } serde = { version = "1.0.176", features = ["derive", "rc"] } [dev-dependencies] pretty_assertions = { version = "1.2", features = ["alloc"], default-features = false } serde_json = { version = "1.0.100", features = ["float_roundtrip", "unbounded_depth"] }
Text
hhvm/hphp/hack/src/oxidized_by_ref/copy_types.txt
aast_defs::CtxRefinement aast_defs::Hint_ aast_defs::ParamKind aast_defs::Refinement aast_defs::ReifyKind aast_defs::Sid aast_defs::Tprim aast_defs::TypeRefinement aast_defs::XhpChild aast_defs::Afield aast_defs::AsExpr aast_defs::AssertExpr aast_defs::Case aast_defs::CaType aast_defs::ClassAttr aast_defs::ClassConstKind aast_defs::ClassGetExpr aast_defs::ClassId_ aast_defs::ClassTypeconst aast_defs::CollectionTarg aast_defs::Def aast_defs::DefaultCase aast_defs::Expr_ aast_defs::FunctionPtrId aast_defs::FunVariadicity aast_defs::GenCase aast_defs::HoleSource aast_defs::LocalIdMap aast_defs::MdNameKind aast_defs::ParamKind aast_defs::Pattern aast_defs::Program aast_defs::ReifyKind aast_defs::RequireKind aast_defs::Sid aast_defs::Stmt_ aast_defs::TypeconstAbstractKind aast_defs::XhpAttribute ast_defs::Abstraction ast_defs::Bop ast_defs::ClassishKind ast_defs::Id ast_defs::PropOrMethod ast_defs::ParamKind ast_defs::ShapeFieldName ast_defs::Tprim ast_defs::XhpEnumValue user_error::Severity decl_defs::ConditionTypeName decl_defs::DeclError decl_defs::MethodReactivity decl_defs::SourceType decl_reference::DeclReference errors::AppliedFixme errors::FilesT errors::FileT error_message::Elem file_info::Pos i_map::IMap i_set::ISet ident::Ident local_id::map::Map method_flags::MethodFlags nast::shape_map::ShapeMap nast::Sid oxidized::aast_defs::Abstraction oxidized::aast_defs::FuncReactive oxidized::aast_defs::ImportFlavor oxidized::aast_defs::KvcKind oxidized::aast_defs::ParamMutability oxidized::aast_defs::ReifyKind oxidized::aast_defs::TypedefVisibility oxidized::aast_defs::UseAsVisibility oxidized::aast_defs::VcKind oxidized::aast_defs::Visibility oxidized::aast_defs::XhpChildOp oxidized::aast_defs::Tprim oxidized::aast::Abstraction oxidized::aast::ConstraintKind oxidized::aast::EmitId oxidized::aast::EnvAnnot oxidized::aast::FuncReactive oxidized::aast::FunKind oxidized::aast::ImportFlavor oxidized::aast::KvcKind oxidized::aast::NsKind oxidized::aast::OgNullFlavor oxidized::aast::ParamMutability oxidized::aast::PropOrMethod oxidized::aast::ReadonlyKind oxidized::aast::ReifyKind oxidized::aast::ReifyKind oxidized::aast::TypedefVisibility oxidized::aast::Uop oxidized::aast::UseAsVisibility oxidized::aast::Variance oxidized::aast::VcKind oxidized::aast::Visibility oxidized::aast::XhpAttrTag oxidized::aast::XhpChildOp oxidized::ast_defs::Abstraction oxidized::ast_defs::ClassishKind oxidized::ast_defs::ConstraintKind oxidized::ast_defs::FunKind oxidized::ast_defs::OgNullFlavor oxidized::ast_defs::PropOrMethod oxidized::ast_defs::ReadonlyKind oxidized::ast_defs::ReifyKind oxidized::ast_defs::Tprim oxidized::ast_defs::TypedefVisibility oxidized::ast_defs::Uop oxidized::ast_defs::Variance oxidized::ast_defs::Visibility oxidized::decl_defs::SourceType oxidized::file_info::Mode oxidized::file_info::NameType oxidized::naming_types::KindOfType oxidized::naming_types::NameKind oxidized::typing_defs::ClassConstKind oxidized::typing_defs_core::ConsistentKind oxidized::typing_defs_core::DestructureKind oxidized::typing_defs_core::Enforcement oxidized::typing_defs_core::FunTparamsKind oxidized::typing_defs_core::ParamMode oxidized::typing_defs_core::ShapeKind oxidized::typing_defs_core::TypeOrigin oxidized::typing_defs_core::ValKind oxidized::typing_reason::ArgPosition oxidized::typing_reason::BlameSource oxidized::user_error::Severity oxidized::xhp_attribute::Tag oxidized::xhp_attribute::XhpAttribute package::PackageRelationship patt_binding_ty::PattBindingTy patt_locl_ty::Prim patt_error::Primary patt_error::Callback patt_error::ReasonsCallback patt_error::Secondary patt_error::PattError patt_string::PattString patt_name::PattName patt_name::Namespace patt_locl_ty::PattLoclTy patt_locl_ty::Params patt_locl_ty::ShapeFields patt_locl_ty::ShapeField patt_locl_ty::ShapeLabel error_message::ErrorMessage custom_error::CustomError custom_error::VersionedPattError custom_error::VersionedErrorMessage custom_error_config::CustomErrorConfig validation_err::ValidationErr prim_defs::Comment prop_flags::PropFlags quickfix::QfPos relative_path::map::Map s_map::SMap s_set::SSet saved_state_rollouts::Flag shallow_decl_defs::Decl tany_sentinel::TanySentinel tast::MutabilityEnv tast::Reactivity tast::TypeParamMutability tast::ValKind t_shape_map::TShapeMap tast::CheckStatus typing_cont_key::TypingContKey typing_defs_core::Capability typing_defs_core::CeVisibility typing_defs_core::ClassRefinement typing_defs_core::CollectionStyle typing_defs_core::ConsistentKind typing_defs_core::ConstraintType typing_defs_core::ConstraintType_ typing_defs_core::CrossPackageDecl typing_defs_core::CtxRefinement typing_defs_core::DependentType typing_defs_core::DestructureKind typing_defs_core::Enforcement typing_defs_core::Exact typing_defs_core::FunArity typing_defs_core::FunTparamsKind typing_defs_core::IfcFunDecl typing_defs_core::InternalType typing_defs_core::NegType typing_defs_core::ParamMode typing_defs_core::ParamMutability typing_defs_core::ParamRxAnnotation typing_defs_core::PosByteString typing_defs_core::PosId typing_defs_core::PosString typing_defs_core::Reactivity typing_defs_core::RefinedConst typing_defs_core::RefinedConstBound typing_defs_core::ShapeKind typing_defs_core::TshapeFieldName typing_defs_core::Ty_ typing_defs_core::TypeOrigin typing_defs_core::UserAttributeParam typing_defs_core::ValKind typing_defs_core::XhpAttr typing_defs_flags::class_elt::ClassElt typing_defs_flags::FunParamFlags typing_defs_flags::FunTypeFlags typing_defs::CeVisibility typing_defs::ClassConstFrom typing_defs::ClassConstKind typing_defs::ClassConstRef typing_defs::CollectionStyle typing_defs::ConsistentKind typing_defs::ConstraintType typing_defs::DeserializationError typing_defs::DestructureKind typing_defs::Exact typing_defs::FunTparamsKind typing_defs::InternalType typing_defs::ModuleReference typing_defs::ParamMode typing_defs::ParamMutability typing_defs::PosByteString typing_defs::PosId typing_defs::PosString typing_defs::RecordFieldReq typing_defs::ClassRefinement typing_defs::ClassTypeRefinement typing_defs::ClassTypeRefinementBounds typing_defs::ShapeKind typing_defs::Ty_ typing_defs::Typeconst typing_defs::TypeOrigin typing_defs::ValKind typing_defs::XhpAttr typing_inference_env::SolvingInfo typing_inference_env::Tvenv typing_mutability_env::MutabilityEnv typing_mutability_env::MutType typing_reason::ArgPosition typing_reason::Blame typing_reason::BlameSource typing_reason::DeclPhase typing_reason::ExprDepTypeReason typing_reason::LoclPhase typing_reason::PosId typing_reason::Reason typing_reason::T_ typing_reason::Ureason xhp_attribute::Tag xhp_attribute::XhpAttribute
Text
hhvm/hphp/hack/src/oxidized_by_ref/extern_types.txt
oxidized::aast::Abstraction oxidized::aast::BreakContinueLevel oxidized::aast::CallType oxidized::aast::ConstraintKind oxidized::aast_defs::Abstraction oxidized::aast_defs::BreakContinueLevel oxidized::aast_defs::CallType oxidized::aast_defs::ConstraintKind oxidized::aast_defs::EmitId oxidized::aast_defs::EnvAnnot oxidized::aast_defs::FuncReactive oxidized::aast_defs::FunKind oxidized::aast_defs::ImportFlavor oxidized::aast_defs::IsCoroutine oxidized::aast_defs::IsExtends oxidized::aast_defs::IsReified oxidized::aast_defs::IsVariadic oxidized::aast_defs::KvcKind oxidized::aast_defs::MutableReturn oxidized::aast_defs::NsKind oxidized::aast_defs::OgNullFlavor oxidized::aast_defs::ParamMutability oxidized::aast_defs::PropOrMethod oxidized::aast_defs::ReadonlyKind oxidized::aast_defs::ReifyKind oxidized::aast_defs::RequireKind oxidized::aast_defs::Tprim oxidized::aast_defs::TypedefVisibility oxidized::aast_defs::Uop oxidized::aast_defs::UseAsVisibility oxidized::aast_defs::Variance oxidized::aast_defs::VcKind oxidized::aast_defs::Visibility oxidized::aast_defs::XhpAttrTag oxidized::aast_defs::XhpChildOp oxidized::aast::EmitId oxidized::aast::EnvAnnot oxidized::aast::FuncReactive oxidized::aast::FunKind oxidized::aast::ImportFlavor oxidized::aast::IsExtends oxidized::aast::IsVariadic oxidized::aast::KvcKind oxidized::aast::NsKind oxidized::aast::OgNullFlavor oxidized::aast::ParamMutability oxidized::aast::PropOrMethod oxidized::aast::ReadonlyKind oxidized::aast::ReifyKind oxidized::aast::RequireKind oxidized::aast::TypedefVisibility oxidized::aast::Uop oxidized::aast::UseAsVisibility oxidized::aast::Variance oxidized::aast::VcKind oxidized::aast::Visibility oxidized::aast::XhpAttrTag oxidized::aast::XhpChildOp oxidized::ast_defs::Abstraction oxidized::ast_defs::ClassishKind oxidized::ast_defs::ConstraintKind oxidized::ast_defs::FunKind oxidized::ast_defs::OgNullFlavor oxidized::ast_defs::PropOrMethod oxidized::ast_defs::ReadonlyKind oxidized::ast_defs::Reified oxidized::ast_defs::ReifyKind oxidized::ast_defs::Tprim oxidized::ast_defs::TypedefVisibility oxidized::ast_defs::Uop oxidized::ast_defs::Variance oxidized::ast_defs::Visibility oxidized::decl_defs::SourceType oxidized::doc_comment::DocComment oxidized::error_codes::Init oxidized::error_codes::Naming oxidized::error_codes::NastCheck oxidized::error_codes::Parsing oxidized::error_codes::Typing oxidized::error_codes::GlobalAccessCheck oxidized::errors::ErrorCode oxidized::errors::Format oxidized::errors::NameContext oxidized::errors::Phase oxidized::file_info::Mode oxidized::file_info::Names oxidized::file_info::NameType oxidized::full_fidelity_parser_env::FullFidelityParserEnv oxidized::name_context::NameContext oxidized::naming_types::KindOfType oxidized::naming_types::NameKind oxidized::package::Package; oxidized::package_info::PackageInfo; oxidized::parser_options::FfiT oxidized::typing_defs::ClassConstKind oxidized::typing_defs_core::ConsistentKind oxidized::typing_defs_core::DestructureKind oxidized::typing_defs_core::Enforcement oxidized::typing_defs_core::FunTparamsKind oxidized::typing_defs_core::ParamMode oxidized::typing_defs_core::ShapeKind oxidized::typing_defs_core::ValKind oxidized::typing_reason::ArgPosition oxidized::typing_reason::BlameSource oxidized::user_error::Severity oxidized::xhp_attribute::Tag oxidized::xhp_attribute::XhpAttribute oxidized::patt_binding_ty::PattBindingTy oxidized::patt_error::Primary oxidized::patt_error::Callback oxidized::patt_error::ReasonsCallback oxidized::patt_locl_ty::Prim
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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. #[macro_use] extern crate rust_to_ocaml_attr; mod manual; pub use manual::aast; pub use manual::decl_counters; pub use manual::decl_env; pub use manual::direct_decl_parser; pub use manual::i_map; pub use manual::i_set; pub use manual::ident; pub use manual::lazy; pub use manual::local_id; pub use manual::local_id_map::LocalIdMap; pub use manual::method_flags; pub use manual::opaque_digest; pub use manual::pos; pub use manual::prop_flags; pub use manual::relative_path; pub use manual::s_map; pub use manual::s_set; 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 mod decl_visitor; 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_reference; pub use gen::error_message; pub use gen::file_info; pub use gen::namespace_env; pub use gen::naming_types; pub use gen::nast; pub use gen::package; pub use gen::package_info; 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::prim_defs; pub use gen::saved_state_rollouts; pub use gen::scoured_comments; pub use gen::shallow_decl_defs; pub use gen::typing_defs; pub use gen::typing_defs_core; pub use gen::typing_reason; pub use gen::validation_err; pub use gen::xhp_attribute;
Text
hhvm/hphp/hack/src/oxidized_by_ref/owned_types.txt
aast_defs::Tprim aast::Tprim decl_defs::CollectionStyle decl_defs::ConsistentKind decl_defs::SourceType decl_defs::XhpAttr ident::Ident lazy::Lazy method_flags::MethodFlags package::PackageRelationship prop_flags::PropFlags saved_state_rollouts::Flag saved_state_rollouts::FlagName saved_state_rollouts::SavedStateRollouts shallow_decl_defs::Visibility tany_sentinel::TanySentinel tast::CheckStatus tast::FunTastInfo typing_cont_key::TypingContKey typing_defs_core::CollectionStyle typing_defs_core::ConsistentKind typing_defs_core::DependentType typing_defs_core::DestructureKind typing_defs_core::Enforcement typing_defs_core::FunTparamsKind typing_defs_core::ParamMode typing_defs_core::ParamMutability typing_defs_core::ShapeKind typing_defs_core::ValKind typing_defs_core::XhpAttr typing_defs_flags::class_elt::ClassElt typing_defs_flags::FunParamFlags typing_defs_flags::FunTypeFlags typing_defs::ClassConstKind typing_defs::CollectionStyle typing_defs::ConsistentKind typing_defs::DestructureKind typing_defs::FunTparamsKind typing_defs::ParamMode typing_defs::ParamMutability typing_defs::RecordFieldReq typing_defs::ShapeKind typing_defs::TypedefVisibility typing_defs::ValKind typing_defs::XhpAttr typing_local_types::ExpressionId typing_mutability_env::MutType typing_reason::ArgPosition typing_reason::BlameSource xhp_attribute::Tag xhp_attribute::XhpAttribute
Rust
hhvm/hphp/hack/src/oxidized_by_ref/decl_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 visitor; pub use node::Node; pub use visitor::Visitor; #[cfg(test)] mod test { use super::*; #[test] fn test_simple_visitor() { use Ty_::*; use crate::pos::Pos; use crate::relative_path::RelativePath; use crate::typing_defs_core::*; use crate::typing_reason::Reason; struct PrintEveryTapplyVisitor<'a>(Vec<&'a Pos<'a>>, Vec<String>); impl<'a> Visitor<'a> for PrintEveryTapplyVisitor<'a> { fn object(&mut self) -> &mut dyn Visitor<'a> { self } fn visit_ty(&mut self, ty: &'a Ty<'_>) { self.0.push(ty.get_pos().unwrap()); if let Ty_::Tapply(&((pos, id), _)) = ty.1 { self.1.push(format!("Found {} on line {}", id, pos.line())); for pos in self.0.iter().rev() { self.1.push(format!(" in a ty on line {}", pos.line())); } } ty.recurse(self.object()); self.0.pop(); } } let b = &bumpalo::Bump::new(); let pos = |line| Pos::from_line_cols_offset(b, RelativePath::empty(), line, 10..50, 100); macro_rules! a { ($e:expr) => { &*b.alloc($e) }; } let ty = a!(Ty( a!(Reason::hint(pos(1))), Ttuple(a!([ a!(Ty( a!(Reason::hint(pos(2))), Tapply(a!(((pos(3), "foo"), &[][..]))), )), a!(Ty( a!(Reason::hint(pos(4))), Tapply(a!(((pos(5), "bar"), &[][..]))), )), ])), )); let mut visitor = PrintEveryTapplyVisitor(vec![], vec![]); visitor.visit_ty(ty); assert!(visitor.0.is_empty()); assert_eq!( visitor.1, vec![ "Found foo on line 3", " in a ty on line 2", " in a ty on line 1", "Found bar on line 5", " in a ty on line 4", " in a ty on line 1", ] ); } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/decl_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<<3a75b3a4d0be8c85ac53ef279f68c594>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use super::Visitor; pub trait Node<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { self.recurse(v) } fn recurse(&'a self, _v: &mut dyn Visitor<'a>) {} }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/decl_visitor/node_impl.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<<ae852b421df74b25827b73ee9d48536c>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use super::node::Node; use super::visitor::Visitor; impl<'a> Node<'a> for () {} impl<'a> Node<'a> for bool {} impl<'a> Node<'a> for isize {} impl<'a> Node<'a> for str {} impl<'a> Node<'a> for bstr::BStr {} impl<'a> Node<'a> for crate::file_info::Mode {} impl<'a> Node<'a> for crate::local_id::LocalId<'a> {} impl<'a> Node<'a> for crate::method_flags::MethodFlags {} impl<'a> Node<'a> for crate::pos::Pos<'a> {} impl<'a> Node<'a> for crate::prop_flags::PropFlags {} impl<'a> Node<'a> for crate::tany_sentinel::TanySentinel {} impl<'a> Node<'a> for crate::typing_defs_flags::FunParamFlags {} impl<'a> Node<'a> for crate::typing_defs_flags::FunTypeFlags {} impl<'a, T: Node<'a> + ?Sized> Node<'a> for &'a T { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { (*self).accept(v) } } impl<'a, T: Node<'a>> Node<'a> for [T] { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { for x in self { x.accept(v) } } } impl<'a, T: Node<'a>> Node<'a> for Option<T> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Some(t) => t.accept(v), _ => {} } } } impl<'a, T: Node<'a>> Node<'a> for crate::lazy::Lazy<T> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { self.0.accept(v) } } impl<'a, T: Node<'a>> Node<'a> for arena_collections::List<'a, T> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { for elt in self.iter() { elt.accept(v); } } } impl<'a, K: Node<'a>, V: Node<'a>> Node<'a> for arena_collections::map::Map<'a, K, V> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { for (key, value) in self.iter() { key.accept(v); value.accept(v); } } } impl<'a, K: Node<'a>, V: Node<'a>> Node<'a> for arena_collections::SortedAssocList<'a, K, V> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { for (key, value) in self.iter() { key.accept(v); value.accept(v); } } } impl<'a, T: Node<'a>> Node<'a> for arena_collections::SortedSet<'a, T> { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { for elt in self.iter() { elt.accept(v); } } } impl<'a, T1, T2> Node<'a> for (T1, T2) where T1: Node<'a>, T2: Node<'a>, { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { self.0.accept(v); self.1.accept(v); } } impl<'a, T1, T2, T3> Node<'a> for (T1, T2, T3) where T1: Node<'a>, T2: Node<'a>, T3: Node<'a>, { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { self.0.accept(v); self.1.accept(v); self.2.accept(v); } } impl<'a, T1, T2, T3, T4> Node<'a> for (T1, T2, T3, T4) where T1: Node<'a>, T2: Node<'a>, T3: Node<'a>, T4: Node<'a>, { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { self.0.accept(v); self.1.accept(v); self.2.accept(v); self.3.accept(v); } } impl<'a, T1, T2, T3, T4, T5> Node<'a> for (T1, T2, T3, T4, T5) where T1: Node<'a>, T2: Node<'a>, T3: Node<'a>, T4: Node<'a>, T5: Node<'a>, { fn recurse(&'a self, v: &mut dyn Visitor<'a>) { self.0.accept(v); self.1.accept(v); self.2.accept(v); self.3.accept(v); self.4.accept(v); } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/decl_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<<a93abfd5636a811ddbd1577130bd86b2>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_braces)] #![allow(unused_imports)] #![allow(unused_variables)] use super::node::Node; use super::visitor::Visitor; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::direct_decl_parser::*; use crate::direct_decl_parser::{self}; use crate::shallow_decl_defs::*; use crate::shallow_decl_defs::{self}; use crate::t_shape_map::*; use crate::t_shape_map::{self}; use crate::typing_defs::*; use crate::typing_defs::{self}; use crate::typing_defs_core::*; use crate::typing_defs_core::{self}; use crate::typing_reason::*; use crate::typing_reason::{self}; use crate::xhp_attribute::*; use crate::xhp_attribute::{self}; use crate::*; impl<'a> Node<'a> for Id<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_id(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Id(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for XhpEnumValue<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_xhp_enum_value(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { XhpEnumValue::XEVInt(ref __binding_0) => __binding_0.accept(v), XhpEnumValue::XEVString(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for ShallowClassConst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shallow_class_const(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShallowClassConst { abstract_: ref __binding_0, name: ref __binding_1, type_: ref __binding_2, refs: ref __binding_3, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } } } } } impl<'a> Node<'a> for ShallowTypeconst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shallow_typeconst(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShallowTypeconst { name: ref __binding_0, kind: ref __binding_1, enforceable: ref __binding_2, reifiable: ref __binding_3, is_ctx: ref __binding_4, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } } } } } impl<'a> Node<'a> for ShallowProp<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shallow_prop(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShallowProp { name: ref __binding_0, xhp_attr: ref __binding_1, type_: ref __binding_2, visibility: ref __binding_3, flags: ref __binding_4, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } } } } } impl<'a> Node<'a> for ShallowMethod<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shallow_method(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShallowMethod { name: ref __binding_0, type_: ref __binding_1, visibility: ref __binding_2, deprecated: ref __binding_3, flags: ref __binding_4, attributes: ref __binding_5, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } } } } } impl<'a> Node<'a> for ShallowClass<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shallow_class(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShallowClass { mode: ref __binding_0, final_: ref __binding_1, abstract_: ref __binding_2, is_xhp: ref __binding_3, internal: ref __binding_4, has_xhp_keyword: ref __binding_5, kind: ref __binding_6, module: ref __binding_7, name: ref __binding_8, tparams: ref __binding_9, where_constraints: ref __binding_10, extends: ref __binding_11, uses: ref __binding_12, xhp_attr_uses: ref __binding_13, xhp_enum_values: ref __binding_14, xhp_marked_empty: ref __binding_15, req_extends: ref __binding_16, req_implements: ref __binding_17, req_class: ref __binding_18, implements: ref __binding_19, support_dynamic_type: ref __binding_20, consts: ref __binding_21, typeconsts: ref __binding_22, props: ref __binding_23, sprops: ref __binding_24, constructor: ref __binding_25, static_methods: ref __binding_26, methods: ref __binding_27, user_attributes: ref __binding_28, enum_type: ref __binding_29, docs_url: ref __binding_30, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } { __binding_6.accept(v) } { __binding_7.accept(v) } { __binding_8.accept(v) } { __binding_9.accept(v) } { __binding_10.accept(v) } { __binding_11.accept(v) } { __binding_12.accept(v) } { __binding_13.accept(v) } { __binding_14.accept(v) } { __binding_15.accept(v) } { __binding_16.accept(v) } { __binding_17.accept(v) } { __binding_18.accept(v) } { __binding_19.accept(v) } { __binding_20.accept(v) } { __binding_21.accept(v) } { __binding_22.accept(v) } { __binding_23.accept(v) } { __binding_24.accept(v) } { __binding_25.accept(v) } { __binding_26.accept(v) } { __binding_27.accept(v) } { __binding_28.accept(v) } { __binding_29.accept(v) } { __binding_30.accept(v) } } } } } impl<'a> Node<'a> for Decl<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_decl(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Decl::Class(ref __binding_0) => __binding_0.accept(v), Decl::Fun(ref __binding_0) => __binding_0.accept(v), Decl::Typedef(ref __binding_0) => __binding_0.accept(v), Decl::Const(ref __binding_0) => __binding_0.accept(v), Decl::Module(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for IfcFunDecl<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_ifc_fun_decl(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { IfcFunDecl::FDPolicied(ref __binding_0) => __binding_0.accept(v), IfcFunDecl::FDInferFlows => {} } } } impl<'a> Node<'a> for TypeOrigin<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_type_origin(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TypeOrigin::MissingOrigin => {} TypeOrigin::FromAlias(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for PosString<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_pos_string(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { PosString(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for PosByteString<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_pos_byte_string(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { PosByteString(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for TshapeFieldName<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_tshape_field_name(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TshapeFieldName::TSFlitInt(ref __binding_0) => __binding_0.accept(v), TshapeFieldName::TSFlitStr(ref __binding_0) => __binding_0.accept(v), TshapeFieldName::TSFclassConst(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for DependentType { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_dependent_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { DependentType::DTexpr(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for UserAttributeParam<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_user_attribute_param(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { UserAttributeParam::Classname(ref __binding_0) => __binding_0.accept(v), UserAttributeParam::EnumClassLabel(ref __binding_0) => __binding_0.accept(v), UserAttributeParam::String(ref __binding_0) => __binding_0.accept(v), UserAttributeParam::Int(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for UserAttribute<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_user_attribute(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { UserAttribute { name: ref __binding_0, params: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for Tparam<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_tparam(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Tparam { variance: ref __binding_0, name: ref __binding_1, tparams: ref __binding_2, constraints: ref __binding_3, reified: ref __binding_4, user_attributes: ref __binding_5, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } } } } } impl<'a> Node<'a> for WhereConstraint<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_where_constraint(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { WhereConstraint(ref __binding_0, ref __binding_1, ref __binding_2) => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } } } } } impl<'a> Node<'a> for Ty<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_ty(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Ty(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for NegType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_neg_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { NegType::NegPrim(ref __binding_0) => __binding_0.accept(v), NegType::NegClass(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for ShapeFieldType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shape_field_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShapeFieldType { optional: ref __binding_0, ty: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for Ty_<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_ty_(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Ty_::Tthis => {} Ty_::Tapply(ref __binding_0) => __binding_0.accept(v), Ty_::Trefinement(ref __binding_0) => __binding_0.accept(v), Ty_::Tmixed => {} Ty_::Twildcard => {} Ty_::Tlike(ref __binding_0) => __binding_0.accept(v), Ty_::Tany(ref __binding_0) => __binding_0.accept(v), Ty_::Tnonnull => {} Ty_::Tdynamic => {} Ty_::Toption(ref __binding_0) => __binding_0.accept(v), Ty_::Tprim(ref __binding_0) => __binding_0.accept(v), Ty_::Tfun(ref __binding_0) => __binding_0.accept(v), Ty_::Ttuple(ref __binding_0) => __binding_0.accept(v), Ty_::Tshape(ref __binding_0) => __binding_0.accept(v), Ty_::Tgeneric(ref __binding_0) => __binding_0.accept(v), Ty_::Tunion(ref __binding_0) => __binding_0.accept(v), Ty_::Tintersection(ref __binding_0) => __binding_0.accept(v), Ty_::TvecOrDict(ref __binding_0) => __binding_0.accept(v), Ty_::Taccess(ref __binding_0) => __binding_0.accept(v), Ty_::Tnewtype(ref __binding_0) => __binding_0.accept(v), Ty_::Tvar(ref __binding_0) => __binding_0.accept(v), Ty_::TunappliedAlias(ref __binding_0) => __binding_0.accept(v), Ty_::Tdependent(ref __binding_0) => __binding_0.accept(v), Ty_::Tclass(ref __binding_0) => __binding_0.accept(v), Ty_::Tneg(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for TaccessType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_taccess_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TaccessType(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for Exact<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_exact(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Exact::Exact => {} Exact::Nonexact(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for ClassRefinement<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_class_refinement(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ClassRefinement { cr_consts: ref __binding_0, } => __binding_0.accept(v), } } } impl<'a> Node<'a> for RefinedConst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_refined_const(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { RefinedConst { bound: ref __binding_0, is_ctx: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for RefinedConstBound<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_refined_const_bound(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { RefinedConstBound::TRexact(ref __binding_0) => __binding_0.accept(v), RefinedConstBound::TRloose(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for RefinedConstBounds<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_refined_const_bounds(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { RefinedConstBounds { lower: ref __binding_0, upper: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for ShapeType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_shape_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ShapeType { origin: ref __binding_0, unknown_value: ref __binding_1, fields: ref __binding_2, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } } } } } impl<'a> Node<'a> for Capability<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_capability(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Capability::CapDefaults(ref __binding_0) => __binding_0.accept(v), Capability::CapTy(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for FunImplicitParams<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_fun_implicit_params(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { FunImplicitParams { capability: ref __binding_0, } => __binding_0.accept(v), } } } impl<'a> Node<'a> for FunType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_fun_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { FunType { tparams: ref __binding_0, where_constraints: ref __binding_1, params: ref __binding_2, implicit_params: ref __binding_3, ret: ref __binding_4, flags: ref __binding_5, ifc_decl: ref __binding_6, cross_package: ref __binding_7, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } { __binding_6.accept(v) } { __binding_7.accept(v) } } } } } impl<'a> Node<'a> for PossiblyEnforcedTy<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_possibly_enforced_ty(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { PossiblyEnforcedTy { enforced: ref __binding_0, type_: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for FunParam<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_fun_param(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { FunParam { pos: ref __binding_0, name: ref __binding_1, type_: ref __binding_2, flags: ref __binding_3, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } } } } } impl<'a> Node<'a> for ClassConstFrom<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_class_const_from(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ClassConstFrom::Self_ => {} ClassConstFrom::From(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for ClassConstRef<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_class_const_ref(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ClassConstRef(ref __binding_0, ref __binding_1) => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for ConstDecl<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_const_decl(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ConstDecl { pos: ref __binding_0, type_: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } } impl<'a> Node<'a> for FunElt<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_fun_elt(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { FunElt { deprecated: ref __binding_0, module: ref __binding_1, internal: ref __binding_2, type_: ref __binding_3, pos: ref __binding_4, php_std_lib: ref __binding_5, support_dynamic_type: ref __binding_6, no_auto_dynamic: ref __binding_7, no_auto_likes: ref __binding_8, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } { __binding_6.accept(v) } { __binding_7.accept(v) } { __binding_8.accept(v) } } } } } impl<'a> Node<'a> for ModuleReference<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_module_reference(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ModuleReference::MRGlobal => {} ModuleReference::MRPrefix(ref __binding_0) => __binding_0.accept(v), ModuleReference::MRExact(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for ModuleDefType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_module_def_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ModuleDefType { pos: ref __binding_0, exports: ref __binding_1, imports: ref __binding_2, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } } } } } impl<'a> Node<'a> for AbstractTypeconst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_abstract_typeconst(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { AbstractTypeconst { as_constraint: ref __binding_0, super_constraint: ref __binding_1, default: ref __binding_2, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } } } } } impl<'a> Node<'a> for ConcreteTypeconst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_concrete_typeconst(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ConcreteTypeconst { tc_type: ref __binding_0, } => __binding_0.accept(v), } } } impl<'a> Node<'a> for Typeconst<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_typeconst(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Typeconst::TCAbstract(ref __binding_0) => __binding_0.accept(v), Typeconst::TCConcrete(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for EnumType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_enum_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { EnumType { base: ref __binding_0, constraint: ref __binding_1, includes: ref __binding_2, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } } } } } impl<'a> Node<'a> for TypedefType<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_typedef_type(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TypedefType { module: ref __binding_0, pos: ref __binding_1, vis: ref __binding_2, tparams: ref __binding_3, as_constraint: ref __binding_4, super_constraint: ref __binding_5, type_: ref __binding_6, is_ctx: ref __binding_7, attributes: ref __binding_8, internal: ref __binding_9, docs_url: ref __binding_10, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } { __binding_2.accept(v) } { __binding_3.accept(v) } { __binding_4.accept(v) } { __binding_5.accept(v) } { __binding_6.accept(v) } { __binding_7.accept(v) } { __binding_8.accept(v) } { __binding_9.accept(v) } { __binding_10.accept(v) } } } } } impl<'a> Node<'a> for ExprDepTypeReason<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_expr_dep_type_reason(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ExprDepTypeReason::ERexpr(ref __binding_0) => __binding_0.accept(v), ExprDepTypeReason::ERstatic => {} ExprDepTypeReason::ERclass(ref __binding_0) => __binding_0.accept(v), ExprDepTypeReason::ERparent(ref __binding_0) => __binding_0.accept(v), ExprDepTypeReason::ERself(ref __binding_0) => __binding_0.accept(v), ExprDepTypeReason::ERpu(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for Blame<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_blame(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Blame::Blame(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for T_<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_t_(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { T_::Rnone => {} T_::Rwitness(ref __binding_0) => __binding_0.accept(v), T_::RwitnessFromDecl(ref __binding_0) => __binding_0.accept(v), T_::Ridx(ref __binding_0) => __binding_0.accept(v), T_::RidxVector(ref __binding_0) => __binding_0.accept(v), T_::RidxVectorFromDecl(ref __binding_0) => __binding_0.accept(v), T_::Rforeach(ref __binding_0) => __binding_0.accept(v), T_::Rasyncforeach(ref __binding_0) => __binding_0.accept(v), T_::Rarith(ref __binding_0) => __binding_0.accept(v), T_::RarithRet(ref __binding_0) => __binding_0.accept(v), T_::RarithRetFloat(ref __binding_0) => __binding_0.accept(v), T_::RarithRetNum(ref __binding_0) => __binding_0.accept(v), T_::RarithRetInt(ref __binding_0) => __binding_0.accept(v), T_::RarithDynamic(ref __binding_0) => __binding_0.accept(v), T_::RbitwiseDynamic(ref __binding_0) => __binding_0.accept(v), T_::RincdecDynamic(ref __binding_0) => __binding_0.accept(v), T_::Rcomp(ref __binding_0) => __binding_0.accept(v), T_::RconcatRet(ref __binding_0) => __binding_0.accept(v), T_::RlogicRet(ref __binding_0) => __binding_0.accept(v), T_::Rbitwise(ref __binding_0) => __binding_0.accept(v), T_::RbitwiseRet(ref __binding_0) => __binding_0.accept(v), T_::RnoReturn(ref __binding_0) => __binding_0.accept(v), T_::RnoReturnAsync(ref __binding_0) => __binding_0.accept(v), T_::RretFunKind(ref __binding_0) => __binding_0.accept(v), T_::RretFunKindFromDecl(ref __binding_0) => __binding_0.accept(v), T_::Rhint(ref __binding_0) => __binding_0.accept(v), T_::Rthrow(ref __binding_0) => __binding_0.accept(v), T_::Rplaceholder(ref __binding_0) => __binding_0.accept(v), T_::RretDiv(ref __binding_0) => __binding_0.accept(v), T_::RyieldGen(ref __binding_0) => __binding_0.accept(v), T_::RyieldAsyncgen(ref __binding_0) => __binding_0.accept(v), T_::RyieldAsyncnull(ref __binding_0) => __binding_0.accept(v), T_::RyieldSend(ref __binding_0) => __binding_0.accept(v), T_::RlostInfo(ref __binding_0) => __binding_0.accept(v), T_::Rformat(ref __binding_0) => __binding_0.accept(v), T_::RclassClass(ref __binding_0) => __binding_0.accept(v), T_::RunknownClass(ref __binding_0) => __binding_0.accept(v), T_::RvarParam(ref __binding_0) => __binding_0.accept(v), T_::RvarParamFromDecl(ref __binding_0) => __binding_0.accept(v), T_::RunpackParam(ref __binding_0) => __binding_0.accept(v), T_::RinoutParam(ref __binding_0) => __binding_0.accept(v), T_::Rinstantiate(ref __binding_0) => __binding_0.accept(v), T_::Rtypeconst(ref __binding_0) => __binding_0.accept(v), T_::RtypeAccess(ref __binding_0) => __binding_0.accept(v), T_::RexprDepType(ref __binding_0) => __binding_0.accept(v), T_::RnullsafeOp(ref __binding_0) => __binding_0.accept(v), T_::RtconstNoCstr(ref __binding_0) => __binding_0.accept(v), T_::Rpredicated(ref __binding_0) => __binding_0.accept(v), T_::Ris(ref __binding_0) => __binding_0.accept(v), T_::Ras(ref __binding_0) => __binding_0.accept(v), T_::Requal(ref __binding_0) => __binding_0.accept(v), T_::RvarrayOrDarrayKey(ref __binding_0) => __binding_0.accept(v), T_::RvecOrDictKey(ref __binding_0) => __binding_0.accept(v), T_::Rusing(ref __binding_0) => __binding_0.accept(v), T_::RdynamicProp(ref __binding_0) => __binding_0.accept(v), T_::RdynamicCall(ref __binding_0) => __binding_0.accept(v), T_::RdynamicConstruct(ref __binding_0) => __binding_0.accept(v), T_::RidxDict(ref __binding_0) => __binding_0.accept(v), T_::RsetElement(ref __binding_0) => __binding_0.accept(v), T_::RmissingOptionalField(ref __binding_0) => __binding_0.accept(v), T_::RunsetField(ref __binding_0) => __binding_0.accept(v), T_::RcontravariantGeneric(ref __binding_0) => __binding_0.accept(v), T_::RinvariantGeneric(ref __binding_0) => __binding_0.accept(v), T_::Rregex(ref __binding_0) => __binding_0.accept(v), T_::RimplicitUpperBound(ref __binding_0) => __binding_0.accept(v), T_::RtypeVariable(ref __binding_0) => __binding_0.accept(v), T_::RtypeVariableGenerics(ref __binding_0) => __binding_0.accept(v), T_::RtypeVariableError(ref __binding_0) => __binding_0.accept(v), T_::RglobalTypeVariableGenerics(ref __binding_0) => __binding_0.accept(v), T_::RsolveFail(ref __binding_0) => __binding_0.accept(v), T_::RcstrOnGenerics(ref __binding_0) => __binding_0.accept(v), T_::RlambdaParam(ref __binding_0) => __binding_0.accept(v), T_::Rshape(ref __binding_0) => __binding_0.accept(v), T_::RshapeLiteral(ref __binding_0) => __binding_0.accept(v), T_::Renforceable(ref __binding_0) => __binding_0.accept(v), T_::Rdestructure(ref __binding_0) => __binding_0.accept(v), T_::RkeyValueCollectionKey(ref __binding_0) => __binding_0.accept(v), T_::RglobalClassProp(ref __binding_0) => __binding_0.accept(v), T_::RglobalFunParam(ref __binding_0) => __binding_0.accept(v), T_::RglobalFunRet(ref __binding_0) => __binding_0.accept(v), T_::Rsplice(ref __binding_0) => __binding_0.accept(v), T_::RetBoolean(ref __binding_0) => __binding_0.accept(v), T_::RdefaultCapability(ref __binding_0) => __binding_0.accept(v), T_::RconcatOperand(ref __binding_0) => __binding_0.accept(v), T_::RinterpOperand(ref __binding_0) => __binding_0.accept(v), T_::RdynamicCoercion(ref __binding_0) => __binding_0.accept(v), T_::RsupportDynamicType(ref __binding_0) => __binding_0.accept(v), T_::RdynamicPartialEnforcement(ref __binding_0) => __binding_0.accept(v), T_::RrigidTvarEscape(ref __binding_0) => __binding_0.accept(v), T_::RopaqueTypeFromModule(ref __binding_0) => __binding_0.accept(v), T_::RmissingClass(ref __binding_0) => __binding_0.accept(v), T_::Rinvalid => {} } } } impl<'a> Node<'a> for Decls<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_decls(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Decls(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for TShapeField<'a> { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_tshape_field(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TShapeField(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for Variance { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_variance(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Variance::Covariant => {} Variance::Contravariant => {} Variance::Invariant => {} } } } impl<'a> Node<'a> for ConstraintKind { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_constraint_kind(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ConstraintKind::ConstraintAs => {} ConstraintKind::ConstraintEq => {} ConstraintKind::ConstraintSuper => {} } } } impl<'a> Node<'a> for Abstraction { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_abstraction(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Abstraction::Concrete => {} Abstraction::Abstract => {} } } } impl<'a> Node<'a> for ClassishKind { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_classish_kind(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ClassishKind::Cclass(ref __binding_0) => __binding_0.accept(v), ClassishKind::Cinterface => {} ClassishKind::Ctrait => {} ClassishKind::Cenum => {} ClassishKind::CenumClass(ref __binding_0) => __binding_0.accept(v), } } } impl<'a> Node<'a> for FunKind { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_fun_kind(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { FunKind::FSync => {} FunKind::FAsync => {} FunKind::FGenerator => {} FunKind::FAsyncGenerator => {} } } } impl<'a> Node<'a> for Visibility { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_visibility(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Visibility::Private => {} Visibility::Public => {} Visibility::Protected => {} Visibility::Internal => {} } } } impl<'a> Node<'a> for Tprim { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_tprim(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Tprim::Tnull => {} Tprim::Tvoid => {} Tprim::Tint => {} Tprim::Tbool => {} Tprim::Tfloat => {} Tprim::Tstring => {} Tprim::Tresource => {} Tprim::Tnum => {} Tprim::Tarraykey => {} Tprim::Tnoreturn => {} } } } impl<'a> Node<'a> for TypedefVisibility { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_typedef_visibility(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { TypedefVisibility::Transparent => {} TypedefVisibility::Opaque => {} TypedefVisibility::OpaqueModule => {} TypedefVisibility::CaseType => {} } } } impl<'a> Node<'a> for ReifyKind { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_reify_kind(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ReifyKind::Erased => {} ReifyKind::SoftReified => {} ReifyKind::Reified => {} } } } impl<'a> Node<'a> for ClassConstKind { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_class_const_kind(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ClassConstKind::CCAbstract(ref __binding_0) => __binding_0.accept(v), ClassConstKind::CCConcrete => {} } } } impl<'a> Node<'a> for Enforcement { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_enforcement(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Enforcement::Unenforced => {} Enforcement::Enforced => {} } } } impl<'a> Node<'a> for ArgPosition { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_arg_position(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { ArgPosition::Aonly => {} ArgPosition::Afirst => {} ArgPosition::Asecond => {} } } } impl<'a> Node<'a> for BlameSource { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_blame_source(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { BlameSource::BScall => {} BlameSource::BSlambda => {} BlameSource::BSassignment => {} BlameSource::BSoutOfScope => {} } } } impl<'a> Node<'a> for Tag { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_tag(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { Tag::Required => {} Tag::LateInit => {} } } } impl<'a> Node<'a> for XhpAttribute { fn accept(&'a self, v: &mut dyn Visitor<'a>) { v.visit_xhp_attribute(self) } fn recurse(&'a self, v: &mut dyn Visitor<'a>) { match self { XhpAttribute { tag: ref __binding_0, has_default: ref __binding_1, } => { { __binding_0.accept(v) } { __binding_1.accept(v) } } } } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/decl_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<<0f6a7ecb7b50461b7df35f10267fc90b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh #![allow(unused_imports)] #![allow(unused_variables)] use super::node::Node; use crate::ast_defs::*; use crate::ast_defs::{self}; use crate::direct_decl_parser::*; use crate::direct_decl_parser::{self}; use crate::shallow_decl_defs::*; use crate::shallow_decl_defs::{self}; use crate::t_shape_map::*; use crate::t_shape_map::{self}; use crate::typing_defs::*; use crate::typing_defs::{self}; use crate::typing_defs_core::*; use crate::typing_defs_core::{self}; use crate::typing_reason::*; use crate::typing_reason::{self}; use crate::xhp_attribute::*; use crate::xhp_attribute::{self}; use crate::*; pub trait Visitor<'a> { fn object(&mut self) -> &mut dyn Visitor<'a>; fn visit_id(&mut self, p: &'a Id<'a>) { p.recurse(self.object()) } fn visit_xhp_enum_value(&mut self, p: &'a XhpEnumValue<'a>) { p.recurse(self.object()) } fn visit_shallow_class_const(&mut self, p: &'a ShallowClassConst<'a>) { p.recurse(self.object()) } fn visit_shallow_typeconst(&mut self, p: &'a ShallowTypeconst<'a>) { p.recurse(self.object()) } fn visit_shallow_prop(&mut self, p: &'a ShallowProp<'a>) { p.recurse(self.object()) } fn visit_shallow_method(&mut self, p: &'a ShallowMethod<'a>) { p.recurse(self.object()) } fn visit_shallow_class(&mut self, p: &'a ShallowClass<'a>) { p.recurse(self.object()) } fn visit_decl(&mut self, p: &'a Decl<'a>) { p.recurse(self.object()) } fn visit_ifc_fun_decl(&mut self, p: &'a IfcFunDecl<'a>) { p.recurse(self.object()) } fn visit_type_origin(&mut self, p: &'a TypeOrigin<'a>) { p.recurse(self.object()) } fn visit_pos_string(&mut self, p: &'a PosString<'a>) { p.recurse(self.object()) } fn visit_pos_byte_string(&mut self, p: &'a PosByteString<'a>) { p.recurse(self.object()) } fn visit_tshape_field_name(&mut self, p: &'a TshapeFieldName<'a>) { p.recurse(self.object()) } fn visit_dependent_type(&mut self, p: &'a DependentType) { p.recurse(self.object()) } fn visit_user_attribute_param(&mut self, p: &'a UserAttributeParam<'a>) { p.recurse(self.object()) } fn visit_user_attribute(&mut self, p: &'a UserAttribute<'a>) { p.recurse(self.object()) } fn visit_tparam(&mut self, p: &'a Tparam<'a>) { p.recurse(self.object()) } fn visit_where_constraint(&mut self, p: &'a WhereConstraint<'a>) { p.recurse(self.object()) } fn visit_ty(&mut self, p: &'a Ty<'a>) { p.recurse(self.object()) } fn visit_neg_type(&mut self, p: &'a NegType<'a>) { p.recurse(self.object()) } fn visit_shape_field_type(&mut self, p: &'a ShapeFieldType<'a>) { p.recurse(self.object()) } fn visit_ty_(&mut self, p: &'a Ty_<'a>) { p.recurse(self.object()) } fn visit_taccess_type(&mut self, p: &'a TaccessType<'a>) { p.recurse(self.object()) } fn visit_exact(&mut self, p: &'a Exact<'a>) { p.recurse(self.object()) } fn visit_class_refinement(&mut self, p: &'a ClassRefinement<'a>) { p.recurse(self.object()) } fn visit_refined_const(&mut self, p: &'a RefinedConst<'a>) { p.recurse(self.object()) } fn visit_refined_const_bound(&mut self, p: &'a RefinedConstBound<'a>) { p.recurse(self.object()) } fn visit_refined_const_bounds(&mut self, p: &'a RefinedConstBounds<'a>) { p.recurse(self.object()) } fn visit_shape_type(&mut self, p: &'a ShapeType<'a>) { p.recurse(self.object()) } fn visit_capability(&mut self, p: &'a Capability<'a>) { p.recurse(self.object()) } fn visit_fun_implicit_params(&mut self, p: &'a FunImplicitParams<'a>) { p.recurse(self.object()) } fn visit_fun_type(&mut self, p: &'a FunType<'a>) { p.recurse(self.object()) } fn visit_possibly_enforced_ty(&mut self, p: &'a PossiblyEnforcedTy<'a>) { p.recurse(self.object()) } fn visit_fun_param(&mut self, p: &'a FunParam<'a>) { p.recurse(self.object()) } fn visit_class_const_from(&mut self, p: &'a ClassConstFrom<'a>) { p.recurse(self.object()) } fn visit_class_const_ref(&mut self, p: &'a ClassConstRef<'a>) { p.recurse(self.object()) } fn visit_const_decl(&mut self, p: &'a ConstDecl<'a>) { p.recurse(self.object()) } fn visit_fun_elt(&mut self, p: &'a FunElt<'a>) { p.recurse(self.object()) } fn visit_module_reference(&mut self, p: &'a ModuleReference<'a>) { p.recurse(self.object()) } fn visit_module_def_type(&mut self, p: &'a ModuleDefType<'a>) { p.recurse(self.object()) } fn visit_abstract_typeconst(&mut self, p: &'a AbstractTypeconst<'a>) { p.recurse(self.object()) } fn visit_concrete_typeconst(&mut self, p: &'a ConcreteTypeconst<'a>) { p.recurse(self.object()) } fn visit_typeconst(&mut self, p: &'a Typeconst<'a>) { p.recurse(self.object()) } fn visit_enum_type(&mut self, p: &'a EnumType<'a>) { p.recurse(self.object()) } fn visit_typedef_type(&mut self, p: &'a TypedefType<'a>) { p.recurse(self.object()) } fn visit_expr_dep_type_reason(&mut self, p: &'a ExprDepTypeReason<'a>) { p.recurse(self.object()) } fn visit_blame(&mut self, p: &'a Blame<'a>) { p.recurse(self.object()) } fn visit_t_(&mut self, p: &'a T_<'a>) { p.recurse(self.object()) } fn visit_decls(&mut self, p: &'a Decls<'a>) { p.recurse(self.object()) } fn visit_tshape_field(&mut self, p: &'a TShapeField<'a>) { p.recurse(self.object()) } fn visit_variance(&mut self, p: &'a Variance) { p.recurse(self.object()) } fn visit_constraint_kind(&mut self, p: &'a ConstraintKind) { p.recurse(self.object()) } fn visit_abstraction(&mut self, p: &'a Abstraction) { p.recurse(self.object()) } fn visit_classish_kind(&mut self, p: &'a ClassishKind) { p.recurse(self.object()) } fn visit_fun_kind(&mut self, p: &'a FunKind) { p.recurse(self.object()) } fn visit_visibility(&mut self, p: &'a Visibility) { p.recurse(self.object()) } fn visit_tprim(&mut self, p: &'a Tprim) { p.recurse(self.object()) } fn visit_typedef_visibility(&mut self, p: &'a TypedefVisibility) { p.recurse(self.object()) } fn visit_reify_kind(&mut self, p: &'a ReifyKind) { p.recurse(self.object()) } fn visit_class_const_kind(&mut self, p: &'a ClassConstKind) { p.recurse(self.object()) } fn visit_enforcement(&mut self, p: &'a Enforcement) { p.recurse(self.object()) } fn visit_arg_position(&mut self, p: &'a ArgPosition) { p.recurse(self.object()) } fn visit_blame_source(&mut self, p: &'a BlameSource) { p.recurse(self.object()) } fn visit_tag(&mut self, p: &'a Tag) { p.recurse(self.object()) } fn visit_xhp_attribute(&mut self, p: &'a XhpAttribute) { p.recurse(self.object()) } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<b81b36634ae444197c045dcfb60026b1>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; pub use ast_defs::Pos; pub use ast_defs::PositionedByteString; pub use ast_defs::Pstring; pub use local_id::LocalId; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; pub use oxidized::aast_defs::OgNullFlavor; pub use oxidized::aast_defs::PropOrMethod; pub use oxidized::aast_defs::ReifyKind; pub use oxidized::aast_defs::Tprim; pub use oxidized::aast_defs::TypedefVisibility; pub use oxidized::aast_defs::Visibility; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C)] pub struct Lid<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a LocalId<'a>, ); impl<'a> TrivialDrop for Lid<'a> {} arena_deserializer::impl_deserialize_in_arena!(Lid<'arena>); #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type Sid<'a> = ast_defs::Id<'a>; #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type ClassName<'a> = Sid<'a>; /// 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, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Program<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a [Def<'a, Ex, En>], ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Program<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Program<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Stmt<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Stmt_<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Stmt<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Stmt<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Stmt_<'a, Ex, En> { /// Marker for a switch statement that falls through. /// /// // FALLTHROUGH Fallthrough, /// Standalone expression. /// /// 1 + 2; #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Expr(&'a Expr<'a, 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; #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Throw(&'a Expr<'a, Ex, En>), /// Return, with an optional value. /// /// return; /// return $foo; #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Return(Option<&'a Expr<'a, 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(); /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Awaitall( &'a ( &'a [(Option<&'a Lid<'a>>, &'a Expr<'a, Ex, En>)], &'a Block<'a, Ex, En>, ), ), /// If statement. /// /// if ($foo) { ... } else { ... } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] If( &'a ( &'a Expr<'a, Ex, En>, &'a Block<'a, Ex, En>, &'a Block<'a, Ex, En>, ), ), /// Do-while loop. /// /// do { /// bar(); /// } while($foo) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Do(&'a (&'a Block<'a, Ex, En>, &'a Expr<'a, Ex, En>)), /// While loop. /// /// while ($foo) { /// bar(); /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] While(&'a (&'a Expr<'a, Ex, En>, &'a Block<'a, 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Using(&'a UsingStmt<'a, 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++) { ... } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] For( &'a ( &'a [&'a Expr<'a, Ex, En>], Option<&'a Expr<'a, Ex, En>>, &'a [&'a Expr<'a, Ex, En>], &'a Block<'a, Ex, En>, ), ), /// Switch statement. /// /// switch ($foo) { /// case X: /// bar(); /// break; /// default: /// baz(); /// break; /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Switch( &'a ( &'a Expr<'a, Ex, En>, &'a [Case<'a, Ex, En>], Option<DefaultCase<'a, Ex, En>>, ), ), /// Match statement. /// /// match ($x) { /// _: FooClass => { /// foo($x); /// } /// _ => { /// bar(); /// } /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Match(&'a StmtMatch<'a, 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<_> #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Foreach( &'a ( &'a Expr<'a, Ex, En>, AsExpr<'a, Ex, En>, &'a Block<'a, Ex, En>, ), ), /// Try statement, with catch blocks and a finally block. /// /// try { /// foo(); /// } catch (SomeException $e) { /// bar(); /// } finally { /// baz(); /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Try( &'a ( &'a Block<'a, Ex, En>, &'a [&'a Catch<'a, Ex, En>], &'a FinallyBlock<'a, 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Declare_local")] #[rust_to_ocaml(inline_tuple)] DeclareLocal(&'a (&'a Lid<'a>, &'a Hint<'a>, Option<&'a Expr<'a, Ex, En>>)), /// Block, a list of statements in curly braces. /// /// { $foo = 42; } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Block(&'a Block<'a, Ex, En>), /// The mode tag at the beginning of a file. /// TODO: this really belongs in def. /// /// <?hh #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] Markup(&'a Pstring<'a>), /// Used in IFC to track type inference environments. Not user /// denotable. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] #[rust_to_ocaml(inline_tuple)] AssertEnv( &'a ( &'a oxidized::aast_defs::EnvAnnot, LocalIdMap<'a, (&'a Pos<'a>, Ex)>, ), ), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Stmt_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Stmt_<'arena, Ex, En>); pub use oxidized::aast_defs::EnvAnnot; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "us_")] #[repr(C)] pub struct UsingStmt<'a, Ex, En> { pub is_block_scoped: bool, pub has_await: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub exprs: (&'a Pos<'a>, &'a [&'a Expr<'a, Ex, En>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub block: &'a Block<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for UsingStmt<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(UsingStmt<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum AsExpr<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "As_v")] AsV(&'a Expr<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "As_kv")] #[rust_to_ocaml(inline_tuple)] AsKv(&'a (&'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Await_as_v")] #[rust_to_ocaml(inline_tuple)] AwaitAsV(&'a (&'a Pos<'a>, &'a Expr<'a, Ex, En>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Await_as_kv")] #[rust_to_ocaml(inline_tuple)] AwaitAsKv(&'a (&'a Pos<'a>, &'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>)), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for AsExpr<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(AsExpr<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Block<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a [&'a Stmt<'a, Ex, En>], ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Block<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Block<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct FinallyBlock<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a [&'a Stmt<'a, Ex, En>], ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FinallyBlock<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FinallyBlock<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sm_")] #[repr(C)] pub struct StmtMatch<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub expr: &'a Expr<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub arms: &'a [&'a StmtMatchArm<'a, Ex, En>], } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for StmtMatch<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(StmtMatch<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sma_")] #[repr(C)] pub struct StmtMatchArm<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pat: Pattern<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub body: &'a Block<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for StmtMatchArm<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(StmtMatchArm<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Pattern<'a> { /// Variable patterns #[serde(deserialize_with = "arena_deserializer::arena", borrow)] PVar(&'a PatVar<'a>), /// Refinement patterns #[serde(deserialize_with = "arena_deserializer::arena", borrow)] PRefinement(&'a PatRefinement<'a>), } impl<'a> TrivialDrop for Pattern<'a> {} arena_deserializer::impl_deserialize_in_arena!(Pattern<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "pv_")] #[repr(C)] pub struct PatVar<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub pos: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub id: Option<&'a Lid<'a>>, } impl<'a> TrivialDrop for PatVar<'a> {} arena_deserializer::impl_deserialize_in_arena!(PatVar<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "pr_")] #[repr(C)] pub struct PatRefinement<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub pos: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub id: Option<&'a Lid<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub hint: &'a Hint<'a>, } impl<'a> TrivialDrop for PatRefinement<'a> {} arena_deserializer::impl_deserialize_in_arena!(PatRefinement<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassId<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena")] pub Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ClassId_<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassId<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassId<'arena, Ex, En>); /// Class ID, used in things like instantiation and static property access. #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassId_<'a, 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(); #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CIexpr(&'a Expr<'a, Ex, En>), /// Explicit class name. This is the common case. /// /// Foo::some_meth() /// Foo::$prop = 1; /// new Foo(); #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CI(&'a ClassName<'a>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassId_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassId_<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Expr<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena")] pub Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Expr_<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Expr<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Expr<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound(deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>"))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum CollectionTarg<'a, Ex> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CollectionTV(&'a Targ<'a, Ex>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] CollectionTKV(&'a (&'a Targ<'a, Ex>, &'a Targ<'a, Ex>)), } impl<'a, Ex: TrivialDrop> TrivialDrop for CollectionTarg<'a, Ex> {} arena_deserializer::impl_deserialize_in_arena!(CollectionTarg<'arena, Ex>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum FunctionPtrId<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "FP_id")] FPId(&'a Sid<'a>), /// An expression tree literal consists of a hint, splices, and /// expressions. Consider this example: /// /// Foo`1 + ${$x} + ${bar()}` #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "FP_class_const")] #[rust_to_ocaml(inline_tuple)] FPClassConst(&'a (&'a ClassId<'a, Ex, En>, &'a Pstring<'a>)), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FunctionPtrId<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FunctionPtrId<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "et_")] #[repr(C)] pub struct ExpressionTree<'a, Ex, En> { /// The hint before the backtick, so Foo in this example. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub hint: &'a Hint<'a>, /// The values spliced into expression tree at runtime are assigned /// to temporaries. /// /// $0tmp1 = $x; $0tmp2 = bar(); #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub splices: &'a [&'a Stmt<'a, Ex, En>], /// The list of global functions and static methods assigned to /// temporaries. /// /// $0fp1 = foo<>; #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub function_pointers: &'a [&'a Stmt<'a, Ex, En>], /// The expression that gets type checked. /// /// 1 + $0tmp1 + $0tmp2 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub virtualized_expr: &'a Expr<'a, Ex, En>, /// The expression that's executed at runtime. /// /// Foo::makeTree($v ==> $v->visitBinOp(...)) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub runtime_expr: &'a Expr<'a, 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub dollardollar_pos: Option<&'a Pos<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ExpressionTree<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ExpressionTree<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Expr_<'a, Ex, En> { /// darray literal. /// /// darray['x' => 0, 'y' => 1] /// darray<string, int>['x' => 0, 'y' => 1] #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Darray( &'a ( Option<&'a (&'a Targ<'a, Ex>, &'a Targ<'a, Ex>)>, &'a [(&'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>)], ), ), /// varray literal. /// /// varray['hello', 'world'] /// varray<string>['hello', 'world'] #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Varray(&'a (Option<&'a Targ<'a, Ex>>, &'a [&'a Expr<'a, Ex, En>])), /// Shape literal. /// /// shape('x' => 1, 'y' => 2) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Shape(&'a [(ast_defs::ShapeFieldName<'a>, &'a Expr<'a, Ex, En>)]), /// Collection literal for indexable structures. /// /// Vector {1, 2} /// ImmVector {} /// Set<string> {'foo', 'bar'} /// vec[1, 2] /// keyset[] #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] ValCollection( &'a ( (&'a Pos<'a>, oxidized::aast_defs::VcKind), Option<&'a Targ<'a, Ex>>, &'a [&'a Expr<'a, Ex, En>], ), ), /// Collection literal for key-value structures. /// /// dict['x' => 1, 'y' => 2] /// Map<int, string> {} /// ImmMap {} #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] KeyValCollection( &'a ( (&'a Pos<'a>, oxidized::aast_defs::KvcKind), Option<&'a (&'a Targ<'a, Ex>, &'a Targ<'a, Ex>)>, &'a [&'a Field<'a, 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(); /// } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Invalid(Option<&'a Expr<'a, Ex, En>>), /// An identifier. Used for method names and global constants. /// /// SOME_CONST /// $x->foo() // id: "foo" #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Id(&'a Sid<'a>), /// Local variable. /// /// $foo #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Lvar(&'a Lid<'a>), /// The extra variable in a pipe expression. /// /// $$ #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Dollardollar(&'a Lid<'a>), /// Clone expression. /// /// clone $foo #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Clone(&'a Expr<'a, Ex, En>), /// Array indexing. /// /// $foo[] /// $foo[$bar] #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Array_get")] #[rust_to_ocaml(inline_tuple)] ArrayGet(&'a (&'a Expr<'a, Ex, En>, Option<&'a Expr<'a, 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Obj_get")] #[rust_to_ocaml(inline_tuple)] ObjGet( &'a ( &'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>, &'a oxidized::aast_defs::OgNullFlavor, &'a oxidized::aast_defs::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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Class_get")] #[rust_to_ocaml(inline_tuple)] ClassGet( &'a ( &'a ClassId<'a, Ex, En>, ClassGetExpr<'a, Ex, En>, &'a oxidized::aast_defs::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() #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Class_const")] #[rust_to_ocaml(inline_tuple)] ClassConst(&'a (&'a ClassId<'a, Ex, En>, &'a Pstring<'a>)), /// 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; })() #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Call(&'a CallExpr<'a, Ex, En>), /// A reference to a function or method. /// /// foo_fun<> /// FooCls::meth<int> #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] FunctionPointer(&'a (FunctionPtrId<'a, Ex, En>, &'a [&'a Targ<'a, Ex>])), /// Integer literal. /// /// 42 /// 0123 // octal /// 0xBEEF // hexadecimal /// 0b11111111 // binary #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Int(&'a str), /// Float literal. /// /// 1.0 /// 1.2e3 /// 7E-10 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Float(&'a str), /// String literal. /// /// "foo" /// 'foo' /// /// <<<DOC /// foo /// DOC /// /// <<<'DOC' /// foo /// DOC #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] String(&'a bstr::BStr), /// Interpolated string literal. /// /// "hello $foo $bar" /// /// <<<DOC /// hello $foo $bar /// DOC #[serde(deserialize_with = "arena_deserializer::arena", borrow)] String2(&'a [&'a Expr<'a, Ex, En>]), /// Prefixed string literal. Only used for regular expressions. /// /// re"foo" #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] PrefixedString(&'a (&'a str, &'a Expr<'a, 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Yield(&'a Afield<'a, Ex, En>), /// Await expression. /// /// await $foo #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Await(&'a Expr<'a, Ex, En>), /// Readonly expression. /// /// readonly $foo #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ReadonlyExpr(&'a Expr<'a, Ex, En>), /// Tuple expression. /// /// tuple("a", 1, $foo) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tuple(&'a [&'a Expr<'a, 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; #[serde(deserialize_with = "arena_deserializer::arena", borrow)] List(&'a [&'a Expr<'a, Ex, En>]), /// Cast expression, converting a value to a different type. Only /// primitive types are supported in the hint position. /// /// (int)$foo /// (string)$foo #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Cast(&'a (&'a Hint<'a>, &'a Expr<'a, Ex, En>)), /// Unary operator. /// /// !$foo /// -$foo /// +$foo /// $foo++ #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Unop(&'a (oxidized::ast_defs::Uop, &'a Expr<'a, Ex, En>)), /// Binary operator. /// /// $foo + $bar #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Binop(&'a Binop<'a, 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(); #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Pipe(&'a (&'a Lid<'a>, &'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>)), /// Ternary operator, or elvis operator. /// /// $foo ? $bar : $baz // ternary /// $foo ?: $baz // elvis #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Eif( &'a ( &'a Expr<'a, Ex, En>, Option<&'a Expr<'a, Ex, En>>, &'a Expr<'a, Ex, En>, ), ), /// Is operator. /// /// $foo is SomeType #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Is(&'a (&'a Expr<'a, Ex, En>, &'a Hint<'a>)), /// As operator. /// /// $foo as int /// $foo ?as int #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] As(&'a (&'a Expr<'a, Ex, En>, &'a Hint<'a>, bool)), /// Upcast operator. /// /// $foo : int #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Upcast(&'a (&'a Expr<'a, Ex, En>, &'a Hint<'a>)), /// Instantiation. /// /// new Foo(1, 2); /// new Foo<int, T>(); /// new Foo('blah', ...$rest); #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] New( &'a ( &'a ClassId<'a, Ex, En>, &'a [&'a Targ<'a, Ex>], &'a [&'a Expr<'a, Ex, En>], Option<&'a Expr<'a, 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; } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Efun(&'a Efun<'a, Ex, En>), /// Hack lambda. Captures variables automatically. /// /// $x ==> $x /// (int $x): int ==> $x + $other /// ($x, $y) ==> { return $x + $y; } #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Lfun(&'a (&'a Fun_<'a, Ex, En>, &'a [&'a CaptureLid<'a, Ex>])), /// XHP expression. May contain interpolated expressions. /// /// <foo x="hello" y={$foo}>hello {$bar}</foo> #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Xml( &'a ( &'a ClassName<'a>, &'a [XhpAttribute<'a, Ex, En>], &'a [&'a Expr<'a, Ex, En>], ), ), /// Include or require expression. /// /// require('foo.php') /// require_once('foo.php') /// include('foo.php') /// include_once('foo.php') #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Import(&'a (oxidized::aast_defs::ImportFlavor, &'a Expr<'a, Ex, En>)), /// Collection literal. /// /// TODO: T38184446 this is redundant with ValCollection/KeyValCollection. /// /// Vector {} #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Collection( &'a ( &'a ClassName<'a>, Option<CollectionTarg<'a, Ex>>, &'a [Afield<'a, 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}` #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ExpressionTree(&'a ExpressionTree<'a, Ex, En>), /// Placeholder local variable. /// /// $_ #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] Lplaceholder(&'a Pos<'a>), /// 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) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Method_caller")] #[rust_to_ocaml(inline_tuple)] MethodCaller(&'a (&'a ClassName<'a>, &'a Pstring<'a>)), /// Pair literal. /// /// Pair {$foo, $bar} #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Pair( &'a ( Option<&'a (&'a Targ<'a, Ex>, &'a Targ<'a, Ex>)>, &'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>, ), ), /// Expression tree splice expression. Only valid inside an /// expression tree literal (backticks). See also `ExpressionTree`. /// /// ${$foo} #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "ET_Splice")] ETSplice(&'a Expr<'a, Ex, En>), /// Label used for enum classes. /// /// enum_name#label_name or #label_name #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] EnumClassLabel(&'a (Option<&'a ClassName<'a>>, &'a str)), /// 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 /// ) /// ``` #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Hole(&'a (&'a Expr<'a, Ex, En>, Ex, Ex, HoleSource<'a>)), /// Expression used to check whether a package exists. /// /// package package-name #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Package(&'a Sid<'a>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Expr_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Expr_<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum HoleSource<'a> { Typing, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] UnsafeCast(&'a [&'a Hint<'a>]), UnsafeNonnullCast, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] EnforcedCast(&'a [&'a Hint<'a>]), } impl<'a> TrivialDrop for HoleSource<'a> {} arena_deserializer::impl_deserialize_in_arena!(HoleSource<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Binop<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub bop: ast_defs::Bop<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub lhs: &'a Expr<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub rhs: &'a Expr<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Binop<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Binop<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassGetExpr<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CGstring(&'a Pstring<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CGexpr(&'a Expr<'a, Ex, En>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassGetExpr<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassGetExpr<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Case<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Expr<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Block<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Case<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Case<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct DefaultCase<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Block<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for DefaultCase<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(DefaultCase<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum GenCase<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Case(&'a Case<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Default(&'a DefaultCase<'a, Ex, En>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for GenCase<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(GenCase<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Catch<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a ClassName<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Lid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Block<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Catch<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Catch<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Field<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Expr<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Expr<'a, Ex, En>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Field<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Field<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Afield<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] AFvalue(&'a Expr<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] AFkvalue(&'a (&'a Expr<'a, Ex, En>, &'a Expr<'a, Ex, En>)), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Afield<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Afield<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "xs_")] #[repr(C)] pub struct XhpSimple<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub name: &'a Pstring<'a>, #[serde(deserialize_with = "arena_deserializer::arena")] pub type_: Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub expr: &'a Expr<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for XhpSimple<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(XhpSimple<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum XhpAttribute<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Xhp_simple")] XhpSimple(&'a XhpSimple<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Xhp_spread")] XhpSpread(&'a Expr<'a, Ex, En>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for XhpAttribute<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(XhpAttribute<'arena, Ex, En>); pub use oxidized::aast_defs::IsVariadic; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "param_")] #[repr(C)] pub struct FunParam<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_hint: &'a TypeHint<'a, Ex>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub is_variadic: &'a oxidized::aast_defs::IsVariadic, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub pos: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub expr: Option<&'a Expr<'a, Ex, En>>, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly: Option<oxidized::ast_defs::ReadonlyKind>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub callconv: ast_defs::ParamKind<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: Option<oxidized::aast_defs::Visibility>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FunParam<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FunParam<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "f_")] #[repr(C)] pub struct Fun_<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_this: Option<oxidized::ast_defs::ReadonlyKind>, #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, /// Whether the return value is readonly #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_ret: Option<oxidized::ast_defs::ReadonlyKind>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub ret: &'a TypeHint<'a, Ex>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub params: &'a [&'a FunParam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ctxs: Option<&'a Contexts<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub unsafe_ctxs: Option<&'a Contexts<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub body: &'a FuncBody<'a, Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub fun_kind: oxidized::ast_defs::FunKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, 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, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Fun_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Fun_<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound(deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>"))] #[rust_to_ocaml(and)] #[repr(C)] pub struct CaptureLid<'a, Ex>( #[serde(deserialize_with = "arena_deserializer::arena")] pub Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Lid<'a>, ); impl<'a, Ex: TrivialDrop> TrivialDrop for CaptureLid<'a, Ex> {} arena_deserializer::impl_deserialize_in_arena!(CaptureLid<'arena, Ex>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ef_")] #[repr(C)] pub struct Efun<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub fun: &'a Fun_<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub use_: &'a [&'a CaptureLid<'a, Ex>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub closure_class_name: Option<&'a str>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Efun<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Efun<'arena, Ex, En>); /// 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct FuncBody<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub fb_ast: &'a Block<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FuncBody<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FuncBody<'arena, 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound(deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>"))] #[rust_to_ocaml(and)] #[repr(C)] pub struct TypeHint<'a, Ex>( #[serde(deserialize_with = "arena_deserializer::arena")] pub Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a TypeHint_<'a>, ); impl<'a, Ex: TrivialDrop> TrivialDrop for TypeHint<'a, Ex> {} arena_deserializer::impl_deserialize_in_arena!(TypeHint<'arena, Ex>); /// 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound(deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>"))] #[rust_to_ocaml(and)] #[repr(C)] pub struct Targ<'a, Ex>( #[serde(deserialize_with = "arena_deserializer::arena")] pub Ex, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Hint<'a>, ); impl<'a, Ex: TrivialDrop> TrivialDrop for Targ<'a, Ex> {} arena_deserializer::impl_deserialize_in_arena!(Targ<'arena, Ex>); #[rust_to_ocaml(and)] pub type TypeHint_<'a> = Option<&'a Hint<'a>>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct CallExpr<'a, Ex, En> { /// function #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub func: &'a Expr<'a, Ex, En>, /// explicit type annotations #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub targs: &'a [&'a Targ<'a, Ex>], /// positional args, plus their calling convention #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub args: &'a [(ast_defs::ParamKind<'a>, &'a Expr<'a, Ex, En>)], /// unpacked arg #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub unpacked_arg: Option<&'a Expr<'a, Ex, En>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for CallExpr<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(CallExpr<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ua_")] #[repr(C)] pub struct UserAttribute<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, /// user attributes are restricted to scalar values #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub params: &'a [&'a Expr<'a, Ex, En>], } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for UserAttribute<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(UserAttribute<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fa_")] #[repr(C)] pub struct FileAttribute<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub namespace: &'a Nsenv<'a>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FileAttribute<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FileAttribute<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tp_")] #[repr(C)] pub struct Tparam<'a, Ex, En> { #[rust_to_ocaml(attr = "transform.opaque")] pub variance: oxidized::ast_defs::Variance, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub parameters: &'a [&'a Tparam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constraints: &'a [(oxidized::ast_defs::ConstraintKind, &'a Hint<'a>)], #[rust_to_ocaml(attr = "transform.opaque")] pub reified: oxidized::aast_defs::ReifyKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Tparam<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Tparam<'arena, Ex, En>); pub use oxidized::aast_defs::EmitId; pub use oxidized::aast_defs::RequireKind; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_")] #[repr(C)] pub struct Class_<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: oxidized::file_info::Mode, pub final_: bool, pub is_xhp: bool, pub has_xhp_keyword: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub kind: oxidized::ast_defs::ClassishKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: &'a ClassName<'a>, /// The type parameters of a class A<T> (T is the parameter) #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub tparams: &'a [&'a Tparam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub extends: &'a [&'a ClassHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub uses: &'a [&'a TraitHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub xhp_attr_uses: &'a [&'a XhpAttrHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub xhp_category: Option<&'a (&'a Pos<'a>, &'a [&'a Pstring<'a>])>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub reqs: &'a [&'a ClassReq<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub implements: &'a [&'a ClassHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraintHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub consts: &'a [&'a ClassConst<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub typeconsts: &'a [&'a ClassTypeconstDef<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub vars: &'a [&'a ClassVar<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub methods: &'a [&'a Method_<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_children: &'a [(&'a Pos<'a>, XhpChild<'a>)], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub xhp_attrs: &'a [&'a XhpAttr<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub namespace: &'a Nsenv<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file_attributes: &'a [&'a FileAttribute<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub docs_url: Option<&'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub enum_: Option<&'a Enum_<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub emit_id: Option<&'a oxidized::aast_defs::EmitId>, pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<Sid<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Class_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Class_<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassReq<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a ClassHint<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a oxidized::aast_defs::RequireKind, ); impl<'a> TrivialDrop for ClassReq<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassReq<'arena>); #[rust_to_ocaml(and)] pub type ClassHint<'a> = Hint<'a>; #[rust_to_ocaml(and)] pub type TraitHint<'a> = Hint<'a>; #[rust_to_ocaml(and)] pub type XhpAttrHint<'a> = Hint<'a>; pub use oxidized::aast_defs::XhpAttrTag; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct XhpAttr<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a TypeHint<'a, Ex>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a ClassVar<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a oxidized::aast_defs::XhpAttrTag>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a (&'a Pos<'a>, &'a [&'a Expr<'a, Ex, En>])>, ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for XhpAttr<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(XhpAttr<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassConstKind<'a, Ex, En> { /// CCAbstract represents the states /// abstract const int X; /// abstract const int Y = 4; /// The expr option is a default value #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CCAbstract(Option<&'a Expr<'a, Ex, En>>), /// CCConcrete represents /// const int Z = 4; /// The expr is the value of the constant. It is not optional #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CCConcrete(&'a Expr<'a, Ex, En>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassConstKind<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassConstKind<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cc_")] #[repr(C)] pub struct ClassConst<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub id: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub kind: ClassConstKind<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassConst<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassConst<'arena, Ex, En>); /// 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_atc_")] #[repr(C)] pub struct ClassAbstractTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub as_constraint: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub super_constraint: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub default: Option<&'a Hint<'a>>, } impl<'a> TrivialDrop for ClassAbstractTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassAbstractTypeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassConcreteTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub c_tc_type: &'a Hint<'a>, } impl<'a> TrivialDrop for ClassConcreteTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassConcreteTypeconst<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ClassTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TCAbstract(&'a ClassAbstractTypeconst<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TCConcrete(&'a ClassConcreteTypeconst<'a>), } impl<'a> TrivialDrop for ClassTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassTypeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "c_tconst_")] #[repr(C)] pub struct ClassTypeconstDef<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub kind: ClassTypeconst<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, pub is_ctx: bool, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassTypeconstDef<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassTypeconstDef<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "xai_")] #[repr(C)] pub struct XhpAttrInfo<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub like: Option<&'a Pos<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tag: Option<&'a oxidized::aast_defs::XhpAttrTag>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub enum_values: &'a [ast_defs::XhpEnumValue<'a>], } impl<'a> TrivialDrop for XhpAttrInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(XhpAttrInfo<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cv_")] #[repr(C)] pub struct ClassVar<'a, Ex, En> { pub final_: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_attr: Option<&'a XhpAttrInfo<'a>>, pub abstract_: bool, pub readonly: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: oxidized::aast_defs::Visibility, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub type_: &'a TypeHint<'a, Ex>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub id: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub expr: Option<&'a Expr<'a, Ex, En>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, pub is_promoted_variadic: bool, pub is_static: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ClassVar<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ClassVar<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "m_")] #[repr(C)] pub struct Method_<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, pub final_: bool, pub abstract_: bool, pub static_: bool, pub readonly_this: bool, #[rust_to_ocaml(attr = "transform.opaque")] pub visibility: oxidized::aast_defs::Visibility, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraintHint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub params: &'a [&'a FunParam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ctxs: Option<&'a Contexts<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub unsafe_ctxs: Option<&'a Contexts<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub body: &'a FuncBody<'a, Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub fun_kind: oxidized::ast_defs::FunKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[rust_to_ocaml(attr = "transform.opaque")] pub readonly_ret: Option<oxidized::ast_defs::ReadonlyKind>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub ret: &'a TypeHint<'a, Ex>, /// true if this declaration has no body because it is an external method /// declaration (e.g. from an HHI file) pub external: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Method_<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Method_<'arena, Ex, En>); #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type Nsenv<'a> = namespace_env::Env<'a>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "t_")] #[repr(C)] pub struct Typedef<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub as_constraint: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub super_constraint: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub kind: &'a Hint<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file_attributes: &'a [&'a FileAttribute<'a, Ex, En>], #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: oxidized::file_info::Mode, #[rust_to_ocaml(attr = "transform.opaque")] pub vis: oxidized::aast_defs::TypedefVisibility, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub namespace: &'a Nsenv<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub emit_id: Option<&'a oxidized::aast_defs::EmitId>, pub is_ctx: bool, pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<Sid<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub docs_url: Option<&'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Typedef<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Typedef<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cst_")] #[repr(C)] pub struct Gconst<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: oxidized::file_info::Mode, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub value: &'a Expr<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub namespace: &'a Nsenv<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub emit_id: Option<&'a oxidized::aast_defs::EmitId>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Gconst<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Gconst<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fd_")] #[repr(C)] pub struct FunDef<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub namespace: &'a Nsenv<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file_attributes: &'a [&'a FileAttribute<'a, Ex, En>], #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: oxidized::file_info::Mode, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Sid<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub fun: &'a Fun_<'a, Ex, En>, pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<Sid<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraintHint<'a>], } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for FunDef<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(FunDef<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "md_")] #[repr(C)] pub struct ModuleDef<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena")] pub annotation: En, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub name: ast_defs::Id<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a UserAttributes<'a, Ex, En>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file_attributes: &'a [&'a FileAttribute<'a, Ex, En>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub span: &'a Pos<'a>, #[rust_to_ocaml(attr = "visitors.opaque")] #[rust_to_ocaml(attr = "transform.opaque")] pub mode: oxidized::file_info::Mode, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub doc_comment: Option<&'a DocComment<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub exports: Option<&'a [MdNameKind<'a>]>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub imports: Option<&'a [MdNameKind<'a>]>, } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for ModuleDef<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(ModuleDef<'arena, Ex, En>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum MdNameKind<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] MDNameGlobal(&'a Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] MDNamePrefix(&'a Sid<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] MDNameExact(&'a Sid<'a>), } impl<'a> TrivialDrop for MdNameKind<'a> {} arena_deserializer::impl_deserialize_in_arena!(MdNameKind<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Def<'a, Ex, En> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Fun(&'a FunDef<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Class(&'a Class_<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Stmt(&'a Stmt<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Typedef(&'a Typedef<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Constant(&'a Gconst<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Namespace(&'a (Sid<'a>, &'a [Def<'a, Ex, En>])), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] NamespaceUse(&'a [(&'a oxidized::aast_defs::NsKind, Sid<'a>, Sid<'a>)]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] SetNamespaceEnv(&'a Nsenv<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] FileAttributes(&'a FileAttribute<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Module(&'a ModuleDef<'a, Ex, En>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] SetModule(&'a Sid<'a>), } impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for Def<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(Def<'arena, Ex, En>); pub use oxidized::aast_defs::NsKind; #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] pub type DocComment<'a> = ast_defs::Pstring<'a>; pub use oxidized::aast_defs::ImportFlavor; #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum XhpChild<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ChildName(&'a Sid<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ChildList(&'a [XhpChild<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] ChildUnary(&'a (XhpChild<'a>, oxidized::aast_defs::XhpChildOp)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] ChildBinary(&'a (XhpChild<'a>, XhpChild<'a>)), } impl<'a> TrivialDrop for XhpChild<'a> {} arena_deserializer::impl_deserialize_in_arena!(XhpChild<'arena>); pub use oxidized::aast_defs::XhpChildOp; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Hint<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Hint_<'a>, ); impl<'a> TrivialDrop for Hint<'a> {} arena_deserializer::impl_deserialize_in_arena!(Hint<'arena>); #[rust_to_ocaml(and)] pub type VariadicHint<'a> = Option<&'a Hint<'a>>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[serde(bound( deserialize = "Ex: 'de + arena_deserializer::DeserializeInArena<'de>, En: 'de + arena_deserializer::DeserializeInArena<'de>" ))] #[rust_to_ocaml(and)] #[repr(C)] pub struct UserAttributes<'a, Ex, En>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a [&'a UserAttribute<'a, Ex, En>], ); impl<'a, Ex: TrivialDrop, En: TrivialDrop> TrivialDrop for UserAttributes<'a, Ex, En> {} arena_deserializer::impl_deserialize_in_arena!(UserAttributes<'arena, Ex, En>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Contexts<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a [&'a Context<'a>], ); impl<'a> TrivialDrop for Contexts<'a> {} arena_deserializer::impl_deserialize_in_arena!(Contexts<'arena>); #[rust_to_ocaml(and)] pub type Context<'a> = Hint<'a>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, 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<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub kind: ast_defs::ParamKind<'a>, pub readonlyness: Option<oxidized::ast_defs::ReadonlyKind>, } impl<'a> TrivialDrop for HfParamInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(HfParamInfo<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "hf_")] #[repr(C)] pub struct HintFun<'a> { #[rust_to_ocaml(attr = "transform.opaque")] pub is_readonly: Option<oxidized::ast_defs::ReadonlyKind>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub param_tys: &'a [&'a Hint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub param_info: &'a [Option<&'a HfParamInfo<'a>>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub variadic_ty: &'a VariadicHint<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ctxs: Option<&'a Contexts<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.explicit")] pub return_ty: &'a Hint<'a>, #[rust_to_ocaml(attr = "transform.opaque")] pub is_readonly_return: Option<oxidized::ast_defs::ReadonlyKind>, } impl<'a> TrivialDrop for HintFun<'a> {} arena_deserializer::impl_deserialize_in_arena!(HintFun<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Hint_<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hoption(&'a Hint<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hlike(&'a Hint<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hfun(&'a HintFun<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Htuple(&'a [&'a Hint<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Happly(&'a (&'a ClassName<'a>, &'a [&'a Hint<'a>])), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hshape(&'a NastShapeInfo<'a>), /// 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 {} #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Haccess(&'a (&'a Hint<'a>, &'a [Sid<'a>])), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hsoft(&'a Hint<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Hrefinement(&'a (&'a Hint<'a>, &'a [Refinement<'a>])), Hany, Herr, Hmixed, Hwildcard, Hnonnull, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Habstr(&'a (&'a str, &'a [&'a Hint<'a>])), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Hvec_or_dict")] #[rust_to_ocaml(inline_tuple)] HvecOrDict(&'a (Option<&'a Hint<'a>>, &'a Hint<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hprim(&'a oxidized::aast_defs::Tprim), Hthis, Hdynamic, Hnothing, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hunion(&'a [&'a Hint<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hintersection(&'a [&'a Hint<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Hfun_context")] HfunContext(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Hvar(&'a str), } impl<'a> TrivialDrop for Hint_<'a> {} arena_deserializer::impl_deserialize_in_arena!(Hint_<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Refinement<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rctx(&'a (Sid<'a>, CtxRefinement<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rtype(&'a (Sid<'a>, TypeRefinement<'a>)), } impl<'a> TrivialDrop for Refinement<'a> {} arena_deserializer::impl_deserialize_in_arena!(Refinement<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum TypeRefinement<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TRexact(&'a Hint<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TRloose(&'a TypeRefinementBounds<'a>), } impl<'a> TrivialDrop for TypeRefinement<'a> {} arena_deserializer::impl_deserialize_in_arena!(TypeRefinement<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tr_")] #[repr(C)] pub struct TypeRefinementBounds<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub lower: &'a [&'a Hint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub upper: &'a [&'a Hint<'a>], } impl<'a> TrivialDrop for TypeRefinementBounds<'a> {} arena_deserializer::impl_deserialize_in_arena!(TypeRefinementBounds<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum CtxRefinement<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CRexact(&'a Hint<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CRloose(&'a CtxRefinementBounds<'a>), } impl<'a> TrivialDrop for CtxRefinement<'a> {} arena_deserializer::impl_deserialize_in_arena!(CtxRefinement<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "cr_")] #[repr(C)] pub struct CtxRefinementBounds<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub lower: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub upper: Option<&'a Hint<'a>>, } impl<'a> TrivialDrop for CtxRefinementBounds<'a> {} arena_deserializer::impl_deserialize_in_arena!(CtxRefinementBounds<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sfi_")] #[repr(C)] pub struct ShapeFieldInfo<'a> { pub optional: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub hint: &'a Hint<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "transform.opaque")] pub name: ast_defs::ShapeFieldName<'a>, } impl<'a> TrivialDrop for ShapeFieldInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeFieldInfo<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "nsi_")] #[repr(C)] pub struct NastShapeInfo<'a> { pub allows_unknown_fields: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub field_map: &'a [&'a ShapeFieldInfo<'a>], } impl<'a> TrivialDrop for NastShapeInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(NastShapeInfo<'arena>); pub use oxidized::aast_defs::KvcKind; pub use oxidized::aast_defs::VcKind; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "e_")] #[repr(C)] pub struct Enum_<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub base: &'a Hint<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constraint: Option<&'a Hint<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub includes: &'a [&'a Hint<'a>], } impl<'a> TrivialDrop for Enum_<'a> {} arena_deserializer::impl_deserialize_in_arena!(Enum_<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, 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<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Hint<'a>, pub oxidized::ast_defs::ConstraintKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Hint<'a>, ); impl<'a> TrivialDrop for WhereConstraintHint<'a> {} arena_deserializer::impl_deserialize_in_arena!(WhereConstraintHint<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<f427e293843f8825a2841b7dc2415dcc>> // // 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::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_<'a> = str; #[derive( Clone, Copy, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct Id<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Id_<'a>, ); impl<'a> TrivialDrop for Id<'a> {} arena_deserializer::impl_deserialize_in_arena!(Id<'arena>); #[rust_to_ocaml(and)] pub type Pstring<'a> = (&'a Pos<'a>, &'a str); #[rust_to_ocaml(and)] pub type ByteString<'a> = str; #[rust_to_ocaml(and)] pub type PositionedByteString<'a> = (&'a Pos<'a>, &'a bstr::BStr); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum ShapeFieldName<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "SFlit_int")] SFlitInt(&'a Pstring<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "SFlit_str")] SFlitStr(&'a PositionedByteString<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "SFclass_const")] #[rust_to_ocaml(inline_tuple)] SFclassConst(&'a (Id<'a>, &'a Pstring<'a>)), } impl<'a> TrivialDrop for ShapeFieldName<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeFieldName<'arena>); pub use oxidized::ast_defs::Abstraction; pub use oxidized::ast_defs::ClassishKind; pub use oxidized::ast_defs::ConstraintKind; pub use oxidized::ast_defs::Variance; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum ParamKind<'a> { /// Contains the position for an entire `inout` annotated expression, e.g.: /// /// foo(inout $bar); /// ^^^^^^^^^^ #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Pinout(&'a Pos<'a>), Pnormal, } impl<'a> TrivialDrop for ParamKind<'a> {} arena_deserializer::impl_deserialize_in_arena!(ParamKind<'arena>); pub use oxidized::ast_defs::FunKind; pub use oxidized::ast_defs::OgNullFlavor; pub use oxidized::ast_defs::PropOrMethod; pub use oxidized::ast_defs::ReadonlyKind; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum Bop<'a> { /// 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, /// =, +=, -=, ... #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Eq(Option<&'a Bop<'a>>), } impl<'a> TrivialDrop for Bop<'a> {} arena_deserializer::impl_deserialize_in_arena!(Bop<'arena>); pub use oxidized::ast_defs::Uop; pub use oxidized::ast_defs::Visibility; /// Literal values that can occur in XHP enum properties. /// /// class :my-xhp-class { /// attribute enum {'big', 'small'} my-prop; /// } #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "transform.opaque")] #[repr(C, u8)] pub enum XhpEnumValue<'a> { #[rust_to_ocaml(name = "XEV_Int")] XEVInt(isize), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "XEV_String")] XEVString(&'a str), } impl<'a> TrivialDrop for XhpEnumValue<'a> {} arena_deserializer::impl_deserialize_in_arena!(XhpEnumValue<'arena>); pub use oxidized::ast_defs::ReifyKind; pub use oxidized::ast_defs::Tprim; pub use oxidized::ast_defs::TypedefVisibility;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<a5113df8c1279f500ed10d16affa9f87>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum VersionedPattError<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Error_v1")] ErrorV1(&'a patt_error::PattError<'a>), } impl<'a> TrivialDrop for VersionedPattError<'a> {} arena_deserializer::impl_deserialize_in_arena!(VersionedPattError<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum VersionedErrorMessage<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Message_v1")] MessageV1(&'a error_message::ErrorMessage<'a>), } impl<'a> TrivialDrop for VersionedErrorMessage<'a> {} arena_deserializer::impl_deserialize_in_arena!(VersionedErrorMessage<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct CustomError<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub patt: VersionedPattError<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub error_message: VersionedErrorMessage<'a>, } impl<'a> TrivialDrop for CustomError<'a> {} arena_deserializer::impl_deserialize_in_arena!(CustomError<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<c9bf242ea153714ce7d72bb11b59dfdf>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(attr = "boxed")] #[repr(C)] pub struct CustomErrorConfig<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub valid: &'a [custom_error::CustomError<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub invalid: &'a [custom_error::CustomError<'a>], } impl<'a> TrivialDrop for CustomErrorConfig<'a> {} arena_deserializer::impl_deserialize_in_arena!(CustomErrorConfig<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<aa626adf7069408ff2f7a1b99ed48c3f>> // // 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::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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, ord)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct SubstContext<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub subst: s_map::SMap<'a, &'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub class_context: &'a str, pub from_req_extends: bool, } impl<'a> TrivialDrop for SubstContext<'a> {} arena_deserializer::impl_deserialize_in_arena!(SubstContext<'arena>); pub use oxidized::decl_defs::SourceType; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum DeclError<'a> { #[rust_to_ocaml(name = "Wrong_extend_kind")] WrongExtendKind { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pos: &'a pos::Pos<'a>, kind: oxidized::ast_defs::ClassishKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] name: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] parent_pos: &'a pos_or_decl::PosOrDecl<'a>, parent_kind: oxidized::ast_defs::ClassishKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] parent_name: &'a str, }, #[rust_to_ocaml(name = "Cyclic_class_def")] CyclicClassDef { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pos: &'a pos::Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] stack: s_set::SSet<'a>, }, } impl<'a> TrivialDrop for DeclError<'a> {} arena_deserializer::impl_deserialize_in_arena!(DeclError<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "dc_")] #[repr(C)] pub struct DeclClassType<'a> { pub need_init: bool, pub abstract_: bool, pub final_: bool, pub const_: bool, pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub deferred_init_members: s_set::SSet<'a>, pub kind: oxidized::ast_defs::ClassishKind, pub is_xhp: bool, pub has_xhp_keyword: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<ast_defs::Id<'a>>, pub is_module_level_trait: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraint<'a>], /// class name to the subst_context that must be applied to that class #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub substs: s_map::SMap<'a, &'a SubstContext<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub consts: s_map::SMap<'a, &'a ClassConst<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub typeconsts: s_map::SMap<'a, &'a TypeconstType<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub props: s_map::SMap<'a, &'a Element<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub sprops: s_map::SMap<'a, &'a Element<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub methods: s_map::SMap<'a, &'a Element<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub smethods: s_map::SMap<'a, &'a Element<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub construct: (Option<&'a Element<'a>>, ConsistentKind), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ancestors: s_map::SMap<'a, &'a Ty<'a>>, pub support_dynamic_type: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_ancestors: &'a [&'a Requirement<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_ancestors_extends: s_set::SSet<'a>, /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_class_ancestors: &'a [&'a Requirement<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub extends: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub sealed_whitelist: Option<s_set::SSet<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_attr_deps: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_enum_values: s_map::SMap<'a, &'a [ast_defs::XhpEnumValue<'a>]>, pub xhp_marked_empty: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub enum_type: Option<&'a EnumType<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub decl_errors: &'a [DeclError<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub docs_url: Option<&'a str>, } impl<'a> TrivialDrop for DeclClassType<'a> {} arena_deserializer::impl_deserialize_in_arena!(DeclClassType<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "elt_")] #[repr(C)] pub struct Element<'a> { pub flags: typing_defs_flags::class_elt::ClassElt, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub origin: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub visibility: CeVisibility<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub deprecated: Option<&'a str>, } impl<'a> TrivialDrop for Element<'a> {} arena_deserializer::impl_deserialize_in_arena!(Element<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<c9bfb8b7cc78857b432d31eb7a5ff7fa>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show, ord)")] #[repr(C, u8)] pub enum DeclReference<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] GlobalConstant(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Function(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Type(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Module(&'a str), } impl<'a> TrivialDrop for DeclReference<'a> {} arena_deserializer::impl_deserialize_in_arena!(DeclReference<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<4dc517f09c9acf71e5cd9bb3d3d5b3eb>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum Elem<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Lit(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ty_var")] TyVar(&'a patt_var::PattVar<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Name_var")] NameVar(&'a patt_var::PattVar<'a>), } impl<'a> TrivialDrop for Elem<'a> {} arena_deserializer::impl_deserialize_in_arena!(Elem<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct ErrorMessage<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub message: &'a [Elem<'a>], } impl<'a> TrivialDrop for ErrorMessage<'a> {} arena_deserializer::impl_deserialize_in_arena!(ErrorMessage<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/file_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<<fb5ff079a89c68380480970d4f614b8b>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use ocamlrep_caml_builtins::Int64; pub use oxidized::file_info::Mode; pub use oxidized::file_info::NameType; pub use prim_defs::*; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; /// We define two types of positions establishing the location of a given name: /// a Full position contains the exact position of a name in a file, and a /// File position contains just the file and the type of toplevel entity, /// allowing us to lazily retrieve the name's exact location if necessary. #[derive( Clone, Copy, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum Pos<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Full(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] File( &'a ( oxidized::file_info::NameType, &'a relative_path::RelativePath<'a>, ), ), } impl<'a> TrivialDrop for Pos<'a> {} arena_deserializer::impl_deserialize_in_arena!(Pos<'arena>); /// An id contains a pos, name and a optional decl hash. The decl hash is None /// only in the case when we didn't compute it for performance reasons #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct Id<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a Int64>, ); impl<'a> TrivialDrop for Id<'a> {} arena_deserializer::impl_deserialize_in_arena!(Id<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving eq")] #[repr(C)] pub struct HashType<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Option<&'a Int64>, ); impl<'a> TrivialDrop for HashType<'a> {} arena_deserializer::impl_deserialize_in_arena!(HashType<'arena>); /// The record produced by the parsing phase. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct FileInfo<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub hash: &'a HashType<'a>, pub file_mode: Option<oxidized::file_info::Mode>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub funs: &'a [&'a Id<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub classes: &'a [&'a Id<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub typedefs: &'a [&'a Id<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub consts: &'a [&'a Id<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub modules: &'a [&'a Id<'a>], /// None if loaded from saved state #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub comments: Option<&'a [(&'a pos::Pos<'a>, Comment<'a>)]>, } impl<'a> TrivialDrop for FileInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(FileInfo<'arena>); pub use oxidized::file_info::Names; /// The simplified record stored in saved-state. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(prefix = "sn_")] #[repr(C)] pub struct SavedNames<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub funs: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub classes: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub types: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub consts: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub modules: s_set::SSet<'a>, } impl<'a> TrivialDrop for SavedNames<'a> {} arena_deserializer::impl_deserialize_in_arena!(SavedNames<'arena>); #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Diff<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub removed_funs: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub added_funs: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub removed_classes: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub added_classes: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub removed_types: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub added_types: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub removed_consts: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub added_consts: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub removed_modules: s_set::SSet<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub added_modules: s_set::SSet<'a>, } impl<'a> TrivialDrop for Diff<'a> {} arena_deserializer::impl_deserialize_in_arena!(Diff<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<9f072f8c3bcc6d2b481c2cd3f7578681>> // // 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_reference; pub mod error_message; pub mod file_info; pub mod namespace_env; pub mod naming_types; pub mod nast; pub mod package; pub mod package_info; 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 prim_defs; pub mod saved_state_rollouts; pub mod scoured_comments; pub mod shallow_decl_defs; pub mod typing_defs; pub mod typing_defs_core; pub mod typing_reason; pub mod validation_err; pub mod xhp_attribute;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<368257bd4c4688bbc50cd37c51ed2c99>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, 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<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "opaque")] pub ns_uses: s_map::SMap<'a, &'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "opaque")] pub class_uses: s_map::SMap<'a, &'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "opaque")] pub fun_uses: s_map::SMap<'a, &'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(attr = "opaque")] pub const_uses: s_map::SMap<'a, &'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Option<&'a str>, pub is_codegen: bool, pub disable_xhp_element_mangling: bool, } impl<'a> TrivialDrop for Env<'a> {} arena_deserializer::impl_deserialize_in_arena!(Env<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/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<<62a09967f3cfd6bc4dd7bac1920eecae>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use oxidized::naming_types::KindOfType; pub use oxidized::naming_types::NameKind; #[allow(unused_imports)] use crate::*;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/nast.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<<e1f7c4315534fa030ee38848de1e0dab>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use aast::ClassHint; pub use aast::Hint; pub use aast::Sid; pub use aast::TraitHint; pub use aast::XhpAttrHint; use arena_trait::TrivialDrop; pub use ast_defs::ShapeFieldName; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; pub use crate::ast_defs::shape_map; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving show")] pub type Program<'a> = aast::Program<'a, (), ()>; pub type Def<'a> = aast::Def<'a, (), ()>; #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type Expr<'a> = aast::Expr<'a, (), ()>; pub type Expr_<'a> = aast::Expr_<'a, (), ()>; pub type Stmt<'a> = aast::Stmt<'a, (), ()>; pub type Block<'a> = aast::Block<'a, (), ()>; #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type UserAttribute<'a> = aast::UserAttribute<'a, (), ()>; #[rust_to_ocaml(attr = "deriving eq")] pub type ClassId_<'a> = aast::ClassId_<'a, (), ()>; pub type Class_<'a> = aast::Class_<'a, (), ()>; pub type ClassVar<'a> = aast::ClassVar<'a, (), ()>; pub type Method_<'a> = aast::Method_<'a, (), ()>; pub type FileAttribute<'a> = aast::FileAttribute<'a, (), ()>; pub type Fun_<'a> = aast::Fun_<'a, (), ()>; pub type CaptureLid<'a> = aast::CaptureLid<'a, ()>; pub type Efun<'a> = aast::Efun<'a, (), ()>; pub type FunDef<'a> = aast::FunDef<'a, (), ()>; pub type FuncBody<'a> = aast::FuncBody<'a, (), ()>; pub type FunParam<'a> = aast::FunParam<'a, (), ()>; pub type Typedef<'a> = aast::Typedef<'a, (), ()>; pub type Tparam<'a> = aast::Tparam<'a, (), ()>; pub type Gconst<'a> = aast::Gconst<'a, (), ()>; pub type ClassConst<'a> = aast::ClassConst<'a, (), ()>; pub type ClassId<'a> = aast::ClassId<'a, (), ()>; pub type Catch<'a> = aast::Catch<'a, (), ()>; pub type Case<'a> = aast::Case<'a, (), ()>; pub type StmtMatch<'a> = aast::StmtMatch<'a, (), ()>; pub type StmtMatchArm<'a> = aast::StmtMatchArm<'a, (), ()>; pub type DefaultCase<'a> = aast::DefaultCase<'a, (), ()>; pub type GenCase<'a> = aast::GenCase<'a, (), ()>; pub type Field<'a> = aast::Field<'a, (), ()>; pub type Afield<'a> = aast::Afield<'a, (), ()>; pub type XhpAttribute<'a> = aast::XhpAttribute<'a, (), ()>; pub type ExpressionTree<'a> = aast::ExpressionTree<'a, (), ()>; pub type Targ<'a> = aast::Targ<'a, ()>; pub type TypeHint<'a> = aast::TypeHint<'a, ()>; pub type ModuleDef<'a> = aast::ModuleDef<'a, (), ()>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct IgnoreAttributeEnv<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ignored_attributes: &'a [&'a str], } impl<'a> TrivialDrop for IgnoreAttributeEnv<'a> {} arena_deserializer::impl_deserialize_in_arena!(IgnoreAttributeEnv<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<816964a7858f754b9c9dc19c7a7ac8fc>> // // 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct PosId<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a pos::Pos<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a str, ); impl<'a> TrivialDrop for PosId<'a> {} arena_deserializer::impl_deserialize_in_arena!(PosId<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct Package<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: &'a PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub uses: &'a [&'a PosId<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub includes: &'a [&'a PosId<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub soft_includes: &'a [&'a PosId<'a>], } impl<'a> TrivialDrop for Package<'a> {} arena_deserializer::impl_deserialize_in_arena!(Package<'arena>); #[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_by_ref/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<<bbff39aecb12a1efd0015747e28cacda>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct PackageInfo<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub glob_to_package: s_map::SMap<'a, &'a package::Package<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub existing_packages: s_map::SMap<'a, &'a package::Package<'a>>, } impl<'a> TrivialDrop for PackageInfo<'a> {} arena_deserializer::impl_deserialize_in_arena!(PackageInfo<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<81f3e6cb37f9bc0dfb3feab41b70da02>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use oxidized::patt_binding_ty::PattBindingTy; #[allow(unused_imports)] use crate::*;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<554751c6b1c8c482caaf712ff0a6f573>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattError<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Primary(&'a oxidized::patt_error::Primary), #[rust_to_ocaml(prefix = "patt_")] Apply { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] cb: &'a oxidized::patt_error::Callback, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] err: &'a PattError<'a>, }, #[rust_to_ocaml(prefix = "patt_")] #[rust_to_ocaml(name = "Apply_reasons")] ApplyReasons { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] rsns_cb: &'a oxidized::patt_error::ReasonsCallback, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] secondary: &'a Secondary<'a>, }, #[rust_to_ocaml(prefix = "patt_")] Or { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] fst: &'a PattError<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] snd: &'a PattError<'a>, }, Invalid { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] errs: &'a [validation_err::ValidationErr<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] patt: &'a PattError<'a>, }, } impl<'a> TrivialDrop for PattError<'a> {} arena_deserializer::impl_deserialize_in_arena!(PattError<'arena>); pub use oxidized::patt_error::Primary; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Secondary<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Of_error")] OfError(&'a PattError<'a>), #[rust_to_ocaml(prefix = "patt_")] #[rust_to_ocaml(name = "Violated_constraint")] ViolatedConstraint { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] cstr: patt_string::PattString<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ty_sub: patt_locl_ty::PattLoclTy<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ty_sup: patt_locl_ty::PattLoclTy<'a>, }, #[rust_to_ocaml(prefix = "patt_ty_")] #[rust_to_ocaml(name = "Subtyping_error")] SubtypingError { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] sub: patt_locl_ty::PattLoclTy<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] sup: patt_locl_ty::PattLoclTy<'a>, }, #[rust_to_ocaml(name = "Any_snd")] AnySnd, } impl<'a> TrivialDrop for Secondary<'a> {} arena_deserializer::impl_deserialize_in_arena!(Secondary<'arena>); pub use oxidized::patt_error::Callback; pub use oxidized::patt_error::ReasonsCallback;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<e95a5ef8ef6ac2ee707fdfa4bcf42b2d>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattLoclTy<'a> { #[rust_to_ocaml(prefix = "patt_")] Apply { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] name: patt_name::PattName<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] params: &'a Params<'a>, }, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Prim(&'a oxidized::patt_locl_ty::Prim), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Shape(&'a ShapeFields<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Option(&'a PattLoclTy<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tuple(&'a [PattLoclTy<'a>]), Dynamic, Nonnull, Any, #[rust_to_ocaml(prefix = "patt_")] Or { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] fst: &'a PattLoclTy<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] snd: &'a PattLoclTy<'a>, }, As { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] lbl: &'a patt_var::PattVar<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] patt: &'a PattLoclTy<'a>, }, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Invalid(&'a (&'a [validation_err::ValidationErr<'a>], PattLoclTy<'a>)), } impl<'a> TrivialDrop for PattLoclTy<'a> {} arena_deserializer::impl_deserialize_in_arena!(PattLoclTy<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Params<'a> { Nil, Wildcard, #[rust_to_ocaml(prefix = "patt_")] Cons { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] hd: PattLoclTy<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] tl: &'a Params<'a>, }, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Exists(&'a PattLoclTy<'a>), } impl<'a> TrivialDrop for Params<'a> {} arena_deserializer::impl_deserialize_in_arena!(Params<'arena>); pub use oxidized::patt_locl_ty::Prim; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum ShapeFields<'a> { #[rust_to_ocaml(prefix = "patt_")] Fld { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] fld: ShapeField<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] rest: &'a ShapeFields<'a>, }, Open, Closed, } impl<'a> TrivialDrop for ShapeFields<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeFields<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ShapeField<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub lbl: ShapeLabel<'a>, pub optional: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub patt: &'a PattLoclTy<'a>, } impl<'a> TrivialDrop for ShapeField<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeField<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] StrLbl(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] IntLbl(&'a str), CConstLbl { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] cls_nm: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] cnst_nm: &'a str, }, } impl<'a> TrivialDrop for ShapeLabel<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeLabel<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<8dcd55d500eb9fb523fa66bdedb6afa6>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C, u8)] pub enum PattName<'a> { As { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] lbl: &'a patt_var::PattVar<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] patt: &'a PattName<'a>, }, #[rust_to_ocaml(prefix = "patt_")] Name { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] namespace: Namespace<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] name: patt_string::PattString<'a>, }, Wildcard, Invalid { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] errs: &'a [validation_err::ValidationErr<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] patt: &'a PattName<'a>, }, } impl<'a> TrivialDrop for PattName<'a> {} arena_deserializer::impl_deserialize_in_arena!(PattName<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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<'a> { Root, Slash { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] prefix: &'a Namespace<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] elt: patt_string::PattString<'a>, }, } impl<'a> TrivialDrop for Namespace<'a> {} arena_deserializer::impl_deserialize_in_arena!(Namespace<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<b482705793fe914788b26dded209874f>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum PattString<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Exactly(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Starts_with")] StartsWith(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ends_with")] EndsWith(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Contains(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Or(&'a [PattString<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] And(&'a [PattString<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Not(&'a PattString<'a>), } impl<'a> TrivialDrop for PattString<'a> {} arena_deserializer::impl_deserialize_in_arena!(PattString<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<4826549779f63262bf6fb1a12042cc65>> // // 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<'a> = str;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<a4c5bf9eaa0c0dff42bcc3607d98c32e>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; 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<'a> = pos::Pos<'a>; /// The decl and file of a position. #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C)] pub struct Ctx<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub decl: Option<decl_reference::DeclReference<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file: &'a relative_path::RelativePath<'a>, } impl<'a> TrivialDrop for Ctx<'a> {} arena_deserializer::impl_deserialize_in_arena!(Ctx<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/prim_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<<3848445b90ddb2b2d90914f70d82da6c>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum Comment<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CmtLine(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CmtBlock(&'a str), } impl<'a> TrivialDrop for Comment<'a> {} arena_deserializer::impl_deserialize_in_arena!(Comment<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<3b5e5d7c7962e66bdae7d01579254161>> // // 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, FromOcamlRepIn, 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, } impl TrivialDrop for SavedStateRollouts {} arena_deserializer::impl_deserialize_in_arena!(SavedStateRollouts); #[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 = str;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<0e6541cebeeacf54b2561a67b7c474d0>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh use arena_trait::TrivialDrop; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[rust_to_ocaml(attr = "deriving (show, eq)")] pub type Fixmes<'a> = i_map::IMap<'a, i_map::IMap<'a, &'a pos::Pos<'a>>>; #[derive( Clone, Debug, Deserialize, Eq, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (show, eq)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct ScouredComments<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub comments: &'a [(&'a pos::Pos<'a>, prim_defs::Comment<'a>)], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub fixmes: &'a Fixmes<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub misuses: &'a Fixmes<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub error_pos: &'a [&'a pos::Pos<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub bad_ignore_pos: &'a [&'a pos::Pos<'a>], } impl<'a> TrivialDrop for ScouredComments<'a> {} arena_deserializer::impl_deserialize_in_arena!(ScouredComments<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<63b5781d77a345d0550d3f22669c709c>> // // 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::FromOcamlRepIn; 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "scc_")] #[repr(C)] pub struct ShallowClassConst<'a> { pub abstract_: oxidized::typing_defs::ClassConstKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: typing_defs::PosId<'a>, /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub refs: &'a [typing_defs::ClassConstRef<'a>], } impl<'a> TrivialDrop for ShallowClassConst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShallowClassConst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "stc_")] #[repr(C)] pub struct ShallowTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: typing_defs::PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub kind: typing_defs::Typeconst<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub enforceable: (&'a pos_or_decl::PosOrDecl<'a>, bool), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub reifiable: Option<&'a pos_or_decl::PosOrDecl<'a>>, pub is_ctx: bool, } impl<'a> TrivialDrop for ShallowTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShallowTypeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sp_")] #[repr(C)] pub struct ShallowProp<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: typing_defs::PosId<'a>, pub xhp_attr: Option<XhpAttr>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, pub visibility: oxidized::ast_defs::Visibility, pub flags: prop_flags::PropFlags, } impl<'a> TrivialDrop for ShallowProp<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShallowProp<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sm_")] #[repr(C)] pub struct ShallowMethod<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: typing_defs::PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, pub visibility: oxidized::ast_defs::Visibility, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub deprecated: Option<&'a str>, pub flags: method_flags::MethodFlags, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub attributes: &'a [&'a UserAttribute<'a>], } impl<'a> TrivialDrop for ShallowMethod<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShallowMethod<'arena>); #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type XhpEnumValues<'a> = s_map::SMap<'a, &'a [ast_defs::XhpEnumValue<'a>]>; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[rust_to_ocaml(prefix = "sc_")] #[repr(C)] pub struct ShallowClass<'a> { pub mode: oxidized::file_info::Mode, pub final_: bool, pub abstract_: bool, pub is_xhp: bool, pub internal: bool, pub has_xhp_keyword: bool, pub kind: oxidized::ast_defs::ClassishKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<ast_defs::Id<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: typing_defs::PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub extends: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub uses: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_attr_uses: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub xhp_enum_values: s_map::SMap<'a, &'a [ast_defs::XhpEnumValue<'a>]>, pub xhp_marked_empty: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_extends: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_implements: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub req_class: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub implements: &'a [&'a Ty<'a>], pub support_dynamic_type: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub consts: &'a [&'a ShallowClassConst<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub typeconsts: &'a [&'a ShallowTypeconst<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub props: &'a [&'a ShallowProp<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub sprops: &'a [&'a ShallowProp<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constructor: Option<&'a ShallowMethod<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub static_methods: &'a [&'a ShallowMethod<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub methods: &'a [&'a ShallowMethod<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a [&'a UserAttribute<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub enum_type: Option<&'a EnumType<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub docs_url: Option<&'a str>, } impl<'a> TrivialDrop for ShallowClass<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShallowClass<'arena>); #[rust_to_ocaml(attr = "deriving show")] pub type FunDecl<'a> = FunElt<'a>; #[rust_to_ocaml(attr = "deriving show")] pub type ClassDecl<'a> = ShallowClass<'a>; #[rust_to_ocaml(attr = "deriving show")] pub type TypedefDecl<'a> = TypedefType<'a>; #[rust_to_ocaml(attr = "deriving show")] pub type ModuleDecl<'a> = typing_defs::ModuleDefType<'a>; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum Decl<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Class(&'a ClassDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Fun(&'a FunDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Typedef(&'a TypedefDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Const(&'a ConstDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Module(&'a ModuleDecl<'a>), } impl<'a> TrivialDrop for Decl<'a> {} arena_deserializer::impl_deserialize_in_arena!(Decl<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<5c069f61badd26a4321ba2a1d6effeb8>> // // 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::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, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C, u8)] pub enum ClassConstFrom<'a> { #[rust_to_ocaml(name = "Self")] Self_, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] From(&'a str), } impl<'a> TrivialDrop for ClassConstFrom<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassConstFrom<'arena>); /// 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, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, show)")] #[repr(C)] pub struct ClassConstRef<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ClassConstFrom<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a str, ); impl<'a> TrivialDrop for ClassConstRef<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassConstRef<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "cd_")] #[repr(C)] pub struct ConstDecl<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, } impl<'a> TrivialDrop for ConstDecl<'a> {} arena_deserializer::impl_deserialize_in_arena!(ConstDecl<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "ce_")] #[repr(C)] pub struct ClassElt<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub visibility: CeVisibility<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a lazy::Lazy<&'a Ty<'a>>, /// identifies the class from which this elt originates #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub origin: &'a str, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub deprecated: Option<&'a str>, /// pos of the type of the elt #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a lazy::Lazy<&'a pos_or_decl::PosOrDecl<'a>>, pub flags: typing_defs_flags::class_elt::ClassElt, } impl<'a> TrivialDrop for ClassElt<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassElt<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "fe_")] #[repr(C)] pub struct FunElt<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub deprecated: Option<&'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<ast_defs::Id<'a>>, /// Top-level functions have limited visibilities pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, pub php_std_lib: bool, pub support_dynamic_type: bool, pub no_auto_dynamic: bool, pub no_auto_likes: bool, } impl<'a> TrivialDrop for FunElt<'a> {} arena_deserializer::impl_deserialize_in_arena!(FunElt<'arena>); pub use oxidized::typing_defs::ClassConstKind; #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "cc_")] #[repr(C)] pub struct ClassConst<'a> { pub synthesized: bool, pub abstract_: oxidized::typing_defs::ClassConstKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, /// identifies the class from which this const originates #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub origin: &'a str, /// references to the constants used in the initializer #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub refs: &'a [ClassConstRef<'a>], } impl<'a> TrivialDrop for ClassConst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassConst<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum ModuleReference<'a> { MRGlobal, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] MRPrefix(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] MRExact(&'a str), } impl<'a> TrivialDrop for ModuleReference<'a> {} arena_deserializer::impl_deserialize_in_arena!(ModuleReference<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "mdt_")] #[repr(C)] pub struct ModuleDefType<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub exports: Option<&'a [ModuleReference<'a>]>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub imports: Option<&'a [ModuleReference<'a>]>, } impl<'a> TrivialDrop for ModuleDefType<'a> {} arena_deserializer::impl_deserialize_in_arena!(ModuleDefType<'arena>); /// 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[repr(C)] pub struct Requirement<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Ty<'a>, ); impl<'a> TrivialDrop for Requirement<'a> {} arena_deserializer::impl_deserialize_in_arena!(Requirement<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "atc_")] #[repr(C)] pub struct AbstractTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub as_constraint: Option<&'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub super_constraint: Option<&'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub default: Option<&'a Ty<'a>>, } impl<'a> TrivialDrop for AbstractTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(AbstractTypeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ConcreteTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tc_type: &'a Ty<'a>, } impl<'a> TrivialDrop for ConcreteTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(ConcreteTypeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "patc_")] #[repr(C)] pub struct PartiallyAbstractTypeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constraint: &'a Ty<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, } impl<'a> TrivialDrop for PartiallyAbstractTypeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(PartiallyAbstractTypeconst<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Typeconst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TCAbstract(&'a AbstractTypeconst<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TCConcrete(&'a ConcreteTypeconst<'a>), } impl<'a> TrivialDrop for Typeconst<'a> {} arena_deserializer::impl_deserialize_in_arena!(Typeconst<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ttc_")] #[repr(C)] pub struct TypeconstType<'a> { pub synthesized: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub kind: Typeconst<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub origin: &'a str, /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub enforceable: (&'a pos_or_decl::PosOrDecl<'a>, bool), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub reifiable: Option<&'a pos_or_decl::PosOrDecl<'a>>, pub concretized: bool, pub is_ctx: bool, } impl<'a> TrivialDrop for TypeconstType<'a> {} arena_deserializer::impl_deserialize_in_arena!(TypeconstType<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub base: &'a Ty<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constraint: Option<&'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub includes: &'a [&'a Ty<'a>], } impl<'a> TrivialDrop for EnumType<'a> {} arena_deserializer::impl_deserialize_in_arena!(EnumType<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[rust_to_ocaml(prefix = "td_")] #[repr(C)] pub struct TypedefType<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub module: Option<ast_defs::Id<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, pub vis: oxidized::ast_defs::TypedefVisibility, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub as_constraint: Option<&'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub super_constraint: Option<&'a Ty<'a>>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, pub is_ctx: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub attributes: &'a [&'a UserAttribute<'a>], pub internal: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub docs_url: Option<&'a str>, } impl<'a> TrivialDrop for TypedefType<'a> {} arena_deserializer::impl_deserialize_in_arena!(TypedefType<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum DeserializationError<'a> { /// The type was valid, but some component thereof was a decl_ty when we /// expected a locl_phase ty, or vice versa. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Wrong_phase")] WrongPhase(&'a str), /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Not_supported")] NotSupported(&'a str), /// The input JSON was invalid for some reason. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Deserialization_error")] DeserializationError(&'a str), } impl<'a> TrivialDrop for DeserializationError<'a> {} arena_deserializer::impl_deserialize_in_arena!(DeserializationError<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<5df09e7bcd3abfa6a016e00669296eb0>> // // 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::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, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, ord, show)")] #[repr(C, u8)] pub enum CeVisibility<'a> { Vpublic, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Vprivate(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Vprotected(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Vinternal(&'a str), } impl<'a> TrivialDrop for CeVisibility<'a> {} arena_deserializer::impl_deserialize_in_arena!(CeVisibility<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord)")] #[repr(C, u8)] pub enum IfcFunDecl<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] FDPolicied(Option<&'a str>), FDInferFlows, } impl<'a> TrivialDrop for IfcFunDecl<'a> {} arena_deserializer::impl_deserialize_in_arena!(IfcFunDecl<'arena>); #[rust_to_ocaml(attr = "deriving (eq, hash, ord)")] pub type CrossPackageDecl<'a> = Option<&'a str>; pub use oxidized::typing_defs_core::FunTparamsKind; pub use oxidized::typing_defs_core::ValKind; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C, u8)] pub enum TypeOrigin<'a> { #[rust_to_ocaml(name = "Missing_origin")] MissingOrigin, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "From_alias")] FromAlias(&'a str), } impl<'a> TrivialDrop for TypeOrigin<'a> {} arena_deserializer::impl_deserialize_in_arena!(TypeOrigin<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C)] pub struct PosString<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a str, ); impl<'a> TrivialDrop for PosString<'a> {} arena_deserializer::impl_deserialize_in_arena!(PosString<'arena>); #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] pub type TByteString<'a> = str; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C)] pub struct PosByteString<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a bstr::BStr, ); impl<'a> TrivialDrop for PosByteString<'a> {} arena_deserializer::impl_deserialize_in_arena!(PosByteString<'arena>); #[derive( Clone, Copy, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, ord, show)")] #[repr(C, u8)] pub enum TshapeFieldName<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "TSFlit_int")] TSFlitInt(&'a PosString<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "TSFlit_str")] TSFlitStr(&'a PosByteString<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "TSFclass_const")] #[rust_to_ocaml(inline_tuple)] TSFclassConst(&'a (PosId<'a>, PosString<'a>)), } impl<'a> TrivialDrop for TshapeFieldName<'a> {} arena_deserializer::impl_deserialize_in_arena!(TshapeFieldName<'arena>); pub use oxidized::typing_defs_core::ParamMode; #[rust_to_ocaml(attr = "deriving (eq, show)")] pub type XhpAttr = oxidized::xhp_attribute::XhpAttribute; pub use oxidized::typing_defs_core::ConsistentKind; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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), } impl TrivialDrop for DependentType {} arena_deserializer::impl_deserialize_in_arena!(DependentType); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[repr(C, u8)] pub enum UserAttributeParam<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Classname(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] EnumClassLabel(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] String(&'a bstr::BStr), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Int(&'a str), } impl<'a> TrivialDrop for UserAttributeParam<'a> {} arena_deserializer::impl_deserialize_in_arena!(UserAttributeParam<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub params: &'a [UserAttributeParam<'a>], } impl<'a> TrivialDrop for UserAttribute<'a> {} arena_deserializer::impl_deserialize_in_arena!(UserAttribute<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, 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<'a> { pub variance: oxidized::ast_defs::Variance, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: PosId<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub constraints: &'a [(oxidized::ast_defs::ConstraintKind, &'a Ty<'a>)], pub reified: oxidized::ast_defs::ReifyKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub user_attributes: &'a [&'a UserAttribute<'a>], } impl<'a> TrivialDrop for Tparam<'a> {} arena_deserializer::impl_deserialize_in_arena!(Tparam<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash, show)")] #[repr(C)] pub struct WhereConstraint<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Ty<'a>, pub oxidized::ast_defs::ConstraintKind, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Ty<'a>, ); impl<'a> TrivialDrop for WhereConstraint<'a> {} arena_deserializer::impl_deserialize_in_arena!(WhereConstraint<'arena>); pub use oxidized::typing_defs_core::Enforcement; #[derive( Clone, Debug, Deserialize, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Serialize, ToOcamlRep )] #[repr(C)] pub struct Ty<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a reason::T_<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub Ty_<'a>, ); impl<'a> TrivialDrop for Ty<'a> {} arena_deserializer::impl_deserialize_in_arena!(Ty<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum NegType<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Neg_prim")] NegPrim(&'a oxidized::ast_defs::Tprim), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Neg_class")] NegClass(&'a PosId<'a>), } impl<'a> TrivialDrop for NegType<'a> {} arena_deserializer::impl_deserialize_in_arena!(NegType<'arena>); /// 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, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "sft_")] #[repr(C)] pub struct ShapeFieldType<'a> { pub optional: bool, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ty: &'a Ty<'a>, } impl<'a> TrivialDrop for ShapeFieldType<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeFieldType<'arena>); #[derive( Clone, Copy, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Ty_<'a> { /// The late static bound type of a class Tthis, /// Either an object type or a type alias, ty list are the arguments #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Tapply(&'a (PosId<'a>, &'a [&'a Ty<'a>])), /// 'With' refinements of the form `_ with { type T as int; type TC = C; }`. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Trefinement(&'a (&'a Ty<'a>, ClassRefinement<'a>)), /// "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, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tlike(&'a Ty<'a>), 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Toption(&'a Ty<'a>), /// All the primitive types: int, string, void, etc. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tprim(&'a oxidized::ast_defs::Tprim), /// A wrapper around fun_type, which contains the full type information for a /// function, method, lambda, etc. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tfun(&'a FunType<'a>), /// Tuple, with ordered list of the types of the elements of the tuple. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Ttuple(&'a [&'a Ty<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tshape(&'a ShapeType<'a>), /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Tgeneric(&'a (&'a str, &'a [&'a Ty<'a>])), /// 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tunion(&'a [&'a Ty<'a>]), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tintersection(&'a [&'a Ty<'a>]), /// Tvec_or_dict (ty1, ty2) => "vec_or_dict<ty1, ty2>" #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Tvec_or_dict")] #[rust_to_ocaml(inline_tuple)] TvecOrDict(&'a (&'a Ty<'a>, &'a Ty<'a>)), /// Name of class, name of type const, remaining names of type consts #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Taccess(&'a TaccessType<'a>), /// 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Tnewtype(&'a (&'a str, &'a [&'a Ty<'a>], &'a Ty<'a>)), 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. #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Tunapplied_alias")] TunappliedAlias(&'a str), /// see dependent_type #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Tdependent(&'a (DependentType, &'a Ty<'a>)), /// 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 #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Tclass(&'a (PosId<'a>, Exact<'a>, &'a [&'a Ty<'a>])), /// The negation of the type in neg_type #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Tneg(&'a NegType<'a>), } impl<'a> TrivialDrop for Ty_<'a> {} arena_deserializer::impl_deserialize_in_arena!(Ty_<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct TaccessType<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub &'a Ty<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub PosId<'a>, ); impl<'a> TrivialDrop for TaccessType<'a> {} arena_deserializer::impl_deserialize_in_arena!(TaccessType<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Exact<'a> { Exact, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Nonexact(&'a ClassRefinement<'a>), } impl<'a> TrivialDrop for Exact<'a> {} arena_deserializer::impl_deserialize_in_arena!(Exact<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct ClassRefinement<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub cr_consts: s_map::SMap<'a, RefinedConst<'a>>, } impl<'a> TrivialDrop for ClassRefinement<'a> {} arena_deserializer::impl_deserialize_in_arena!(ClassRefinement<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "rc_")] #[repr(C)] pub struct RefinedConst<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub bound: RefinedConstBound<'a>, pub is_ctx: bool, } impl<'a> TrivialDrop for RefinedConst<'a> {} arena_deserializer::impl_deserialize_in_arena!(RefinedConst<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum RefinedConstBound<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TRexact(&'a Ty<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] TRloose(&'a RefinedConstBounds<'a>), } impl<'a> TrivialDrop for RefinedConstBound<'a> {} arena_deserializer::impl_deserialize_in_arena!(RefinedConstBound<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "tr_")] #[repr(C)] pub struct RefinedConstBounds<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub lower: &'a [&'a Ty<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub upper: &'a [&'a Ty<'a>], } impl<'a> TrivialDrop for RefinedConstBounds<'a> {} arena_deserializer::impl_deserialize_in_arena!(RefinedConstBounds<'arena>); /// Whether all fields of this shape are known, types of each of the /// known arms. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "s_")] #[repr(C)] pub struct ShapeType<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub origin: TypeOrigin<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub unknown_value: &'a Ty<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub fields: t_shape_map::TShapeMap<'a, &'a ShapeFieldType<'a>>, } impl<'a> TrivialDrop for ShapeType<'a> {} arena_deserializer::impl_deserialize_in_arena!(ShapeType<'arena>); #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C, u8)] pub enum Capability<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CapDefaults(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] CapTy(&'a Ty<'a>), } impl<'a> TrivialDrop for Capability<'a> {} arena_deserializer::impl_deserialize_in_arena!(Capability<'arena>); /// Companion to fun_params type, intended to consolidate checking of /// implicit params for functions. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[repr(C)] pub struct FunImplicitParams<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub capability: Capability<'a>, } impl<'a> TrivialDrop for FunImplicitParams<'a> {} arena_deserializer::impl_deserialize_in_arena!(FunImplicitParams<'arena>); /// The type of a function AND a method. #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "ft_")] #[repr(C)] pub struct FunType<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub tparams: &'a [&'a Tparam<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub where_constraints: &'a [&'a WhereConstraint<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub params: &'a FunParams<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub implicit_params: &'a FunImplicitParams<'a>, /// Carries through the sync/async information from the aast #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ret: &'a PossiblyEnforcedTy<'a>, pub flags: typing_defs_flags::FunTypeFlags, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub ifc_decl: IfcFunDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub cross_package: CrossPackageDecl<'a>, } impl<'a> TrivialDrop for FunType<'a> {} arena_deserializer::impl_deserialize_in_arena!(FunType<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "et_")] #[repr(C)] pub struct PossiblyEnforcedTy<'a> { /// True if consumer of this type enforces it at runtime pub enforced: oxidized::typing_defs_core::Enforcement, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a Ty<'a>, } impl<'a> TrivialDrop for PossiblyEnforcedTy<'a> {} arena_deserializer::impl_deserialize_in_arena!(PossiblyEnforcedTy<'arena>); #[derive( Clone, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(and)] #[rust_to_ocaml(prefix = "fp_")] #[repr(C)] pub struct FunParam<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub pos: &'a pos_or_decl::PosOrDecl<'a>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub name: Option<&'a str>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub type_: &'a PossiblyEnforcedTy<'a>, pub flags: typing_defs_flags::FunParamFlags, } impl<'a> TrivialDrop for FunParam<'a> {} arena_deserializer::impl_deserialize_in_arena!(FunParam<'arena>); #[rust_to_ocaml(and)] #[rust_to_ocaml(attr = "deriving hash")] pub type FunParams<'a> = [&'a FunParam<'a>];
Rust
hhvm/hphp/hack/src/oxidized_by_ref/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<<3a4dfa2e87ef77c367607023f710fddf>> // // 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::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<'a> = (&'a pos_or_decl::PosOrDecl<'a>, &'a ast_defs::Id_<'a>); pub use oxidized::typing_reason::ArgPosition; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(C, u8)] pub enum ExprDepTypeReason<'a> { ERexpr(isize), ERstatic, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ERclass(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ERparent(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ERself(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] ERpu(&'a str), } impl<'a> TrivialDrop for ExprDepTypeReason<'a> {} arena_deserializer::impl_deserialize_in_arena!(ExprDepTypeReason<'arena>); pub use oxidized::typing_reason::BlameSource; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (eq, hash)")] #[repr(C, u8)] pub enum Blame<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Blame(&'a (&'a pos::Pos<'a>, oxidized::typing_reason::BlameSource)), } impl<'a> TrivialDrop for Blame<'a> {} arena_deserializer::impl_deserialize_in_arena!(Blame<'arena>); /// The reason why something is expected to have a certain type #[derive( Clone, Copy, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving hash")] #[repr(C, u8)] pub enum T_<'a> { Rnone, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rwitness(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rwitness_from_decl")] RwitnessFromDecl(&'a pos_or_decl::PosOrDecl<'a>), /// Used as an index into a vector-like /// array or string. Position of indexing, /// reason for the indexed type #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Ridx(&'a (&'a pos::Pos<'a>, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ridx_vector")] RidxVector(&'a pos::Pos<'a>), /// Used as an index, in the Vector case #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ridx_vector_from_decl")] RidxVectorFromDecl(&'a pos_or_decl::PosOrDecl<'a>), /// Because it is iterated in a foreach loop #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rforeach(&'a pos::Pos<'a>), /// Because it is iterated "await as" in foreach #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rasyncforeach(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rarith(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rarith_ret")] RarithRet(&'a pos::Pos<'a>), /// pos, arg float typing reason, arg position #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rarith_ret_float")] #[rust_to_ocaml(inline_tuple)] RarithRetFloat( &'a ( &'a pos::Pos<'a>, T_<'a>, oxidized::typing_reason::ArgPosition, ), ), /// pos, arg num typing reason, arg position #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rarith_ret_num")] #[rust_to_ocaml(inline_tuple)] RarithRetNum( &'a ( &'a pos::Pos<'a>, T_<'a>, oxidized::typing_reason::ArgPosition, ), ), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rarith_ret_int")] RarithRetInt(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rarith_dynamic")] RarithDynamic(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rbitwise_dynamic")] RbitwiseDynamic(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rincdec_dynamic")] RincdecDynamic(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rcomp(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rconcat_ret")] RconcatRet(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rlogic_ret")] RlogicRet(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rbitwise(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rbitwise_ret")] RbitwiseRet(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rno_return")] RnoReturn(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rno_return_async")] RnoReturnAsync(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rret_fun_kind")] #[rust_to_ocaml(inline_tuple)] RretFunKind(&'a (&'a pos::Pos<'a>, oxidized::ast_defs::FunKind)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rret_fun_kind_from_decl")] #[rust_to_ocaml(inline_tuple)] RretFunKindFromDecl(&'a (&'a pos_or_decl::PosOrDecl<'a>, oxidized::ast_defs::FunKind)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rhint(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rthrow(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rplaceholder(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rret_div")] RretDiv(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ryield_gen")] RyieldGen(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ryield_asyncgen")] RyieldAsyncgen(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ryield_asyncnull")] RyieldAsyncnull(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ryield_send")] RyieldSend(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rlost_info")] #[rust_to_ocaml(inline_tuple)] RlostInfo(&'a (&'a str, T_<'a>, Blame<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rformat(&'a (&'a pos::Pos<'a>, &'a str, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rclass_class")] #[rust_to_ocaml(inline_tuple)] RclassClass(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Runknown_class")] RunknownClass(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rvar_param")] RvarParam(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rvar_param_from_decl")] RvarParamFromDecl(&'a pos_or_decl::PosOrDecl<'a>), /// splat pos, fun def pos, number of args before splat #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Runpack_param")] #[rust_to_ocaml(inline_tuple)] RunpackParam(&'a (&'a pos::Pos<'a>, &'a pos_or_decl::PosOrDecl<'a>, isize)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rinout_param")] RinoutParam(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rinstantiate(&'a (T_<'a>, &'a str, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rtypeconst( &'a ( T_<'a>, (&'a pos_or_decl::PosOrDecl<'a>, &'a str), &'a lazy::Lazy<&'a str>, T_<'a>, ), ), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rtype_access")] #[rust_to_ocaml(inline_tuple)] RtypeAccess(&'a (T_<'a>, &'a [(&'a T_<'a>, &'a lazy::Lazy<&'a str>)])), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rexpr_dep_type")] #[rust_to_ocaml(inline_tuple)] RexprDepType( &'a ( T_<'a>, &'a pos_or_decl::PosOrDecl<'a>, ExprDepTypeReason<'a>, ), ), /// ?-> operator is used #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rnullsafe_op")] RnullsafeOp(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rtconst_no_cstr")] RtconstNoCstr(&'a PosId<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rpredicated(&'a (&'a pos::Pos<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Ris(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Ras(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Requal(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rvarray_or_darray_key")] RvarrayOrDarrayKey(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rvec_or_dict_key")] RvecOrDictKey(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rusing(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdynamic_prop")] RdynamicProp(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdynamic_call")] RdynamicCall(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdynamic_construct")] RdynamicConstruct(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ridx_dict")] RidxDict(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rset_element")] RsetElement(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rmissing_optional_field")] #[rust_to_ocaml(inline_tuple)] RmissingOptionalField(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Runset_field")] #[rust_to_ocaml(inline_tuple)] RunsetField(&'a (&'a pos::Pos<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rcontravariant_generic")] #[rust_to_ocaml(inline_tuple)] RcontravariantGeneric(&'a (T_<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rinvariant_generic")] #[rust_to_ocaml(inline_tuple)] RinvariantGeneric(&'a (T_<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rregex(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rimplicit_upper_bound")] #[rust_to_ocaml(inline_tuple)] RimplicitUpperBound(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rtype_variable")] RtypeVariable(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rtype_variable_generics")] #[rust_to_ocaml(inline_tuple)] RtypeVariableGenerics(&'a (&'a pos::Pos<'a>, &'a str, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rtype_variable_error")] RtypeVariableError(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rglobal_type_variable_generics")] #[rust_to_ocaml(inline_tuple)] RglobalTypeVariableGenerics(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rsolve_fail")] RsolveFail(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rcstr_on_generics")] #[rust_to_ocaml(inline_tuple)] RcstrOnGenerics(&'a (&'a pos_or_decl::PosOrDecl<'a>, PosId<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rlambda_param")] #[rust_to_ocaml(inline_tuple)] RlambdaParam(&'a (&'a pos::Pos<'a>, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Rshape(&'a (&'a pos::Pos<'a>, &'a str)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rshape_literal")] RshapeLiteral(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Renforceable(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rdestructure(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rkey_value_collection_key")] RkeyValueCollectionKey(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rglobal_class_prop")] RglobalClassProp(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rglobal_fun_param")] RglobalFunParam(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rglobal_fun_ret")] RglobalFunRet(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Rsplice(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ret_boolean")] RetBoolean(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdefault_capability")] RdefaultCapability(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rconcat_operand")] RconcatOperand(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rinterp_operand")] RinterpOperand(&'a pos::Pos<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdynamic_coercion")] RdynamicCoercion(&'a T_<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rsupport_dynamic_type")] RsupportDynamicType(&'a pos_or_decl::PosOrDecl<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rdynamic_partial_enforcement")] #[rust_to_ocaml(inline_tuple)] RdynamicPartialEnforcement(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rrigid_tvar_escape")] #[rust_to_ocaml(inline_tuple)] RrigidTvarEscape(&'a (&'a pos::Pos<'a>, &'a str, &'a str, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Ropaque_type_from_module")] #[rust_to_ocaml(inline_tuple)] RopaqueTypeFromModule(&'a (&'a pos_or_decl::PosOrDecl<'a>, &'a str, T_<'a>)), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(name = "Rmissing_class")] RmissingClass(&'a pos::Pos<'a>), Rinvalid, } impl<'a> TrivialDrop for T_<'a> {} arena_deserializer::impl_deserialize_in_arena!(T_<'arena>); pub type Reason<'a> = T_<'a>; pub type DeclT<'a> = T_<'a>; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving show")] #[repr(C, u8)] pub enum Ureason<'a> { URnone, URassign, #[rust_to_ocaml(name = "URassign_inout")] URassignInout, URhint, URreturn, URforeach, URthrow, URvector, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] URkey(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] URvalue(&'a str), URawait, URyield, /// Name of XHP class, Name of XHP attribute #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] URxhp(&'a (&'a str, &'a str)), #[rust_to_ocaml(name = "URxhp_spread")] URxhpSpread, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] URindex(&'a str), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] URelement(&'a str), 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, } impl<'a> TrivialDrop for Ureason<'a> {} arena_deserializer::impl_deserialize_in_arena!(Ureason<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/validation_err.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<<d6584c49e865d3a71dee62de07acc351>> // // 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::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[allow(unused_imports)] use crate::*; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] #[rust_to_ocaml(attr = "deriving (compare, eq, sexp, show)")] #[repr(C, u8)] pub enum ValidationErr<'a> { #[serde(deserialize_with = "arena_deserializer::arena", borrow)] #[rust_to_ocaml(inline_tuple)] Mismatch( &'a ( &'a oxidized::patt_binding_ty::PattBindingTy, &'a oxidized::patt_binding_ty::PattBindingTy, ), ), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Shadowed(&'a patt_var::PattVar<'a>), #[serde(deserialize_with = "arena_deserializer::arena", borrow)] Unbound(&'a patt_var::PattVar<'a>), } impl<'a> TrivialDrop for ValidationErr<'a> {} arena_deserializer::impl_deserialize_in_arena!(ValidationErr<'arena>);
Rust
hhvm/hphp/hack/src/oxidized_by_ref/gen/xhp_attribute.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<<a6bd61584082d894cbc5908b69710d9a>> // // To regenerate this file, run: // hphp/hack/src/oxidized_regen.sh pub use oxidized::xhp_attribute::Tag; pub use oxidized::xhp_attribute::XhpAttribute; #[allow(unused_imports)] use crate::*;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/ast_defs_impl.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 bstr::BStr; use crate::ast_defs::*; use crate::pos::Pos; impl<'a> ShapeFieldName<'a> { pub fn get_name(&self) -> &'a BStr { use ShapeFieldName::*; match self { SFlitInt((_, name)) | SFclassConst((_, (_, name))) => name.as_bytes().into(), SFlitStr((_, name)) => name, } } pub fn get_pos(&self) -> &'a Pos<'_> { use ShapeFieldName::*; match self { SFlitInt((p, _)) | SFlitStr((p, _)) | SFclassConst((_, (p, _))) => p, } } } impl<'a> Id<'a> { pub fn pos(&self) -> &'a Pos<'_> { self.0 } pub fn name(&self) -> &'a str { self.1 } } impl std::fmt::Debug for Id<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Id({:?}, {:?})", self.pos(), self.name()) } } impl<'a> Bop<'a> { pub fn is_any_eq(&self) -> bool { match self { Self::Eq(_) => true, _ => false, } } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/decl_counters.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. pub type TracingInfo<'a> = ();
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/decl_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. pub type Env<'a> = ();
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/direct_decl_parser.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 arena_collections::List; use arena_trait::TrivialDrop; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use oxidized::file_info::NameType; use serde::Deserialize; use serde::Serialize; pub use shallow_decl_defs::Decl; use crate::file_info; use crate::shallow_decl_defs; use crate::typing_defs; /// WARNING: This type has not undergone the processing that you often expect in the typechecker, /// e.g. deregistering PHPStdLib symbols, or putting into forward lexical order, or removing /// duplicates. It's often a good idea to use ParsedFileWithHashes instead (or rather, one of /// its wrappers). /// NB: Must keep in sync with OCaml type Direct_decl_parser.parsed_file #[derive(Debug, Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Deserialize, FromOcamlRepIn, NoPosHash, Serialize, ToOcamlRep)] pub struct ParsedFile<'a> { /// Was the file Hack or HHI? pub mode: Option<file_info::Mode>, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub file_attributes: &'a [&'a typing_defs::UserAttribute<'a>], #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub decls: Decls<'a>, /// How did the parser handle xhp elements? This is a copy of /// the setting from DeclParserOptions, for use when converting /// Decls to Facts. pub disable_xhp_element_mangling: bool, /// True if the FFP detected parse errors while parsing. Other parse errors /// are detected in a second pass over the CST, and this field does not /// indicate whether errors would be detected in that second pass. pub has_first_pass_parse_errors: bool, } impl<'a> IntoIterator for ParsedFile<'a> { type Item = (&'a str, shallow_decl_defs::Decl<'a>); type IntoIter = std::iter::Rev<std::vec::IntoIter<Self::Item>>; /// This iterates the decls in forward lexical order /// (Use into_iter().rev() if you want reverse order) fn into_iter(self) -> Self::IntoIter { // Note that our `self.decls` are stored in reverse order, so we have to reverse now. self.decls.into_iter().collect::<Vec<_>>().into_iter().rev() } } /// This is a store of decls. It allows iteration of decls in forward lexical order, /// and you can .rev() to iterate in reverse lexical order. /// By construction, you can safely trust that whoever constructed this object has explicitly /// passed `deregister_php_stdlib`, which we hope and trust they got from .hhconfig. #[derive(Clone, Debug)] pub struct ParsedFileWithHashes<'a> { pub mode: Option<file_info::Mode>, /// `file_decls_hash` is computed before php stdlib decls and duplicates /// are removed, as is computed over the decls in reverse lexical order /// (the hash is order-sensitive) pub file_decls_hash: hh24_types::FileDeclsHash, /// Decls along with a position insensitive hash. Internally they're stored in reverse /// lexical order. The choice of what to go into this list (remove dupes? remove php_stdlib /// in hhi files? transform class decls by removing php_stdlib members?) is determined /// by how it was constructed. The field is private: the only way to access it /// are through accessors .iter() and .into_iter(), which give the illusion of it being /// in forward lexical order. decls: Vec<(&'a str, Decl<'a>, hh24_types::DeclHash)>, } impl<'a> ParsedFileWithHashes<'a> { pub fn new( parsed_file: ParsedFile<'a>, deregister_php_stdlib_if_hhi: bool, prefix: relative_path::Prefix, arena: &'a bumpalo::Bump, ) -> Self { let file_decls_hash = hh24_types::FileDeclsHash::from_u64( hh_hash::position_insensitive_hash(&parsed_file.decls), ); // Note: parsed_file.decls is in reverse lexical order, and our self.decls must also be in reverse // lexical order, so that as `OcamlReverseParsedFileWithHashes` we ffi correctly to ocaml. let decls = parsed_file .decls .into_iter() .filter_map(|(name, mut decl)| { if deregister_php_stdlib_if_hhi && prefix == relative_path::Prefix::Hhi { match filter_php_stdlib_decls(arena, decl) { Some(altered_decl) => decl = altered_decl, None => return None, } } let hash = hh24_types::DeclHash::from_u64(hh_hash::hash(&decl)); Some((name, decl, hash)) }) .collect(); Self { mode: parsed_file.mode, file_decls_hash, decls, } } /// This method is a code smell. It shows that the caller didn't take into account /// the .hhconfig flag `deregister_php_stdlib`. pub fn new_without_deregistering_do_not_use(parsed_file: ParsedFile<'a>) -> Self { let file_decls_hash = hh24_types::FileDeclsHash::from_u64( hh_hash::position_insensitive_hash(&parsed_file.decls), ); let decls = parsed_file .decls .into_iter() .map(|(name, decl)| { let hash = hh24_types::DeclHash::from_u64(hh_hash::hash(&decl)); (name, decl, hash) }) .collect(); Self { mode: parsed_file.mode, file_decls_hash, decls, } } /// This iterates the decls in forward lexical order /// (Use iter().rev() if you want reverse order) pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = &(&'a str, shallow_decl_defs::Decl<'a>, hh24_types::DeclHash)> { // Note that our `self.decls` are stored in reverse order, so we have to reverse now. self.decls.iter().rev() } } impl<'a> IntoIterator for ParsedFileWithHashes<'a> { type Item = (&'a str, shallow_decl_defs::Decl<'a>, hh24_types::DeclHash); type IntoIter = std::iter::Rev<std::vec::IntoIter<Self::Item>>; /// This iterates the decls in forward lexical order /// (Use into_iter().rev() if you want reverse order) fn into_iter(self) -> Self::IntoIter { // Note that our `self.decls` are stored in reverse order, so we have to reverse now. self.decls.into_iter().rev() } } // NB: Must keep in sync with OCaml type Direct_decl_parser.decls #[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Deserialize, FromOcamlRepIn, NoPosHash, Serialize, ToOcamlRep)] pub struct Decls<'a>( #[serde(deserialize_with = "arena_deserializer::arena", borrow)] pub List<'a, (&'a str, Decl<'a>)>, ); arena_deserializer::impl_deserialize_in_arena!(Decls<'arena>); impl<'a> TrivialDrop for Decls<'a> {} /// WARNING! These decls do not respect the `deregister_php_stdlib` flag in .hhconfig, /// and are in reverse declaration order, and have not been de-duped. You should /// probably be consuming ParsedFileWithHashes instead. impl<'a> Decls<'a> { pub const fn empty() -> Self { Self(List::empty()) } pub fn get(&self, kind: NameType, symbol: &str) -> Option<&'a Decl<'a>> { self.iter().find_map(|(name, decl)| { if decl.kind() == kind && *name == symbol { Some(decl) } else { None } }) } pub fn add<A: arena_trait::Arena>(&mut self, name: &'a str, decl: Decl<'a>, arena: &'a A) { self.0.push_front((name, decl), arena) } pub fn rev<A: arena_trait::Arena>(&mut self, arena: &'a A) { self.0 = self.0.rev(arena) } pub fn iter(&self) -> impl Iterator<Item = &'a (&'a str, Decl<'a>)> { self.0.iter() } pub fn classes( &self, ) -> impl Iterator<Item = (&'a str, &'a shallow_decl_defs::ShallowClass<'a>)> { self.iter().filter_map(|(name, decl)| match *decl { Decl::Class(decl) => Some((*name, decl)), _ => None, }) } pub fn funs(&self) -> impl Iterator<Item = (&'a str, &'a typing_defs::FunElt<'a>)> { self.iter().filter_map(|(name, decl)| match *decl { Decl::Fun(decl) => Some((*name, decl)), _ => None, }) } pub fn typedefs(&self) -> impl Iterator<Item = (&'a str, &'a typing_defs::TypedefType<'a>)> { self.iter().filter_map(|(name, decl)| match *decl { Decl::Typedef(decl) => Some((*name, decl)), _ => None, }) } pub fn consts(&self) -> impl Iterator<Item = (&'a str, &'a typing_defs::ConstDecl<'a>)> { self.iter().filter_map(|(name, decl)| match *decl { Decl::Const(decl) => Some((*name, decl)), _ => None, }) } pub fn types(&self) -> impl Iterator<Item = &'a (&'a str, Decl<'a>)> { self.iter().filter(|(_, decl)| match decl { Decl::Class(_) | Decl::Typedef(_) => true, Decl::Fun(_) | Decl::Const(_) | Decl::Module(_) => false, }) } pub fn modules(&self) -> impl Iterator<Item = (&'a str, &'a typing_defs::ModuleDefType<'a>)> { self.iter().filter_map(|(name, decl)| match *decl { Decl::Module(decl) => Some((*name, decl)), _ => None, }) } } // c.f. `hphp/hack/src/providers/direct_decl_utils.ml` fn filter_php_stdlib_decls<'a>(arena: &'a bumpalo::Bump, decl: Decl<'a>) -> Option<Decl<'a>> { use crate::method_flags::MethodFlags; use crate::prop_flags::PropFlags; fn filter<'b, T: Copy>( items: &'b [T], arena: &'b bumpalo::Bump, pred: impl FnMut(&T) -> bool, ) -> &'b [T] { bumpalo::collections::Vec::from_iter_in(items.iter().copied().filter(pred), arena) .into_bump_slice() } match decl { Decl::Fun(f) if f.php_std_lib => None, Decl::Class(c) if (c.user_attributes.iter()).any(|ua| ua.name.1 == "__PHPStdLib") => None, Decl::Class(c) => { let masked = arena.alloc(shallow_decl_defs::ShallowClass { props: filter(c.props, arena, |p| { !p.flags.contains(PropFlags::PHP_STD_LIB) }), sprops: filter(c.sprops, arena, |p| { !p.flags.contains(PropFlags::PHP_STD_LIB) }), methods: filter(c.methods, arena, |m| { !m.flags.contains(MethodFlags::PHP_STD_LIB) }), static_methods: filter(c.static_methods, arena, |m| { !m.flags.contains(MethodFlags::PHP_STD_LIB) }), ..*c }); Some(Decl::Class(masked)) } _ => Some(decl), } } impl<'a> IntoIterator for Decls<'a> { type Item = (&'a str, Decl<'a>); type IntoIter = std::iter::Copied<arena_collections::list::Iter<'a, (&'a str, Decl<'a>)>>; fn into_iter(self) -> Self::IntoIter { self.0.iter().copied() } } impl std::fmt::Debug for Decls<'_> { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fmt.debug_map().entries(self.iter().copied()).finish() } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/global_options_impl.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 crate::gen::global_options::GlobalOptions; use crate::gen::global_options::SavedState; use crate::gen::global_options::SavedStateLoading; use crate::i_set; use crate::manual::saved_state_rollouts_impl::DEFAULT_SAVED_STATE_ROLLOUTS; use crate::s_map; use crate::s_set; const DEFAULT_SAVED_STATE_LOADING: SavedStateLoading<'_> = SavedStateLoading { saved_state_manifold_api_key: None, log_saved_state_age_and_distance: false, use_manifold_cython_client: false, }; const DEFAULT_SAVED_STATE: SavedState<'_> = SavedState { loading: &DEFAULT_SAVED_STATE_LOADING, rollouts: &DEFAULT_SAVED_STATE_ROLLOUTS, project_metadata_w_flags: true, }; const DEFAULT: GlobalOptions<'_> = GlobalOptions { tco_saved_state: &DEFAULT_SAVED_STATE, tco_experimental_features: s_set::SSet::empty(), tco_migration_flags: s_set::SSet::empty(), tco_num_local_workers: None, tco_max_typechecker_worker_memory_mb: None, tco_defer_class_declaration_threshold: None, so_naming_sqlite_path: None, po_auto_namespace_map: &[], po_codegen: false, po_deregister_php_stdlib: false, po_disallow_toplevel_requires: 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: false, tco_disallow_byref_dynamic_calls: false, tco_disallow_byref_calls: true, code_agnostic_fixme: false, allowed_fixme_codes_strict: i_set::ISet::empty(), log_levels: s_map::SMap::empty(), po_disable_lval_as_an_expression: false, 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: CustomErrorConfig::Config(vec![]), po_enable_class_level_where_clauses: false, po_disable_legacy_soft_typehints: true, po_allowed_decl_fixme_codes: i_set::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, po_disallow_func_ptrs_in_constants: false, tco_error_php_lambdas: false, tco_disallow_discarded_nullable_awaitables: false, po_enable_xhp_class_modifier: false, po_disable_xhp_element_mangling: false, po_disable_xhp_children_declarations: false, glean_service: "", glean_hostname: "", glean_port: 0, glean_reponame: "", symbol_write_ownership: false, symbol_write_root_path: "", symbol_write_hhi_path: "", symbol_write_ignore_paths: &[], symbol_write_index_paths: &[], symbol_write_index_paths_file: None, symbol_write_include_hhi: false, symbol_write_index_paths_file_output: None, symbol_write_sym_hash_in: None, symbol_write_exclude_out: None, symbol_write_sym_hash_out: false, po_disable_hh_ignore_error: 0, 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_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: false, 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, }; impl GlobalOptions<'static> { pub const DEFAULT: &'static Self = &DEFAULT; pub const fn default_ref() -> &'static Self { Self::DEFAULT } } impl Default for &GlobalOptions<'_> { fn default() -> Self { GlobalOptions::default_ref() } } impl Eq for GlobalOptions<'_> {} impl std::hash::Hash for GlobalOptions<'_> { fn hash<H>(&self, _: &mut H) { unimplemented!() } } impl no_pos_hash::NoPosHash for GlobalOptions<'_> { fn hash<H>(&self, _: &mut H) { unimplemented!() } } impl Ord for GlobalOptions<'_> { fn cmp(&self, _: &Self) -> std::cmp::Ordering { unimplemented!() } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/ident.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. pub use oxidized::ident::*;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/i_map.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. pub type IMap<'a, T> = arena_collections::map::Map<'a, isize, T>;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/i_set.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. pub type ISet<'a> = arena_collections::set::Set<'a, isize>;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/lazy.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 eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRep; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Clone, Debug, Deserialize, Eq, Hash, EqModuloPos, NoPosHash, Ord, PartialEq, PartialOrd, Serialize )] #[serde(bound(deserialize = "T: 'de + arena_deserializer::DeserializeInArena<'de>"))] pub struct Lazy<T>(#[serde(deserialize_with = "arena_deserializer::arena")] pub Option<T>); arena_deserializer::impl_deserialize_in_arena!(Lazy<T>); impl<T> arena_trait::TrivialDrop for Lazy<T> {} impl<T: ToOcamlRep> ToOcamlRep for Lazy<T> { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { unimplemented!() } } impl<T: FromOcamlRep> FromOcamlRep for Lazy<T> { fn from_ocamlrep(_value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { Ok(Self(None)) } } impl<'a, T: FromOcamlRepIn<'a>> FromOcamlRepIn<'a> for Lazy<T> { fn from_ocamlrep_in( _value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { Ok(Self(None)) } }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/local_id.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 eq_modulo_pos::EqModuloPos; use no_pos_hash::NoPosHash; use ocamlrep::FromOcamlRepIn; use ocamlrep::ToOcamlRep; use serde::Deserialize; use serde::Serialize; #[derive( Clone, Copy, Debug, Deserialize, Eq, EqModuloPos, FromOcamlRepIn, Hash, NoPosHash, Ord, PartialEq, PartialOrd, Serialize, ToOcamlRep )] pub struct LocalId<'a>( isize, #[serde(deserialize_with = "arena_deserializer::arena", borrow)] &'a str, ); arena_deserializer::impl_deserialize_in_arena!(LocalId<'arena>); impl arena_trait::TrivialDrop for LocalId<'_> {} impl<'a> LocalId<'a> { pub fn new_unscoped_in(name: &'a str) -> Self { Self(0, name) } pub fn name(self) -> &'a str { self.1 } } impl<'a> From<&'a oxidized::local_id::LocalId> for LocalId<'a> { fn from(x: &'a oxidized::local_id::LocalId) -> LocalId<'a> { let (a, b) = x; LocalId(*a, b.as_str()) } } pub mod map { pub type Map<'a, T> = arena_collections::map::Map<'a, super::LocalId<'a>, T>; } pub mod set { pub type Set<'a> = arena_collections::set::Set<'a, super::LocalId<'a>>; }
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/local_id_map.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. pub type LocalIdMap<'a, T> = crate::local_id::map::Map<'a, T>;
Rust
hhvm/hphp/hack/src/oxidized_by_ref/manual/method_flags.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 bitflags::bitflags; use eq_modulo_pos::EqModuloPos; // NB: Keep the values of these flags in sync with shallow_decl_defs.ml. bitflags! { #[derive(EqModuloPos)] pub struct MethodFlags: u8 { const ABSTRACT = 1 << 0; const FINAL = 1 << 1; const OVERRIDE = 1 << 2; const DYNAMICALLYCALLABLE = 1 << 3; const PHP_STD_LIB = 1 << 4; const SUPPORT_DYNAMIC_TYPE = 1 << 5; } } impl MethodFlags { pub fn is_abstract(&self) -> bool { self.contains(Self::ABSTRACT) } pub fn is_final(&self) -> bool { self.contains(Self::FINAL) } pub fn is_dynamicallycallable(&self) -> bool { self.contains(Self::DYNAMICALLYCALLABLE) } pub fn is_override(&self) -> bool { self.contains(Self::OVERRIDE) } pub fn supports_dynamic_type(&self) -> bool { self.contains(Self::SUPPORT_DYNAMIC_TYPE) } } impl ocamlrep::ToOcamlRep for MethodFlags { fn to_ocamlrep<'a, A: ocamlrep::Allocator>(&'a self, _alloc: &'a A) -> ocamlrep::Value<'a> { ocamlrep::Value::int(self.bits() as isize) } } impl ocamlrep::FromOcamlRep for MethodFlags { fn from_ocamlrep(value: ocamlrep::Value<'_>) -> Result<Self, ocamlrep::FromError> { let int_value = ocamlrep::from::expect_int(value)?; Ok(Self::from_bits_truncate(int_value.try_into()?)) } } impl<'a> ocamlrep::FromOcamlRepIn<'a> for MethodFlags { fn from_ocamlrep_in( value: ocamlrep::Value<'_>, _alloc: &'a bumpalo::Bump, ) -> Result<Self, ocamlrep::FromError> { use ocamlrep::FromOcamlRep; Self::from_ocamlrep(value) } } impl no_pos_hash::NoPosHash for MethodFlags { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { std::hash::Hash::hash(self, state); } } impl serde::Serialize for MethodFlags { fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { serializer.serialize_u8(self.bits()) } } impl<'de> serde::Deserialize<'de> for MethodFlags { fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { type Value = MethodFlags; fn expecting(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(formatter, "a u8 for MethodFlags") } fn visit_u8<E: serde::de::Error>(self, value: u8) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate(value)) } fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> { Ok(Self::Value::from_bits_truncate( u8::try_from(value).expect("expect an u8, but got u64"), )) } } deserializer.deserialize_u8(Visitor) } }