Generate xhp_enum_value visitor
[hiphop-php.git] / hphp / hack / src / oxidized / gen / ast_defs.rs
blob7fee335c67a5b724c50d1a55db837fa0ed174744
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<<a2d5c262affb20acb440bc2460e1460e>>
7 //
8 // To regenerate this file, run:
9 //   hphp/hack/src/oxidized_regen.sh
11 use arena_trait::TrivialDrop;
12 use eq_modulo_pos::EqModuloPos;
13 use eq_modulo_pos::EqModuloPosAndReason;
14 use no_pos_hash::NoPosHash;
15 use ocamlrep_derive::FromOcamlRep;
16 use ocamlrep_derive::FromOcamlRepIn;
17 use ocamlrep_derive::ToOcamlRep;
18 pub use pos::Pos;
19 use serde::Deserialize;
20 use serde::Serialize;
22 pub use crate::shape_map;
23 #[allow(unused_imports)]
24 use crate::*;
26 pub type Id_ = String;
28 #[derive(
29     Clone,
30     Debug,
31     Deserialize,
32     Eq,
33     EqModuloPos,
34     EqModuloPosAndReason,
35     FromOcamlRep,
36     Hash,
37     NoPosHash,
38     Ord,
39     PartialEq,
40     PartialOrd,
41     Serialize,
42     ToOcamlRep
44 #[repr(C)]
45 pub struct Id(pub Pos, pub Id_);
47 pub type Pstring = (Pos, String);
49 pub type ByteString = String;
51 pub type PositionedByteString = (Pos, bstr::BString);
53 #[derive(
54     Clone,
55     Debug,
56     Deserialize,
57     Eq,
58     EqModuloPos,
59     EqModuloPosAndReason,
60     FromOcamlRep,
61     Hash,
62     NoPosHash,
63     Ord,
64     PartialEq,
65     PartialOrd,
66     Serialize,
67     ToOcamlRep
69 #[repr(C, u8)]
70 pub enum ShapeFieldName {
71     #[rust_to_ocaml(name = "SFlit_int")]
72     SFlitInt(Pstring),
73     #[rust_to_ocaml(name = "SFlit_str")]
74     SFlitStr(PositionedByteString),
75     #[rust_to_ocaml(name = "SFclass_const")]
76     SFclassConst(Id, Pstring),
79 #[derive(
80     Clone,
81     Copy,
82     Debug,
83     Deserialize,
84     Eq,
85     EqModuloPos,
86     EqModuloPosAndReason,
87     FromOcamlRep,
88     FromOcamlRepIn,
89     Hash,
90     NoPosHash,
91     Ord,
92     PartialEq,
93     PartialOrd,
94     Serialize,
95     ToOcamlRep
97 #[repr(u8)]
98 pub enum Variance {
99     Covariant,
100     Contravariant,
101     Invariant,
103 impl TrivialDrop for Variance {}
104 arena_deserializer::impl_deserialize_in_arena!(Variance);
106 #[derive(
107     Clone,
108     Copy,
109     Debug,
110     Deserialize,
111     Eq,
112     EqModuloPos,
113     EqModuloPosAndReason,
114     FromOcamlRep,
115     FromOcamlRepIn,
116     Hash,
117     NoPosHash,
118     Ord,
119     PartialEq,
120     PartialOrd,
121     Serialize,
122     ToOcamlRep
124 #[repr(u8)]
125 pub enum ConstraintKind {
126     #[rust_to_ocaml(name = "Constraint_as")]
127     ConstraintAs,
128     #[rust_to_ocaml(name = "Constraint_eq")]
129     ConstraintEq,
130     #[rust_to_ocaml(name = "Constraint_super")]
131     ConstraintSuper,
133 impl TrivialDrop for ConstraintKind {}
134 arena_deserializer::impl_deserialize_in_arena!(ConstraintKind);
136 pub type Reified = bool;
138 #[derive(
139     Clone,
140     Copy,
141     Debug,
142     Deserialize,
143     Eq,
144     EqModuloPos,
145     EqModuloPosAndReason,
146     FromOcamlRep,
147     FromOcamlRepIn,
148     Hash,
149     NoPosHash,
150     Ord,
151     PartialEq,
152     PartialOrd,
153     Serialize,
154     ToOcamlRep
156 #[repr(u8)]
157 pub enum Abstraction {
158     Concrete,
159     Abstract,
161 impl TrivialDrop for Abstraction {}
162 arena_deserializer::impl_deserialize_in_arena!(Abstraction);
164 #[derive(
165     Clone,
166     Copy,
167     Debug,
168     Deserialize,
169     Eq,
170     EqModuloPos,
171     EqModuloPosAndReason,
172     FromOcamlRep,
173     FromOcamlRepIn,
174     Hash,
175     NoPosHash,
176     Ord,
177     PartialEq,
178     PartialOrd,
179     Serialize,
180     ToOcamlRep
182 #[repr(C, u8)]
183 pub enum ClassishKind {
184     /// Kind for `class` and `abstract class`
185     Cclass(Abstraction),
186     /// Kind for `interface`
187     Cinterface,
188     /// Kind for `trait`
189     Ctrait,
190     /// Kind for `enum`
191     Cenum,
192     /// Kind for `enum class` and `abstract enum class`.
193     /// See https://docs.hhvm.com/hack/built-in-types/enum-class
194     #[rust_to_ocaml(name = "Cenum_class")]
195     CenumClass(Abstraction),
198 #[derive(
199     Clone,
200     Debug,
201     Deserialize,
202     Eq,
203     EqModuloPos,
204     EqModuloPosAndReason,
205     FromOcamlRep,
206     Hash,
207     NoPosHash,
208     Ord,
209     PartialEq,
210     PartialOrd,
211     Serialize,
212     ToOcamlRep
214 #[repr(C, u8)]
215 pub enum ParamKind {
216     /// Contains the position for an entire `inout` annotated expression, e.g.:
217     ///
218     ///   foo(inout $bar);
219     ///       ^^^^^^^^^^
220     Pinout(Pos),
221     Pnormal,
224 #[derive(
225     Clone,
226     Copy,
227     Debug,
228     Deserialize,
229     Eq,
230     EqModuloPos,
231     EqModuloPosAndReason,
232     FromOcamlRep,
233     FromOcamlRepIn,
234     Hash,
235     NoPosHash,
236     Ord,
237     PartialEq,
238     PartialOrd,
239     Serialize,
240     ToOcamlRep
242 #[repr(u8)]
243 pub enum ReadonlyKind {
244     Readonly,
246 impl TrivialDrop for ReadonlyKind {}
247 arena_deserializer::impl_deserialize_in_arena!(ReadonlyKind);
249 #[derive(
250     Clone,
251     Copy,
252     Debug,
253     Deserialize,
254     Eq,
255     EqModuloPos,
256     EqModuloPosAndReason,
257     FromOcamlRep,
258     FromOcamlRepIn,
259     Hash,
260     NoPosHash,
261     Ord,
262     PartialEq,
263     PartialOrd,
264     Serialize,
265     ToOcamlRep
267 #[repr(u8)]
268 pub enum OgNullFlavor {
269     #[rust_to_ocaml(name = "OG_nullthrows")]
270     OGNullthrows,
271     #[rust_to_ocaml(name = "OG_nullsafe")]
272     OGNullsafe,
274 impl TrivialDrop for OgNullFlavor {}
275 arena_deserializer::impl_deserialize_in_arena!(OgNullFlavor);
277 #[derive(
278     Clone,
279     Copy,
280     Debug,
281     Deserialize,
282     Eq,
283     EqModuloPos,
284     EqModuloPosAndReason,
285     FromOcamlRep,
286     FromOcamlRepIn,
287     Hash,
288     NoPosHash,
289     Ord,
290     PartialEq,
291     PartialOrd,
292     Serialize,
293     ToOcamlRep
295 #[repr(u8)]
296 pub enum PropOrMethod {
297     #[rust_to_ocaml(name = "Is_prop")]
298     IsProp,
299     #[rust_to_ocaml(name = "Is_method")]
300     IsMethod,
302 impl TrivialDrop for PropOrMethod {}
303 arena_deserializer::impl_deserialize_in_arena!(PropOrMethod);
305 #[derive(
306     Clone,
307     Copy,
308     Debug,
309     Deserialize,
310     Eq,
311     EqModuloPos,
312     EqModuloPosAndReason,
313     FromOcamlRep,
314     FromOcamlRepIn,
315     Hash,
316     NoPosHash,
317     Ord,
318     PartialEq,
319     PartialOrd,
320     Serialize,
321     ToOcamlRep
323 #[repr(u8)]
324 pub enum FunKind {
325     FSync,
326     FAsync,
327     FGenerator,
328     FAsyncGenerator,
330 impl TrivialDrop for FunKind {}
331 arena_deserializer::impl_deserialize_in_arena!(FunKind);
333 #[derive(
334     Clone,
335     Debug,
336     Deserialize,
337     Eq,
338     EqModuloPos,
339     EqModuloPosAndReason,
340     FromOcamlRep,
341     Hash,
342     NoPosHash,
343     Ord,
344     PartialEq,
345     PartialOrd,
346     Serialize,
347     ToOcamlRep
349 #[repr(C, u8)]
350 pub enum Bop {
351     /// Addition: x + y
352     Plus,
353     /// Subtraction: x - y
354     Minus,
355     /// Multiplication: x * y
356     Star,
357     /// Division: x / y
358     Slash,
359     /// Value/coercing equality: x == y
360     Eqeq,
361     /// Same-type-and-value equality: x === y
362     Eqeqeq,
363     /// Exponent: x ** y
364     Starstar,
365     /// Value inquality: x != y
366     Diff,
367     /// Not-same-type-and-value-equality: x !== y
368     Diff2,
369     /// Logical AND: x && y
370     Ampamp,
371     /// Logical OR: x || y
372     Barbar,
373     /// Less than: x < y
374     Lt,
375     /// Less than or equal to: x <= y
376     Lte,
377     /// Greater than: x > y
378     Gt,
379     /// Greater than or equal to: x >= y
380     Gte,
381     /// String concatenation: x . y
382     Dot,
383     /// Bitwise AND: x & y
384     Amp,
385     /// Bitwise OR: x | y
386     Bar,
387     /// Bitwise left shift: x << y
388     Ltlt,
389     /// Bitwise right shift: x >> y
390     Gtgt,
391     /// Modulo: x % y
392     Percent,
393     /// Bitwise XOR: x ^ y
394     Xor,
395     /// Spaceship operator: x <=> y
396     Cmp,
397     /// Coalesce: x ?? y
398     QuestionQuestion,
399     /// =, +=, -=, ...
400     Eq(Option<Box<Bop>>),
403 #[derive(
404     Clone,
405     Copy,
406     Debug,
407     Deserialize,
408     Eq,
409     EqModuloPos,
410     EqModuloPosAndReason,
411     FromOcamlRep,
412     FromOcamlRepIn,
413     Hash,
414     NoPosHash,
415     Ord,
416     PartialEq,
417     PartialOrd,
418     Serialize,
419     ToOcamlRep
421 #[repr(u8)]
422 pub enum Uop {
423     /// Bitwise negation: ~x
424     Utild,
425     /// Logical not: !b
426     Unot,
427     /// Unary plus: +x
428     Uplus,
429     /// Unary minus: -x
430     Uminus,
431     /// Unary increment: ++i
432     Uincr,
433     /// Unary decrement: --i
434     Udecr,
435     /// Unary postfix increment: i++
436     Upincr,
437     /// Unary postfix decrement: i--
438     Updecr,
439     /// Error control/Silence (ignore) expections: @e
440     Usilence,
442 impl TrivialDrop for Uop {}
443 arena_deserializer::impl_deserialize_in_arena!(Uop);
445 #[derive(
446     Clone,
447     Copy,
448     Debug,
449     Deserialize,
450     Eq,
451     EqModuloPos,
452     EqModuloPosAndReason,
453     FromOcamlRep,
454     FromOcamlRepIn,
455     Hash,
456     NoPosHash,
457     Ord,
458     PartialEq,
459     PartialOrd,
460     Serialize,
461     ToOcamlRep
463 #[repr(u8)]
464 pub enum Visibility {
465     #[rust_to_ocaml(attr = r#"visitors.name "visibility_Private""#)]
466     Private,
467     #[rust_to_ocaml(attr = r#"visitors.name "visibility_Public""#)]
468     Public,
469     #[rust_to_ocaml(attr = r#"visitors.name "visibility_Protected""#)]
470     Protected,
471     #[rust_to_ocaml(attr = r#"visitors.name "visibility_Internal""#)]
472     Internal,
474 impl TrivialDrop for Visibility {}
475 arena_deserializer::impl_deserialize_in_arena!(Visibility);
477 /// Literal values that can occur in XHP enum properties.
479 /// class :my-xhp-class {
480 ///   attribute enum {'big', 'small'} my-prop;
481 /// }
482 #[derive(
483     Clone,
484     Debug,
485     Deserialize,
486     Eq,
487     EqModuloPos,
488     EqModuloPosAndReason,
489     FromOcamlRep,
490     Hash,
491     NoPosHash,
492     Ord,
493     PartialEq,
494     PartialOrd,
495     Serialize,
496     ToOcamlRep
498 #[repr(C, u8)]
499 pub enum XhpEnumValue {
500     #[rust_to_ocaml(name = "XEV_Int")]
501     XEVInt(isize),
502     #[rust_to_ocaml(name = "XEV_String")]
503     XEVString(String),
506 /// Hack's primitive types (as the typechecker understands them).
508 /// Used in the AST of typehints (Aast_defs.Hprim) and in the representation of
509 /// types (Typing_defs.Tprim).
510 #[derive(
511     Clone,
512     Copy,
513     Debug,
514     Deserialize,
515     Eq,
516     EqModuloPos,
517     EqModuloPosAndReason,
518     FromOcamlRep,
519     FromOcamlRepIn,
520     Hash,
521     NoPosHash,
522     Ord,
523     PartialEq,
524     PartialOrd,
525     Serialize,
526     ToOcamlRep
528 #[repr(u8)]
529 pub enum Tprim {
530     Tnull,
531     Tvoid,
532     Tint,
533     Tbool,
534     Tfloat,
535     Tstring,
536     Tresource,
537     Tnum,
538     Tarraykey,
539     Tnoreturn,
541 impl TrivialDrop for Tprim {}
542 arena_deserializer::impl_deserialize_in_arena!(Tprim);
544 #[derive(
545     Clone,
546     Copy,
547     Debug,
548     Deserialize,
549     Eq,
550     EqModuloPos,
551     EqModuloPosAndReason,
552     FromOcamlRep,
553     FromOcamlRepIn,
554     Hash,
555     NoPosHash,
556     Ord,
557     PartialEq,
558     PartialOrd,
559     Serialize,
560     ToOcamlRep
562 #[repr(u8)]
563 pub enum TypedefVisibility {
564     Transparent,
565     Opaque,
566     OpaqueModule,
568 impl TrivialDrop for TypedefVisibility {}
569 arena_deserializer::impl_deserialize_in_arena!(TypedefVisibility);
571 #[derive(
572     Clone,
573     Copy,
574     Debug,
575     Deserialize,
576     Eq,
577     EqModuloPos,
578     EqModuloPosAndReason,
579     FromOcamlRep,
580     FromOcamlRepIn,
581     Hash,
582     NoPosHash,
583     Ord,
584     PartialEq,
585     PartialOrd,
586     Serialize,
587     ToOcamlRep
589 #[rust_to_ocaml(attr = r#"deriving ((show { with_path = false }), eq, ord,
590     (visitors
591        {
592          variety = "iter";
593          nude = true;
594          visit_prefix = "on_";
595          ancestors = ["Visitors_runtime.iter_base"]
596        }),
597     (visitors
598        {
599          variety = "endo";
600          nude = true;
601          visit_prefix = "on_";
602          ancestors = ["Visitors_runtime.endo_base"]
603        }),
604     (visitors
605        {
606          variety = "reduce";
607          nude = true;
608          visit_prefix = "on_";
609          ancestors = ["Visitors_runtime.reduce_base"]
610        }),
611     (visitors
612        {
613          variety = "map";
614          nude = true;
615          visit_prefix = "on_";
616          ancestors = ["Visitors_runtime.map_base"]
617        }))"#)]
618 #[repr(u8)]
619 pub enum ReifyKind {
620     Erased,
621     SoftReified,
622     Reified,
624 impl TrivialDrop for ReifyKind {}
625 arena_deserializer::impl_deserialize_in_arena!(ReifyKind);