swc_estree_ast/
common.rs

1use serde::{Deserialize, Serialize};
2use swc_atoms::Atom;
3use swc_common::ast_serde;
4
5use crate::{
6    class::*, comment::Comment, decl::*, expr::*, flow::*, jsx::*, lit::*, module::*, object::*,
7    pat::*, stmt::*, typescript::*,
8};
9
10#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
11#[serde(rename_all = "camelCase")]
12pub struct LineCol {
13    pub line: usize,
14    pub column: usize,
15}
16
17impl LineCol {
18    pub fn dummy() -> Self {
19        LineCol { line: 0, column: 0 }
20    }
21}
22
23#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
24#[serde(rename_all = "camelCase")]
25pub struct Loc {
26    pub start: LineCol,
27    pub end: LineCol,
28}
29
30impl Loc {
31    pub fn dummy() -> Self {
32        Loc {
33            start: LineCol::dummy(),
34            end: LineCol::dummy(),
35        }
36    }
37}
38
39#[derive(Debug, Clone, PartialEq, Eq)]
40#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
41#[cfg_attr(feature = "serde-impl", serde(rename_all = "camelCase"))]
42pub struct BaseNode {
43    #[serde(default, skip_serializing_if = "Vec::is_empty")]
44    pub leading_comments: Vec<Comment>,
45    #[serde(default, skip_serializing_if = "Vec::is_empty")]
46    pub inner_comments: Vec<Comment>,
47    #[serde(default, skip_serializing_if = "Vec::is_empty")]
48    pub trailing_comments: Vec<Comment>,
49
50    #[serde(default)]
51    pub start: Option<u32>,
52    #[serde(default)]
53    pub end: Option<u32>,
54
55    #[serde(default, skip_serializing_if = "crate::flavor::Flavor::skip_range")]
56    pub range: Option<[u32; 2]>,
57
58    #[serde(default)]
59    pub loc: Option<Loc>,
60}
61
62#[derive(Debug, Clone, PartialEq)]
63#[ast_serde]
64pub enum Binary {
65    #[tag("BinaryExpression")]
66    BinaryExpr(BinaryExpression),
67    #[tag("LogicalExpression")]
68    LogicalExpr(LogicalExpression),
69}
70
71#[derive(Debug, Clone, PartialEq)]
72#[ast_serde]
73pub enum Conditional {
74    #[tag("ConditionalExpression")]
75    Expr(ConditionalExpression),
76    #[tag("IfStatement")]
77    If(IfStatement),
78}
79
80#[derive(Debug, Clone, PartialEq)]
81#[ast_serde]
82pub enum Function {
83    #[tag("FunctionDeclaration")]
84    Decl(FunctionDeclaration),
85    #[tag("FunctionExpression")]
86    Expr(FunctionExpression),
87    #[tag("ObjectMethod")]
88    ObjectMethod(ObjectMethod),
89    #[tag("ArrowFunctionExpression")]
90    Arrow(ArrowFunctionExpression),
91    #[tag("ClassMethod")]
92    ClassMethod(ClassMethod),
93    #[tag("ClassPrivateMethod")]
94    ClassPrivateMethod(ClassPrivateMethod),
95}
96
97#[derive(Debug, Clone, PartialEq)]
98#[ast_serde]
99pub enum FunctionParent {
100    #[tag("FunctionDeclaration")]
101    Decl(FunctionDeclaration),
102    #[tag("FunctionExpression")]
103    Expr(FunctionExpression),
104    #[tag("ObjectMethod")]
105    ObjectMethod(ObjectMethod),
106    #[tag("ArrowFunctionExpression")]
107    Arrow(ArrowFunctionExpression),
108    #[tag("ClassMethod")]
109    ClassMethod(ClassMethod),
110    #[tag("ClassPrivateMethod")]
111    ClassPrivateMethod(ClassPrivateMethod),
112}
113
114#[derive(Debug, Clone, PartialEq)]
115#[ast_serde]
116pub enum Immutable {
117    #[tag("StringLiteral")]
118    #[tag("DecimalLiteral")]
119    #[tag("NumericLiteral")]
120    #[tag("NullLiteral")]
121    #[tag("BooleanLiteral")]
122    #[tag("BigIntLiteral")]
123    Literal(Literal),
124    #[tag("JSXAttribute")]
125    JSXAttribute(JSXAttribute),
126    #[tag("JSXClosingElement")]
127    JSXClosingElement(JSXClosingElement),
128    #[tag("JSXElement")]
129    JSXElement(JSXElement),
130    #[tag("JSXExpressionContainer")]
131    JSXExpressionContainer(JSXExpressionContainer),
132    #[tag("JSXSpreadChild")]
133    JSXSpreadChild(JSXSpreadChild),
134    #[tag("JSXOpeningElement")]
135    JSXOpeningElement(JSXOpeningElement),
136    #[tag("JSXText")]
137    JSXText(JSXText),
138    #[tag("JSXFragment")]
139    JSXFragment(JSXFragment),
140    #[tag("JSXOpeningFragment")]
141    JSXOpeningFragment(JSXOpeningFragment),
142    #[tag("JSXClosingFragment")]
143    JSXClosingFragment(JSXClosingFragment),
144}
145
146#[derive(Debug, Clone, PartialEq)]
147#[ast_serde]
148pub enum Method {
149    #[tag("ObjectMethod")]
150    Object(ObjectMethod),
151    #[tag("ClassMethod")]
152    Class(ClassMethod),
153    #[tag("ClassPrivateMethod")]
154    ClassPrivate(ClassPrivateMethod),
155}
156
157#[derive(Debug, Clone, PartialEq)]
158#[ast_serde]
159pub enum Private {
160    #[tag("ClassPrivateProperty")]
161    ClassProp(ClassPrivateProperty),
162    #[tag("ClassPrivateMethod")]
163    ClassMethod(ClassPrivateMethod),
164    #[tag("PrivateName")]
165    Name(PrivateName),
166}
167
168#[derive(Debug, Clone, PartialEq)]
169#[ast_serde]
170pub enum Property {
171    #[tag("ObjectProperty")]
172    ObjectProp(ObjectProperty),
173    #[tag("ClassProperty")]
174    ClassProp(ClassProperty),
175    #[tag("ClassPrivateProperty")]
176    ClassPrivateProp(ClassPrivateProperty),
177}
178
179#[derive(Debug, Clone, PartialEq)]
180#[ast_serde]
181pub enum Pureish {
182    #[tag("FunctionDeclaration")]
183    FunctionDecl(FunctionDeclaration),
184    #[tag("FunctionExpression")]
185    FunctionExpr(FunctionExpression),
186    #[tag("StringLiteral")]
187    #[tag("NumericLiteral")]
188    #[tag("NullLiteral")]
189    #[tag("BooleanLiteral")]
190    #[tag("RegExpLiteral")]
191    #[tag("BigIntLiteral")]
192    #[tag("DecimalLiteral")]
193    Literal(Literal),
194    #[tag("ArrowFunctionExpression")]
195    ArrowFuncExpr(ArrowFunctionExpression),
196}
197
198#[derive(Debug, Clone, PartialEq)]
199#[ast_serde]
200pub enum Scopable {
201    #[tag("BlockStatement")]
202    BlockStmt(BlockStatement),
203    #[tag("CatchClause")]
204    CatchClause(CatchClause),
205    #[tag("DoWhileStatement")]
206    DoWhileStmt(DoWhileStatement),
207    #[tag("ForInStatement")]
208    ForInStmt(ForInStatement),
209    #[tag("ForStatement")]
210    ForStmt(ForStatement),
211    #[tag("FunctionDeclaration")]
212    FuncDecl(FunctionDeclaration),
213    #[tag("FunctionExpression")]
214    FuncExpr(FunctionExpression),
215    #[tag("Program")]
216    Program(Program),
217    #[tag("ObjectMethod")]
218    ObjectMethod(ObjectMethod),
219    #[tag("SwitchStatement")]
220    SwitchStmt(SwitchStatement),
221    #[tag("WhileStatement")]
222    WhileStmt(WhileStatement),
223    #[tag("ArrowFunctionExpression")]
224    ArrowFuncExpr(ArrowFunctionExpression),
225    #[tag("ClassExpression")]
226    ClassExpr(ClassExpression),
227    #[tag("ClassDeclaration")]
228    ClassDecl(ClassDeclaration),
229    #[tag("ForOfStatement")]
230    ForOfStmt(ForOfStatement),
231    #[tag("ClassMethod")]
232    ClassMethod(ClassMethod),
233    #[tag("ClassPrivateMethod")]
234    ClassPrivateMethod(ClassPrivateMethod),
235    #[tag("StaticBlock")]
236    StaticBlock(StaticBlock),
237    #[tag("TSModuleBlock")]
238    TSModuleBlock(TSModuleBlock),
239}
240
241#[derive(Debug, Clone, PartialEq)]
242#[ast_serde]
243pub enum BlockParent {
244    #[tag("BlockStatement")]
245    BlockStmt(BlockStatement),
246    #[tag("CatchClause")]
247    CatchClause(CatchClause),
248    #[tag("DoWhileStatement")]
249    DoWhileStmt(DoWhileStatement),
250    #[tag("ForInStatement")]
251    ForInStmt(ForInStatement),
252    #[tag("ForStatement")]
253    ForStmt(ForStatement),
254    #[tag("FunctionDeclaration")]
255    FuncDecl(FunctionDeclaration),
256    #[tag("FunctionExpression")]
257    FuncExpr(FunctionExpression),
258    #[tag("Program")]
259    Program(Program),
260    #[tag("ObjectMethod")]
261    ObjectMethod(ObjectMethod),
262    #[tag("SwitchStatement")]
263    SwitchStmt(SwitchStatement),
264    #[tag("WhileStatement")]
265    WhileStmt(WhileStatement),
266    #[tag("ArrowFunctionExpression")]
267    ArrowFuncExpr(ArrowFunctionExpression),
268    #[tag("ForOfStatement")]
269    ForOfStmt(ForOfStatement),
270    #[tag("ClassMethod")]
271    ClassMethod(ClassMethod),
272    #[tag("ClassPrivateMethod")]
273    ClassPrivateMethod(ClassPrivateMethod),
274    #[tag("StaticBlock")]
275    StaticBlock(StaticBlock),
276    #[tag("TSModuleBlock")]
277    TSModuleBlock(TSModuleBlock),
278}
279
280#[derive(Debug, Clone, PartialEq)]
281#[ast_serde]
282pub enum Block {
283    #[tag("BlockStatement")]
284    BlockStmt(BlockStatement),
285    #[tag("Program")]
286    Program(Program),
287    #[tag("TSModuleBlock")]
288    TSModuleBlock(TSModuleBlock),
289}
290
291#[derive(Debug, Clone, PartialEq)]
292#[ast_serde]
293pub enum Terminatorless {
294    #[tag("BreakStatement")]
295    Break(BreakStatement),
296    #[tag("ContinueStatement")]
297    Continue(ContinueStatement),
298    #[tag("ReturnStatement")]
299    Return(ReturnStatement),
300    #[tag("ThrowStatement")]
301    Throw(ThrowStatement),
302    #[tag("YieldExpression")]
303    Yield(YieldExpression),
304    #[tag("AwaitExpression")]
305    Await(AwaitExpression),
306}
307
308#[derive(Debug, Clone, PartialEq)]
309#[ast_serde]
310pub enum UnaryLike {
311    #[tag("UnaryExpression")]
312    Expr(UnaryExpression),
313    #[tag("SpreadElement")]
314    Spread(SpreadElement),
315}
316
317#[derive(Debug, Clone, PartialEq)]
318#[ast_serde("SpreadElement")]
319pub struct SpreadElement {
320    #[serde(flatten)]
321    pub base: BaseNode,
322    pub argument: Box<Expression>,
323}
324
325/// Deprecated. Use SpreadElement instead.
326#[derive(Debug, Clone, PartialEq)]
327#[ast_serde("SpreadProperty")]
328pub struct SpreadProperty {
329    #[serde(flatten)]
330    pub base: BaseNode,
331    pub argument: Box<Expression>,
332}
333
334#[derive(Debug, Clone, PartialEq)]
335#[ast_serde("RestElement")]
336pub struct RestElement {
337    #[serde(flatten)]
338    pub base: BaseNode,
339    pub argument: Box<LVal>,
340    #[serde(default, skip_serializing_if = "crate::flavor::Flavor::skip_empty")]
341    pub decorators: Option<Vec<Decorator>>,
342    #[serde(default, skip_serializing_if = "crate::flavor::Flavor::skip_none")]
343    pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
344}
345
346/// Deprecated. Use RestElement element.
347#[derive(Debug, Clone, PartialEq)]
348#[ast_serde("RestProperty")]
349pub struct RestProperty {
350    #[serde(flatten)]
351    pub base: BaseNode,
352    pub argument: LVal,
353    #[serde(default)]
354    pub decorators: Option<Vec<Decorator>>,
355    #[serde(default)]
356    pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
357}
358
359#[derive(Debug, Clone, PartialEq)]
360#[ast_serde("Identifier")]
361pub struct Identifier {
362    #[serde(flatten)]
363    pub base: BaseNode,
364    #[serde(default)]
365    pub name: Atom,
366    #[serde(default, skip_serializing_if = "crate::flavor::Flavor::skip_empty")]
367    pub decorators: Option<Vec<Decorator>>,
368    #[serde(
369        default,
370        skip_serializing_if = "crate::flavor::Flavor::skip_none_and_false"
371    )]
372    pub optional: Option<bool>,
373    #[serde(default, skip_serializing_if = "crate::flavor::Flavor::skip_none")]
374    pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
375}
376
377#[derive(Debug, Clone, PartialEq)]
378#[ast_serde]
379pub enum IdOrQualifiedId {
380    #[tag("Identifier")]
381    Id(Identifier),
382    #[tag("QualifiedTypeIdentifier")]
383    QualifiedId(QualifiedTypeIdentifier),
384}
385
386#[derive(Debug, Clone, PartialEq)]
387#[ast_serde]
388pub enum IdOrString {
389    #[tag("Identifier")]
390    Id(Identifier),
391    #[tag("StringLiteral")]
392    String(StringLiteral),
393}
394
395#[derive(Debug, Clone, PartialEq)]
396#[ast_serde]
397pub enum IdOrRest {
398    #[tag("Identifier")]
399    Id(Identifier),
400    #[tag("RestElement")]
401    Rest(RestElement),
402}
403
404#[derive(Debug, Clone, PartialEq)]
405#[ast_serde("Decorator")]
406pub struct Decorator {
407    #[serde(flatten)]
408    pub base: BaseNode,
409    pub expression: Box<Expression>,
410}
411
412#[derive(Debug, Clone, PartialEq, Eq)]
413#[ast_serde("Noop")]
414pub struct Noop {
415    #[serde(flatten)]
416    pub base: BaseNode,
417}
418
419#[derive(Debug, Clone, PartialEq)]
420#[ast_serde]
421pub enum Param {
422    #[tag("Identifier")]
423    Id(Identifier),
424    #[tag("AssignmentPattern")]
425    #[tag("ArrayPattern")]
426    #[tag("ObjectPattern")]
427    Pat(Pattern),
428    #[tag("RestElement")]
429    Rest(RestElement),
430    #[tag("TSParameterProperty")]
431    TSProp(TSParameterProperty),
432}
433
434#[derive(Debug, Clone, PartialEq)]
435#[ast_serde]
436pub enum LVal {
437    #[tag("Identifier")]
438    Id(Identifier),
439    #[tag("MemberExpression")]
440    MemberExpr(MemberExpression),
441    #[tag("RestElement")]
442    RestEl(RestElement),
443    #[tag("AssignmentPattern")]
444    AssignmentPat(AssignmentPattern),
445    #[tag("ArrayPattern")]
446    ArrayPat(ArrayPattern),
447    #[tag("ObjectPattern")]
448    ObjectPat(ObjectPattern),
449    #[tag("TSParameterProperty")]
450    TSParamProp(TSParameterProperty),
451}
452
453#[derive(Debug, Clone, PartialEq)]
454#[ast_serde]
455pub enum PatternLike {
456    #[tag("Identifier")]
457    Id(Identifier),
458    #[tag("RestElement")]
459    RestEl(RestElement),
460    #[tag("AssignmentPattern")]
461    AssignmentPat(AssignmentPattern),
462    #[tag("ArrayPattern")]
463    ArrayPat(ArrayPattern),
464    #[tag("ObjectPattern")]
465    ObjectPat(ObjectPattern),
466}
467
468#[derive(Debug, Clone, PartialEq)]
469#[ast_serde]
470pub enum TypeAnnotOrNoop {
471    #[tag("TypeAnnotation")]
472    Flow(TypeAnnotation),
473    #[tag("TSTypeAnnotation")]
474    TS(Box<TSTypeAnnotation>),
475    #[tag("Noop")]
476    Noop(Noop),
477}
478
479impl From<TSTypeAnnotation> for TypeAnnotOrNoop {
480    fn from(annot: TSTypeAnnotation) -> Self {
481        TypeAnnotOrNoop::TS(Box::new(annot))
482    }
483}
484
485#[derive(Debug, Clone, PartialEq)]
486#[ast_serde]
487pub enum TypeParamDeclOrNoop {
488    #[tag("TypeParameterDeclaration")]
489    Flow(TypeParameterDeclaration),
490    #[tag("TSTypeParameterDeclaration")]
491    TS(TSTypeParameterDeclaration),
492    #[tag("Noop")]
493    Noop(Noop),
494}
495
496impl From<TSTypeParameterDeclaration> for TypeParamDeclOrNoop {
497    fn from(decl: TSTypeParameterDeclaration) -> Self {
498        TypeParamDeclOrNoop::TS(decl)
499    }
500}
501
502#[derive(Debug, Clone, PartialEq)]
503#[ast_serde]
504pub enum SuperTypeParams {
505    #[tag("TypeParameterInstantiation")]
506    Flow(TypeParameterInstantiation),
507    #[tag("TSTypeParameterInstantiation")]
508    TS(TSTypeParameterInstantiation),
509}
510
511impl From<TSTypeParameterInstantiation> for SuperTypeParams {
512    fn from(param: TSTypeParameterInstantiation) -> Self {
513        SuperTypeParams::TS(param)
514    }
515}
516
517#[derive(Debug, Clone, PartialEq)]
518#[ast_serde("PrivateName")]
519pub struct PrivateName {
520    #[serde(flatten)]
521    pub base: BaseNode,
522    pub id: Identifier,
523}
524
525#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
526#[serde(rename_all = "lowercase")]
527pub enum Access {
528    Public,
529    Private,
530    Protected,
531}
532
533#[derive(Debug, Clone, PartialEq)]
534#[ast_serde("MetaProperty")]
535pub struct MetaProperty {
536    #[serde(flatten)]
537    pub base: BaseNode,
538    pub meta: Identifier,
539    pub property: Identifier,
540}
541
542#[derive(Debug, Clone, PartialEq, Eq)]
543#[ast_serde("Directive")]
544pub struct Directive {
545    #[serde(flatten)]
546    pub base: BaseNode,
547    pub value: DirectiveLiteral,
548}
549
550#[derive(Debug, Clone, PartialEq, Eq)]
551#[ast_serde("DirectiveLiteral")]
552pub struct DirectiveLiteral {
553    #[serde(flatten)]
554    pub base: BaseNode,
555    #[serde(default)]
556    pub value: Atom,
557}
558
559#[derive(Debug, Clone, PartialEq)]
560#[ast_serde("PipelineBareFunction")]
561pub struct PipelineBareFunction {
562    #[serde(flatten)]
563    pub base: BaseNode,
564    pub callee: Box<Expression>,
565}
566
567#[derive(Debug, Clone, PartialEq)]
568#[ast_serde("PipelineTopicExpression")]
569pub struct PipelineTopicExpression {
570    #[serde(flatten)]
571    pub base: BaseNode,
572    pub expression: Box<Expression>,
573}
574
575#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
576pub enum PlaceholderExpectedNode {
577    Identifier,
578    StringLiteral,
579    Expression,
580    Statement,
581    Declaration,
582    BlockStatement,
583    ClassBody,
584    Pattern,
585}
586
587#[derive(Debug, Clone, PartialEq)]
588#[ast_serde("Placeholder")]
589pub struct Placeholder {
590    #[serde(flatten)]
591    pub base: BaseNode,
592    pub expected_node: PlaceholderExpectedNode,
593    pub name: Identifier,
594}
595
596// NOTE(dwoznicki): Node is part of the babel node definitions, but it's never
597// used and a pain to maintain. Do we actually need this?
598//
599// #[derive(Debug, Clone, PartialEq)]
600// #[ast_serde]
601// pub enum Node {
602//     #[tag("AnyTypeAnnotation")]
603//     AnyTypeAnnotation(AnyTypeAnnotation),
604//     #[tag("ArgumentPlaceholder")]
605//     ArgumentPlaceholder(ArgumentPlaceholder),
606//     #[tag("ArrayExpression")]
607//     ArrayExpression(ArrayExpression),
608//     #[tag("ArrayPattern")]
609//     ArrayPattern(ArrayPattern),
610//     #[tag("ArrayTypeAnnotation")]
611//     ArrayTypeAnnotation(ArrayTypeAnnotation),
612//     #[tag("ArrowFunctionExpression")]
613//     ArrowFunctionExpression(ArrowFunctionExpression),
614//     #[tag("AssignmentExpression")]
615//     AssignmentExpression(AssignmentExpression),
616//     #[tag("AssignmentPattern")]
617//     AssignmentPattern(AssignmentPattern),
618//     #[tag("AwaitExpression")]
619//     AwaitExpression(AwaitExpression),
620//     #[tag("BigIntLiteral")]
621//     BigIntLiteral(BigIntLiteral),
622//     #[tag("BinaryExpression")]
623//     #[tag("LogicalExpression")]
624//     Binary(Binary),
625//     #[tag("BinaryExpression")]
626//     BinaryExpression(BinaryExpression),
627//     #[tag("BindExpression")]
628//     BindExpression(BindExpression),
629//     #[tag("BlockStatement")]
630//     #[tag("Program")]
631//     #[tag("TSModuleBlock")]
632//     Block(Block),
633//     #[tag("*")]
634//     BlockParent(BlockParent),
635//     #[tag("BlockStatement")]
636//     BlockStatement(BlockStatement),
637//     BooleanLiteral(BooleanLiteral),
638//     BooleanLiteralTypeAnnotation(BooleanLiteralTypeAnnotation),
639//     BooleanTypeAnnotation(BooleanTypeAnnotation),
640//     BreakStatement(BreakStatement),
641//     CallExpression(CallExpression),
642//     CatchClause(CatchClause),
643//     Class(Class),
644//     ClassBody(ClassBody),
645//     ClassDeclaration(ClassDeclaration),
646//     ClassExpression(ClassExpression),
647//     ClassImplements(ClassImplements),
648//     ClassMethod(ClassMethod),
649//     ClassPrivateMethod(ClassPrivateMethod),
650//     ClassPrivateProperty(ClassPrivateProperty),
651//     ClassProperty(ClassProperty),
652//     CompletionStatement(CompletionStatement),
653//     Conditional(Conditional),
654//     ConditionalExpression(ConditionalExpression),
655//     ContinueStatement(ContinueStatement),
656//     DebuggerStatement(DebuggerStatement),
657//     DecimalLiteral(DecimalLiteral),
658//     Declaration(Declaration),
659//     DeclareClass(DeclareClass),
660//     DeclareExportAllDeclaration(DeclareExportAllDeclaration),
661//     DeclareExportDeclaration(DeclareExportDeclaration),
662//     DeclareFunction(DeclareFunction),
663//     DeclareInterface(DeclareInterface),
664//     DeclareModule(DeclareModule),
665//     DeclareModuleExports(DeclareModuleExports),
666//     DeclareOpaqueType(DeclareOpaqueType),
667//     DeclareTypeAlias(DeclareTypeAlias),
668//     DeclareVariable(DeclareVariable),
669//     DeclaredPredicate(DeclaredPredicate),
670//     Decorator(Decorator),
671//     Directive(Directive),
672//     DirectiveLiteral(DirectiveLiteral),
673//     DoExpression(DoExpression),
674//     DoWhileStatement(DoWhileStatement),
675//     EmptyStatement(EmptyStatement),
676//     EmptyTypeAnnotation(EmptyTypeAnnotation),
677//     EnumBody(EnumBody),
678//     EnumBooleanBody(EnumBooleanBody),
679//     EnumBooleanMember(EnumBooleanMember),
680//     EnumDeclaration(EnumDeclaration),
681//     EnumDefaultedMember(EnumDefaultedMember),
682//     EnumMember(EnumMember),
683//     EnumNumberBody(EnumNumberBody),
684//     EnumNumberMember(EnumNumberMember),
685//     EnumStringBody(EnumStringBody),
686//     EnumStringMember(EnumStringMember),
687//     EnumSymbolBody(EnumSymbolBody),
688//     ExistsTypeAnnotation(ExistsTypeAnnotation),
689//     ExportAllDeclaration(ExportAllDeclaration),
690//     ExportDeclaration(ExportDeclaration),
691//     ExportDefaultDeclaration(ExportDefaultDeclaration),
692//     ExportDefaultSpecifier(ExportDefaultSpecifier),
693//     ExportNamedDeclaration(ExportNamedDeclaration),
694//     ExportNamespaceSpecifier(ExportNamespaceSpecifier),
695//     ExportSpecifier(ExportSpecifier),
696//     Expression(Expression),
697//     ExpressionStatement(ExpressionStatement),
698//     ExpressionWrapper(ExpressionWrapper),
699//     File(File),
700//     Flow(Flow),
701//     FlowBaseAnnotation(FlowBaseAnnotation),
702//     FlowDeclaration(FlowDeclaration),
703//     FlowPredicate(FlowPredicate),
704//     FlowType(FlowType),
705//     For(For),
706//     ForInStatement(ForInStatement),
707//     ForOfStatement(ForOfStatement),
708//     ForStatement(ForStatement),
709//     ForXStatement(ForXStatement),
710//     Function(Function),
711//     FunctionDeclaration(FunctionDeclaration),
712//     FunctionExpression(FunctionExpression),
713//     FunctionParent(FunctionParent),
714//     FunctionTypeAnnotation(FunctionTypeAnnotation),
715//     FunctionTypeParam(FunctionTypeParam),
716//     GenericTypeAnnotation(GenericTypeAnnotation),
717//     Identifier(Identifier),
718//     IfStatement(IfStatement),
719//     Immutable(Immutable),
720//     Import(Import),
721//     ImportAttribute(ImportAttribute),
722//     ImportDeclaration(ImportDeclaration),
723//     ImportDefaultSpecifier(ImportDefaultSpecifier),
724//     ImportNamespaceSpecifier(ImportNamespaceSpecifier),
725//     ImportSpecifier(ImportSpecifier),
726//     InferredPredicate(InferredPredicate),
727//     InterfaceDeclaration(InterfaceDeclaration),
728//     InterfaceExtends(InterfaceExtends),
729//     InterfaceTypeAnnotation(InterfaceTypeAnnotation),
730//     InterpreterDirective(InterpreterDirective),
731//     IntersectionTypeAnnotation(IntersectionTypeAnnotation),
732//     JSX(JSX),
733//     JSXAttribute(JSXAttribute),
734//     JSXClosingElement(JSXClosingElement),
735//     JSXClosingFragment(JSXClosingFragment),
736//     JSXElement(JSXElement),
737//     JSXEmptyExpression(JSXEmptyExpression),
738//     JSXExpressionContainer(JSXExpressionContainer),
739//     JSXFragment(JSXFragment),
740//     JSXIdentifier(JSXIdentifier),
741//     JSXMemberExpression(JSXMemberExpression),
742//     JSXNamespacedName(JSXNamespacedName),
743//     JSXOpeningElement(JSXOpeningElement),
744//     JSXOpeningFragment(JSXOpeningFragment),
745//     JSXSpreadAttribute(JSXSpreadAttribute),
746//     JSXSpreadChild(JSXSpreadChild),
747//     JSXText(JSXText),
748//     LVal(LVal),
749//     LabeledStatement(LabeledStatement),
750//     Literal(Literal),
751//     LogicalExpression(LogicalExpression),
752//     Loop(Loop),
753//     MemberExpression(MemberExpression),
754//     MetaProperty(MetaProperty),
755//     Method(Method),
756//     MixedTypeAnnotation(MixedTypeAnnotation),
757//     ModuleDeclaration(ModuleDeclaration),
758//     ModuleExpression(ModuleExpression),
759//     ModuleSpecifier(ModuleSpecifier),
760//     NewExpression(NewExpression),
761//     Noop(Noop),
762//     NullLiteral(NullLiteral),
763//     NullLiteralTypeAnnotation(NullLiteralTypeAnnotation),
764//     NullableTypeAnnotation(NullableTypeAnnotation),
765//     NumberLiteral(NumberLiteral),
766//     NumberLiteralTypeAnnotation(NumberLiteralTypeAnnotation),
767//     NumberTypeAnnotation(NumberTypeAnnotation),
768//     NumericLiteral(NumericLiteral),
769//     ObjectExpression(ObjectExpression),
770//     ObjectMember(ObjectMember),
771//     ObjectMethod(ObjectMethod),
772//     ObjectPattern(ObjectPattern),
773//     ObjectProperty(ObjectProperty),
774//     ObjectTypeAnnotation(ObjectTypeAnnotation),
775//     ObjectTypeCallProperty(ObjectTypeCallProperty),
776//     ObjectTypeIndexer(ObjectTypeIndexer),
777//     ObjectTypeInternalSlot(ObjectTypeInternalSlot),
778//     ObjectTypeProperty(ObjectTypeProperty),
779//     ObjectTypeSpreadProperty(ObjectTypeSpreadProperty),
780//     OpaqueType(OpaqueType),
781//     OptionalCallExpression(OptionalCallExpression),
782//     OptionalMemberExpression(OptionalMemberExpression),
783//     ParenthesizedExpression(ParenthesizedExpression),
784//     Pattern(Pattern),
785//     PatternLike(PatternLike),
786//     PipelineBareFunction(PipelineBareFunction),
787//     PipelinePrimaryTopicReference(PipelinePrimaryTopicReference),
788//     PipelineTopicExpression(PipelineTopicExpression),
789//     Placeholder(Placeholder),
790//     Private(Private),
791//     PrivateName(PrivateName),
792//     Program(Program),
793//     Property(Property),
794//     Pureish(Pureish),
795//     QualifiedTypeIdentifier(QualifiedTypeIdentifier),
796//     RecordExpression(RecordExpression),
797//     RegExpLiteral(RegExpLiteral),
798//     RegexLiteral(RegexLiteral),
799//     RestElement(RestElement),
800//     RestProperty(RestProperty),
801//     ReturnStatement(ReturnStatement),
802//     Scopable(Scopable),
803//     SequenceExpression(SequenceExpression),
804//     SpreadElement(SpreadElement),
805//     SpreadProperty(SpreadProperty),
806//     Statement(Statement),
807//     StaticBlock(StaticBlock),
808//     StringLiteral(StringLiteral),
809//     StringLiteralTypeAnnotation(StringLiteralTypeAnnotation),
810//     StringTypeAnnotation(StringTypeAnnotation),
811//     Super(Super),
812//     SwitchCase(SwitchCase),
813//     SwitchStatement(SwitchStatement),
814//     SymbolTypeAnnotation(SymbolTypeAnnotation),
815//     TSAnyKeyword(TSAnyKeyword),
816//     TSArrayType(TSArrayType),
817//     TSAsExpression(TSAsExpression),
818//     TSBaseType(TSBaseType),
819//     TSBigIntKeyword(TSBigIntKeyword),
820//     TSBooleanKeyword(TSBooleanKeyword),
821//     TSCallSignatureDeclaration(TSCallSignatureDeclaration),
822//     TSConditionalType(TSConditionalType),
823//     TSConstructSignatureDeclaration(TSConstructSignatureDeclaration),
824//     TSConstructorType(TSConstructorType),
825//     TSDeclareFunction(TSDeclareFunction),
826//     TSDeclareMethod(TSDeclareMethod),
827//     TSEntityName(TSEntityName),
828//     TSEnumDeclaration(TSEnumDeclaration),
829//     TSEnumMember(TSEnumMember),
830//     TSExportAssignment(TSExportAssignment),
831//     TSExpressionWithTypeArguments(TSExpressionWithTypeArguments),
832//     TSExternalModuleReference(TSExternalModuleReference),
833//     TSFunctionType(TSFunctionType),
834//     TSImportEqualsDeclaration(TSImportEqualsDeclaration),
835//     TSImportType(TSImportType),
836//     TSIndexSignature(TSIndexSignature),
837//     TSIndexedAccessType(TSIndexedAccessType),
838//     TSInferType(TSInferType),
839//     TSInterfaceBody(TSInterfaceBody),
840//     TSInterfaceDeclaration(TSInterfaceDeclaration),
841//     TSIntersectionType(TSIntersectionType),
842//     TSIntrinsicKeyword(TSIntrinsicKeyword),
843//     TSLiteralType(TSLiteralType),
844//     TSMappedType(TSMappedType),
845//     TSMethodSignature(TSMethodSignature),
846//     TSModuleBlock(TSModuleBlock),
847//     TSModuleDeclaration(TSModuleDeclaration),
848//     TSNamedTupleMember(TSNamedTupleMember),
849//     TSNamespaceExportDeclaration(TSNamespaceExportDeclaration),
850//     TSNeverKeyword(TSNeverKeyword),
851//     TSNonNullExpression(TSNonNullExpression),
852//     TSNullKeyword(TSNullKeyword),
853//     TSNumberKeyword(TSNumberKeyword),
854//     TSObjectKeyword(TSObjectKeyword),
855//     TSOptionalType(TSOptionalType),
856//     TSParameterProperty(TSParameterProperty),
857//     TSParenthesizedType(TSParenthesizedType),
858//     TSPropertySignature(TSPropertySignature),
859//     TSQualifiedName(TSQualifiedName),
860//     TSRestType(TSRestType),
861//     TSStringKeyword(TSStringKeyword),
862//     TSSymbolKeyword(TSSymbolKeyword),
863//     TSThisType(TSThisType),
864//     TSTupleType(TSTupleType),
865//     TSType(TSType),
866//     TSTypeAliasDeclaration(TSTypeAliasDeclaration),
867//     TSTypeAnnotation(TSTypeAnnotation),
868//     TSTypeAssertion(TSTypeAssertion),
869//     TSTypeElement(TSTypeElement),
870//     TSTypeLiteral(TSTypeLiteral),
871//     TSTypeOperator(TSTypeOperator),
872//     TSTypeParameter(TSTypeParameter),
873//     TSTypeParameterDeclaration(TSTypeParameterDeclaration),
874//     TSTypeParameterInstantiation(TSTypeParameterInstantiation),
875//     TSTypePredicate(TSTypePredicate),
876//     TSTypeQuery(TSTypeQuery),
877//     TSTypeReference(TSTypeReference),
878//     TSUndefinedKeyword(TSUndefinedKeyword),
879//     TSUnionType(TSUnionType),
880//     TSUnknownKeyword(TSUnknownKeyword),
881//     TSVoidKeyword(TSVoidKeyword),
882//     TaggedTemplateExpression(TaggedTemplateExpression),
883//     TemplateElement(TemplateElement),
884//     TemplateLiteral(TemplateLiteral),
885//     Terminatorless(Terminatorless),
886//     ThisExpression(ThisExpression),
887//     ThisTypeAnnotation(ThisTypeAnnotation),
888//     ThrowStatement(ThrowStatement),
889//     TryStatement(TryStatement),
890//     TupleExpression(TupleExpression),
891//     TupleTypeAnnotation(TupleTypeAnnotation),
892//     TypeAlias(TypeAlias),
893//     TypeAnnotation(TypeAnnotation),
894//     TypeCastExpression(TypeCastExpression),
895//     TypeParameter(TypeParameter),
896//     TypeParameterDeclaration(TypeParameterDeclaration),
897//     TypeParameterInstantiation(TypeParameterInstantiation),
898//     TypeofTypeAnnotation(TypeofTypeAnnotation),
899//     UnaryExpression(UnaryExpression),
900//     UnaryLike(UnaryLike),
901//     UnionTypeAnnotation(UnionTypeAnnotation),
902//     UpdateExpression(UpdateExpression),
903//     UserWhitespacable(UserWhitespacable),
904//     V8IntrinsicIdentifier(V8IntrinsicIdentifier),
905//     VariableDeclaration(VariableDeclaration),
906//     VariableDeclarator(VariableDeclarator),
907//     Variance(Variance),
908//     VoidTypeAnnotation(VoidTypeAnnotation),
909//     While(While),
910//     WhileStatement(WhileStatement),
911//     WithStatement(WithStatement),
912//     YieldExpression(YieldExpression),
913// }