Apply Ocamlvalue derive to oxidized aast related types
[hiphop-php.git] / hphp / hack / src / oxidized / gen / aast.rs
blobc9ee6413967d6012bc0e9fc55316563ac5ead771
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 //
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
5 //
6 // @generated SignedSource<<c64ab953c46a436e2986714be6492c05>>
7 //
8 // To regenerate this file, run:
9 //   hphp/hack/src/oxidized/regen.sh
11 use ocamlrep_derive::IntoOcamlRep;
12 use ocamlvalue_macro::Ocamlvalue;
14 use crate::aast_defs;
15 use crate::ast_defs;
16 use crate::file_info;
17 use crate::namespace_env;
18 use crate::s_map;
20 pub use aast_defs::CallType;
21 pub use aast_defs::CollectionTarg;
22 pub use aast_defs::Enum_;
23 pub use aast_defs::FuncReactive;
24 pub use aast_defs::Hint;
25 pub use aast_defs::Hint_;
26 pub use aast_defs::Id;
27 pub use aast_defs::ImportFlavor;
28 pub use aast_defs::IsCoroutine;
29 pub use aast_defs::IsReified;
30 pub use aast_defs::IsTerminal;
31 pub use aast_defs::KvcKind;
32 pub use aast_defs::Lid;
33 pub use aast_defs::LocalId;
34 pub use aast_defs::MutableReturn;
35 pub use aast_defs::NastShapeInfo;
36 pub use aast_defs::OgNullFlavor;
37 pub use aast_defs::ParamMutability;
38 pub use aast_defs::Pos;
39 pub use aast_defs::Pstring;
40 pub use aast_defs::ShapeFieldInfo;
41 pub use aast_defs::ShapeMap;
42 pub use aast_defs::Sid;
43 pub use aast_defs::Targ;
44 pub use aast_defs::Tprim;
45 pub use aast_defs::TypedefVisibility;
46 pub use aast_defs::UseAsVisibility;
47 pub use aast_defs::VariadicHint;
48 pub use aast_defs::VcKind;
49 pub use aast_defs::Visibility;
50 pub use aast_defs::WhereConstraint;
51 pub use aast_defs::XhpChild;
52 pub use aast_defs::XhpChildOp;
54 pub type Program<Ex, Fb, En, Hi> = Vec<Def<Ex, Fb, En, Hi>>;
56 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
57 pub struct Stmt<Ex, Fb, En, Hi>(pub Pos, pub Box<Stmt_<Ex, Fb, En, Hi>>);
59 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
60 pub enum Stmt_<Ex, Fb, En, Hi> {
61     Fallthrough,
62     Expr(Expr<Ex, Fb, En, Hi>),
63     Break,
64     TempBreak(Expr<Ex, Fb, En, Hi>),
65     Continue,
66     TempContinue(Expr<Ex, Fb, En, Hi>),
67     Throw(Expr<Ex, Fb, En, Hi>),
68     Return(Option<Expr<Ex, Fb, En, Hi>>),
69     GotoLabel(Pstring),
70     Goto(Pstring),
71     Awaitall(
72         (
73             Vec<(Option<Lid>, Expr<Ex, Fb, En, Hi>)>,
74             Block<Ex, Fb, En, Hi>,
75         ),
76     ),
77     If(
78         Expr<Ex, Fb, En, Hi>,
79         Block<Ex, Fb, En, Hi>,
80         Block<Ex, Fb, En, Hi>,
81     ),
82     Do(Block<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
83     While(Expr<Ex, Fb, En, Hi>, Block<Ex, Fb, En, Hi>),
84     Using(UsingStmt<Ex, Fb, En, Hi>),
85     For(
86         Expr<Ex, Fb, En, Hi>,
87         Expr<Ex, Fb, En, Hi>,
88         Expr<Ex, Fb, En, Hi>,
89         Block<Ex, Fb, En, Hi>,
90     ),
91     Switch(Expr<Ex, Fb, En, Hi>, Vec<Case<Ex, Fb, En, Hi>>),
92     Foreach(
93         Expr<Ex, Fb, En, Hi>,
94         AsExpr<Ex, Fb, En, Hi>,
95         Block<Ex, Fb, En, Hi>,
96     ),
97     Try(
98         Block<Ex, Fb, En, Hi>,
99         Vec<Catch<Ex, Fb, En, Hi>>,
100         Block<Ex, Fb, En, Hi>,
101     ),
102     DefInline(Def<Ex, Fb, En, Hi>),
103     Let(Lid, Option<Hint>, Expr<Ex, Fb, En, Hi>),
104     Noop,
105     Block(Block<Ex, Fb, En, Hi>),
106     Markup(Pstring, Option<Expr<Ex, Fb, En, Hi>>),
109 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
110 pub struct UsingStmt<Ex, Fb, En, Hi> {
111     pub is_block_scoped: bool,
112     pub has_await: bool,
113     pub expr: Expr<Ex, Fb, En, Hi>,
114     pub block: Block<Ex, Fb, En, Hi>,
117 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
118 pub enum AsExpr<Ex, Fb, En, Hi> {
119     AsV(Expr<Ex, Fb, En, Hi>),
120     AsKv(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
121     AwaitAsV(Pos, Expr<Ex, Fb, En, Hi>),
122     AwaitAsKv(Pos, Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
125 pub type Block<Ex, Fb, En, Hi> = Vec<Stmt<Ex, Fb, En, Hi>>;
127 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
128 pub struct ClassId<Ex, Fb, En, Hi>(pub Ex, pub ClassId_<Ex, Fb, En, Hi>);
130 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
131 pub enum ClassId_<Ex, Fb, En, Hi> {
132     CIparent,
133     CIself,
134     CIstatic,
135     CIexpr(Expr<Ex, Fb, En, Hi>),
136     CI(Sid),
139 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
140 pub struct Expr<Ex, Fb, En, Hi>(pub Ex, pub Box<Expr_<Ex, Fb, En, Hi>>);
142 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
143 pub enum Expr_<Ex, Fb, En, Hi> {
144     Array(Vec<Afield<Ex, Fb, En, Hi>>),
145     Darray(
146         Option<(Targ, Targ)>,
147         Vec<(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>)>,
148     ),
149     Varray(Option<Targ>, Vec<Expr<Ex, Fb, En, Hi>>),
150     Shape(Vec<(ast_defs::ShapeFieldName, Expr<Ex, Fb, En, Hi>)>),
151     ValCollection(VcKind, Option<Targ>, Vec<Expr<Ex, Fb, En, Hi>>),
152     KeyValCollection(KvcKind, Option<(Targ, Targ)>, Vec<Field<Ex, Fb, En, Hi>>),
153     Null,
154     This,
155     True,
156     False,
157     Omitted,
158     Id(Sid),
159     Lvar(Lid),
160     ImmutableVar(Lid),
161     Dollardollar(Lid),
162     Clone(Expr<Ex, Fb, En, Hi>),
163     ObjGet(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>, OgNullFlavor),
164     ArrayGet(Expr<Ex, Fb, En, Hi>, Option<Expr<Ex, Fb, En, Hi>>),
165     ClassGet(ClassId<Ex, Fb, En, Hi>, ClassGetExpr<Ex, Fb, En, Hi>),
166     ClassConst(ClassId<Ex, Fb, En, Hi>, Pstring),
167     Call(
168         CallType,
169         Expr<Ex, Fb, En, Hi>,
170         Vec<Targ>,
171         Vec<Expr<Ex, Fb, En, Hi>>,
172         Vec<Expr<Ex, Fb, En, Hi>>,
173     ),
174     Int(String),
175     Float(String),
176     String(String),
177     String2(Vec<Expr<Ex, Fb, En, Hi>>),
178     PrefixedString(String, Expr<Ex, Fb, En, Hi>),
179     Yield(Afield<Ex, Fb, En, Hi>),
180     YieldBreak,
181     YieldFrom(Expr<Ex, Fb, En, Hi>),
182     Await(Expr<Ex, Fb, En, Hi>),
183     Suspend(Expr<Ex, Fb, En, Hi>),
184     List(Vec<Expr<Ex, Fb, En, Hi>>),
185     ExprList(Vec<Expr<Ex, Fb, En, Hi>>),
186     Cast(Hint, Expr<Ex, Fb, En, Hi>),
187     Unop(ast_defs::Uop, Expr<Ex, Fb, En, Hi>),
188     Binop(ast_defs::Bop, Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
189     Pipe(Lid, Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
190     Eif(
191         Expr<Ex, Fb, En, Hi>,
192         Option<Expr<Ex, Fb, En, Hi>>,
193         Expr<Ex, Fb, En, Hi>,
194     ),
195     Is(Expr<Ex, Fb, En, Hi>, Hint),
196     As(Expr<Ex, Fb, En, Hi>, Hint, bool),
197     New(
198         ClassId<Ex, Fb, En, Hi>,
199         Vec<Targ>,
200         Vec<Expr<Ex, Fb, En, Hi>>,
201         Vec<Expr<Ex, Fb, En, Hi>>,
202         Ex,
203     ),
204     Record(
205         ClassId<Ex, Fb, En, Hi>,
206         bool,
207         Vec<(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>)>,
208     ),
209     Efun(Fun_<Ex, Fb, En, Hi>, Vec<Lid>),
210     Lfun(Fun_<Ex, Fb, En, Hi>, Vec<Lid>),
211     Xml(
212         Sid,
213         Vec<XhpAttribute<Ex, Fb, En, Hi>>,
214         Vec<Expr<Ex, Fb, En, Hi>>,
215     ),
216     Callconv(ast_defs::ParamKind, Expr<Ex, Fb, En, Hi>),
217     Import(ImportFlavor, Expr<Ex, Fb, En, Hi>),
218     Collection(Sid, Option<CollectionTarg>, Vec<Afield<Ex, Fb, En, Hi>>),
219     BracedExpr(Expr<Ex, Fb, En, Hi>),
220     ParenthesizedExpr(Expr<Ex, Fb, En, Hi>),
221     Lplaceholder(Pos),
222     FunId(Sid),
223     MethodId(Expr<Ex, Fb, En, Hi>, Pstring),
224     MethodCaller(Sid, Pstring),
225     SmethodId(Sid, Pstring),
226     SpecialFunc(SpecialFunc<Ex, Fb, En, Hi>),
227     Pair(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
228     Assert(AssertExpr<Ex, Fb, En, Hi>),
229     Typename(Sid),
230     PUAtom(String),
231     PUIdentifier(ClassId<Ex, Fb, En, Hi>, Pstring, Pstring),
232     Any,
235 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
236 pub enum ClassGetExpr<Ex, Fb, En, Hi> {
237     CGstring(Pstring),
238     CGexpr(Expr<Ex, Fb, En, Hi>),
241 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
242 pub enum AssertExpr<Ex, Fb, En, Hi> {
243     AEAssert(Expr<Ex, Fb, En, Hi>),
246 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
247 pub enum Case<Ex, Fb, En, Hi> {
248     Default(Block<Ex, Fb, En, Hi>),
249     Case(Expr<Ex, Fb, En, Hi>, Block<Ex, Fb, En, Hi>),
252 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
253 pub struct Catch<Ex, Fb, En, Hi>(pub Sid, pub Lid, pub Block<Ex, Fb, En, Hi>);
255 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
256 pub struct Field<Ex, Fb, En, Hi>(pub Expr<Ex, Fb, En, Hi>, pub Expr<Ex, Fb, En, Hi>);
258 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
259 pub enum Afield<Ex, Fb, En, Hi> {
260     AFvalue(Expr<Ex, Fb, En, Hi>),
261     AFkvalue(Expr<Ex, Fb, En, Hi>, Expr<Ex, Fb, En, Hi>),
264 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
265 pub enum XhpAttribute<Ex, Fb, En, Hi> {
266     XhpSimple(Pstring, Expr<Ex, Fb, En, Hi>),
267     XhpSpread(Expr<Ex, Fb, En, Hi>),
270 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
271 pub enum SpecialFunc<Ex, Fb, En, Hi> {
272     Genva(Vec<Expr<Ex, Fb, En, Hi>>),
275 pub type IsReference = bool;
277 pub type IsVariadic = bool;
279 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
280 pub struct FunParam<Ex, Fb, En, Hi> {
281     pub annotation: Ex,
282     pub hint: Option<Hint>,
283     pub is_reference: IsReference,
284     pub is_variadic: IsVariadic,
285     pub pos: Pos,
286     pub name: String,
287     pub expr: Option<Expr<Ex, Fb, En, Hi>>,
288     pub callconv: Option<ast_defs::ParamKind>,
289     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
290     pub visibility: Option<Visibility>,
293 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
294 pub enum FunVariadicity<Ex, Fb, En, Hi> {
295     FVvariadicArg(FunParam<Ex, Fb, En, Hi>),
296     FVellipsis(Pos),
297     FVnonVariadic,
300 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
301 pub struct Fun_<Ex, Fb, En, Hi> {
302     pub span: Pos,
303     pub annotation: En,
304     pub mode: file_info::Mode,
305     pub ret: TypeHint<Hi>,
306     pub name: Sid,
307     pub tparams: Vec<Tparam<Ex, Fb, En, Hi>>,
308     pub where_constraints: Vec<WhereConstraint>,
309     pub variadic: FunVariadicity<Ex, Fb, En, Hi>,
310     pub params: Vec<FunParam<Ex, Fb, En, Hi>>,
311     pub body: FuncBody<Ex, Fb, En, Hi>,
312     pub fun_kind: ast_defs::FunKind,
313     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
314     pub file_attributes: Vec<FileAttribute<Ex, Fb, En, Hi>>,
315     pub external: bool,
316     pub namespace: Nsenv,
317     pub doc_comment: Option<String>,
318     pub static_: bool,
321 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
322 pub struct FuncBody<Ex, Fb, En, Hi> {
323     pub ast: Block<Ex, Fb, En, Hi>,
324     pub annotation: Fb,
327 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
328 pub struct TypeHint<Hi>(pub Hi, pub TypeHint_);
330 pub type TypeHint_ = Option<Hint>;
332 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
333 pub struct UserAttribute<Ex, Fb, En, Hi> {
334     pub name: Sid,
335     pub params: Vec<Expr<Ex, Fb, En, Hi>>,
338 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
339 pub struct FileAttribute<Ex, Fb, En, Hi> {
340     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
341     pub namespace: Nsenv,
344 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
345 pub struct Tparam<Ex, Fb, En, Hi> {
346     pub variance: ast_defs::Variance,
347     pub name: Sid,
348     pub constraints: Vec<(ast_defs::ConstraintKind, Hint)>,
349     pub reified: ReifyKind,
350     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
353 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
354 pub struct ClassTparams<Ex, Fb, En, Hi> {
355     pub list: Vec<Tparam<Ex, Fb, En, Hi>>,
356     pub constraints: s_map::SMap<(ReifyKind, Vec<(ast_defs::ConstraintKind, Hint)>)>,
359 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
360 pub struct UseAsAlias(
361     pub Option<Sid>,
362     pub Pstring,
363     pub Option<Sid>,
364     pub Vec<UseAsVisibility>,
367 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
368 pub struct InsteadofAlias(pub Sid, pub Pstring, pub Vec<Sid>);
370 pub type IsExtends = bool;
372 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
373 pub struct Class_<Ex, Fb, En, Hi> {
374     pub span: Pos,
375     pub annotation: En,
376     pub mode: file_info::Mode,
377     pub final_: bool,
378     pub is_xhp: bool,
379     pub kind: ast_defs::ClassKind,
380     pub name: Sid,
381     pub tparams: ClassTparams<Ex, Fb, En, Hi>,
382     pub extends: Vec<Hint>,
383     pub uses: Vec<Hint>,
384     pub use_as_alias: Vec<UseAsAlias>,
385     pub insteadof_alias: Vec<InsteadofAlias>,
386     pub method_redeclarations: Vec<MethodRedeclaration<Ex, Fb, En, Hi>>,
387     pub xhp_attr_uses: Vec<Hint>,
388     pub xhp_category: Option<(Pos, Vec<Pstring>)>,
389     pub reqs: Vec<(Hint, IsExtends)>,
390     pub implements: Vec<Hint>,
391     pub where_constraints: Vec<WhereConstraint>,
392     pub consts: Vec<ClassConst<Ex, Fb, En, Hi>>,
393     pub typeconsts: Vec<ClassTypeconst<Ex, Fb, En, Hi>>,
394     pub vars: Vec<ClassVar<Ex, Fb, En, Hi>>,
395     pub methods: Vec<Method_<Ex, Fb, En, Hi>>,
396     pub attributes: Vec<ClassAttr<Ex, Fb, En, Hi>>,
397     pub xhp_children: Vec<(Pos, XhpChild)>,
398     pub xhp_attrs: Vec<XhpAttr<Ex, Fb, En, Hi>>,
399     pub namespace: Nsenv,
400     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
401     pub file_attributes: Vec<FileAttribute<Ex, Fb, En, Hi>>,
402     pub enum_: Option<Enum_>,
403     pub pu_enums: Vec<PuEnum<Ex, Fb, En, Hi>>,
404     pub doc_comment: Option<String>,
407 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
408 pub enum XhpAttrTag {
409     Required,
410     LateInit,
413 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
414 pub struct XhpAttr<Ex, Fb, En, Hi>(
415     pub Option<Hint>,
416     pub ClassVar<Ex, Fb, En, Hi>,
417     pub Option<XhpAttrTag>,
418     pub Option<(Pos, bool, Vec<Expr<Ex, Fb, En, Hi>>)>,
421 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
422 pub enum ClassAttr<Ex, Fb, En, Hi> {
423     CAName(Sid),
424     CAField(CaField<Ex, Fb, En, Hi>),
427 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
428 pub struct CaField<Ex, Fb, En, Hi> {
429     pub type_: CaType,
430     pub id: Sid,
431     pub value: Option<Expr<Ex, Fb, En, Hi>>,
432     pub required: bool,
435 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
436 pub enum CaType {
437     CAHint(Hint),
438     CAEnum(Vec<String>),
441 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
442 pub struct ClassConst<Ex, Fb, En, Hi> {
443     pub visibility: Visibility,
444     pub type_: Option<Hint>,
445     pub id: Sid,
446     pub expr: Option<Expr<Ex, Fb, En, Hi>>,
447     pub doc_comment: Option<String>,
450 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
451 pub enum TypeconstAbstractKind {
452     TCAbstract(Option<Hint>),
453     TCPartiallyAbstract,
454     TCConcrete,
457 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
458 pub struct ClassTypeconst<Ex, Fb, En, Hi> {
459     pub abstract_: TypeconstAbstractKind,
460     pub visibility: Visibility,
461     pub name: Sid,
462     pub constraint: Option<Hint>,
463     pub type_: Option<Hint>,
464     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
465     pub span: Pos,
466     pub doc_comment: Option<String>,
469 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
470 pub struct XhpAttrInfo {
471     pub xai_tag: Option<XhpAttrTag>,
474 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
475 pub struct ClassVar<Ex, Fb, En, Hi> {
476     pub final_: bool,
477     pub xhp_attr: Option<XhpAttrInfo>,
478     pub abstract_: bool,
479     pub visibility: Visibility,
480     pub type_: Option<Hint>,
481     pub id: Sid,
482     pub expr: Option<Expr<Ex, Fb, En, Hi>>,
483     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
484     pub doc_comment: Option<String>,
485     pub is_promoted_variadic: bool,
486     pub is_static: bool,
487     pub span: Pos,
490 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
491 pub struct Method_<Ex, Fb, En, Hi> {
492     pub span: Pos,
493     pub annotation: En,
494     pub final_: bool,
495     pub abstract_: bool,
496     pub static_: bool,
497     pub visibility: Visibility,
498     pub name: Sid,
499     pub tparams: Vec<Tparam<Ex, Fb, En, Hi>>,
500     pub where_constraints: Vec<WhereConstraint>,
501     pub variadic: FunVariadicity<Ex, Fb, En, Hi>,
502     pub params: Vec<FunParam<Ex, Fb, En, Hi>>,
503     pub body: FuncBody<Ex, Fb, En, Hi>,
504     pub fun_kind: ast_defs::FunKind,
505     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
506     pub ret: TypeHint<Hi>,
507     pub external: bool,
508     pub doc_comment: Option<String>,
511 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
512 pub struct MethodRedeclaration<Ex, Fb, En, Hi> {
513     pub final_: bool,
514     pub abstract_: bool,
515     pub static_: bool,
516     pub visibility: Visibility,
517     pub name: Sid,
518     pub tparams: Vec<Tparam<Ex, Fb, En, Hi>>,
519     pub where_constraints: Vec<WhereConstraint>,
520     pub variadic: FunVariadicity<Ex, Fb, En, Hi>,
521     pub params: Vec<FunParam<Ex, Fb, En, Hi>>,
522     pub fun_kind: ast_defs::FunKind,
523     pub ret: TypeHint<Hi>,
524     pub trait_: Hint,
525     pub method: Pstring,
526     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
529 pub type Nsenv = namespace_env::Env;
531 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
532 pub struct Typedef<Ex, Fb, En, Hi> {
533     pub annotation: En,
534     pub name: Sid,
535     pub tparams: Vec<Tparam<Ex, Fb, En, Hi>>,
536     pub constraint: Option<Hint>,
537     pub kind: Hint,
538     pub user_attributes: Vec<UserAttribute<Ex, Fb, En, Hi>>,
539     pub mode: file_info::Mode,
540     pub vis: TypedefVisibility,
541     pub namespace: Nsenv,
544 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
545 pub struct Gconst<Ex, Fb, En, Hi> {
546     pub annotation: En,
547     pub mode: file_info::Mode,
548     pub name: Sid,
549     pub type_: Option<Hint>,
550     pub value: Expr<Ex, Fb, En, Hi>,
551     pub namespace: Nsenv,
552     pub span: Pos,
555 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
556 pub struct PuEnum<Ex, Fb, En, Hi> {
557     pub name: Sid,
558     pub is_final: bool,
559     pub case_types: Vec<Sid>,
560     pub case_values: Vec<(Sid, Hint)>,
561     pub members: Vec<PuMember<Ex, Fb, En, Hi>>,
564 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
565 pub struct PuMember<Ex, Fb, En, Hi> {
566     pub atom: Sid,
567     pub types: Vec<(Sid, Hint)>,
568     pub exprs: Vec<(Sid, Expr<Ex, Fb, En, Hi>)>,
571 pub type FunDef<Ex, Fb, En, Hi> = Fun_<Ex, Fb, En, Hi>;
573 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
574 pub enum Def<Ex, Fb, En, Hi> {
575     Fun(FunDef<Ex, Fb, En, Hi>),
576     Class(Class_<Ex, Fb, En, Hi>),
577     Stmt(Stmt<Ex, Fb, En, Hi>),
578     Typedef(Typedef<Ex, Fb, En, Hi>),
579     Constant(Gconst<Ex, Fb, En, Hi>),
580     Namespace(Sid, Program<Ex, Fb, En, Hi>),
581     NamespaceUse(Vec<(NsKind, Sid, Sid)>),
582     SetNamespaceEnv(Nsenv),
583     FileAttributes(FileAttribute<Ex, Fb, En, Hi>),
586 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
587 pub enum NsKind {
588     NSNamespace,
589     NSClass,
590     NSClassAndNamespace,
591     NSFun,
592     NSConst,
595 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
596 pub enum ReifyKind {
597     Erased,
598     SoftReified,
599     Reified,
602 #[derive(Clone, Debug, IntoOcamlRep, Ocamlvalue)]
603 pub enum BreakContinueLevel {
604     LevelOk(Option<isize>),
605     LevelNonLiteral,
606     LevelNonPositive,