use crate::ast::*;
use oxc_span::{GetSpan, Span};
#[derive(Debug, Clone, Copy)]
pub enum AstType {
BooleanLiteral,
NullLiteral,
NumericLiteral,
BigIntLiteral,
RegExpLiteral,
StringLiteral,
Program,
IdentifierName,
IdentifierReference,
BindingIdentifier,
LabelIdentifier,
ThisExpression,
ArrayExpression,
ArrayExpressionElement,
Elision,
ObjectExpression,
ObjectProperty,
PropertyKey,
TemplateLiteral,
TaggedTemplateExpression,
MemberExpression,
CallExpression,
NewExpression,
MetaProperty,
SpreadElement,
Argument,
UpdateExpression,
UnaryExpression,
BinaryExpression,
PrivateInExpression,
LogicalExpression,
ConditionalExpression,
AssignmentExpression,
AssignmentTarget,
SimpleAssignmentTarget,
AssignmentTargetWithDefault,
SequenceExpression,
Super,
AwaitExpression,
ChainExpression,
ParenthesizedExpression,
Directive,
Hashbang,
BlockStatement,
VariableDeclaration,
VariableDeclarator,
UsingDeclaration,
EmptyStatement,
ExpressionStatement,
IfStatement,
DoWhileStatement,
WhileStatement,
ForStatement,
ForStatementInit,
ForInStatement,
ForOfStatement,
ContinueStatement,
BreakStatement,
ReturnStatement,
WithStatement,
SwitchStatement,
SwitchCase,
LabeledStatement,
ThrowStatement,
TryStatement,
FinallyClause,
CatchClause,
CatchParameter,
DebuggerStatement,
AssignmentPattern,
ObjectPattern,
ArrayPattern,
BindingRestElement,
Function,
FormalParameters,
FormalParameter,
FunctionBody,
ArrowFunctionExpression,
YieldExpression,
Class,
ClassHeritage,
ClassBody,
MethodDefinition,
PropertyDefinition,
PrivateIdentifier,
StaticBlock,
ModuleDeclaration,
ImportExpression,
ImportDeclaration,
ImportSpecifier,
ImportDefaultSpecifier,
ImportNamespaceSpecifier,
ExportNamedDeclaration,
ExportDefaultDeclaration,
ExportAllDeclaration,
ExportSpecifier,
TSThisParameter,
TSEnumDeclaration,
TSEnumMember,
TSTypeAnnotation,
TSLiteralType,
TSUnionType,
TSIntersectionType,
TSParenthesizedType,
TSIndexedAccessType,
TSNamedTupleMember,
TSAnyKeyword,
TSStringKeyword,
TSBooleanKeyword,
TSNumberKeyword,
TSNeverKeyword,
TSIntrinsicKeyword,
TSUnknownKeyword,
TSNullKeyword,
TSUndefinedKeyword,
TSVoidKeyword,
TSSymbolKeyword,
TSThisType,
TSObjectKeyword,
TSBigIntKeyword,
TSTypeReference,
TSTypeName,
TSQualifiedName,
TSTypeParameterInstantiation,
TSTypeParameter,
TSTypeParameterDeclaration,
TSTypeAliasDeclaration,
TSClassImplements,
TSInterfaceDeclaration,
TSPropertySignature,
TSMethodSignature,
TSInterfaceHeritage,
TSModuleDeclaration,
TSModuleBlock,
TSTypeLiteral,
TSInferType,
TSTypeQuery,
TSImportType,
TSTemplateLiteralType,
TSAsExpression,
TSSatisfiesExpression,
TSTypeAssertion,
TSImportEqualsDeclaration,
TSExternalModuleReference,
TSNonNullExpression,
Decorator,
TSInstantiationExpression,
JSXElement,
JSXOpeningElement,
JSXClosingElement,
JSXFragment,
JSXElementName,
JSXNamespacedName,
JSXMemberExpression,
JSXMemberExpressionObject,
JSXExpressionContainer,
JSXAttributeItem,
JSXSpreadAttribute,
JSXIdentifier,
JSXText,
ExpressionArrayElement,
}
#[derive(Debug, Clone, Copy)]
pub enum AstKind<'a> {
BooleanLiteral(&'a BooleanLiteral),
NullLiteral(&'a NullLiteral),
NumericLiteral(&'a NumericLiteral<'a>),
BigIntLiteral(&'a BigIntLiteral<'a>),
RegExpLiteral(&'a RegExpLiteral<'a>),
StringLiteral(&'a StringLiteral<'a>),
Program(&'a Program<'a>),
IdentifierName(&'a IdentifierName<'a>),
IdentifierReference(&'a IdentifierReference<'a>),
BindingIdentifier(&'a BindingIdentifier<'a>),
LabelIdentifier(&'a LabelIdentifier<'a>),
ThisExpression(&'a ThisExpression),
ArrayExpression(&'a ArrayExpression<'a>),
ArrayExpressionElement(&'a ArrayExpressionElement<'a>),
Elision(&'a Elision),
ObjectExpression(&'a ObjectExpression<'a>),
ObjectProperty(&'a ObjectProperty<'a>),
PropertyKey(&'a PropertyKey<'a>),
TemplateLiteral(&'a TemplateLiteral<'a>),
TaggedTemplateExpression(&'a TaggedTemplateExpression<'a>),
MemberExpression(&'a MemberExpression<'a>),
CallExpression(&'a CallExpression<'a>),
NewExpression(&'a NewExpression<'a>),
MetaProperty(&'a MetaProperty<'a>),
SpreadElement(&'a SpreadElement<'a>),
Argument(&'a Argument<'a>),
UpdateExpression(&'a UpdateExpression<'a>),
UnaryExpression(&'a UnaryExpression<'a>),
BinaryExpression(&'a BinaryExpression<'a>),
PrivateInExpression(&'a PrivateInExpression<'a>),
LogicalExpression(&'a LogicalExpression<'a>),
ConditionalExpression(&'a ConditionalExpression<'a>),
AssignmentExpression(&'a AssignmentExpression<'a>),
AssignmentTarget(&'a AssignmentTarget<'a>),
SimpleAssignmentTarget(&'a SimpleAssignmentTarget<'a>),
AssignmentTargetWithDefault(&'a AssignmentTargetWithDefault<'a>),
SequenceExpression(&'a SequenceExpression<'a>),
Super(&'a Super),
AwaitExpression(&'a AwaitExpression<'a>),
ChainExpression(&'a ChainExpression<'a>),
ParenthesizedExpression(&'a ParenthesizedExpression<'a>),
Directive(&'a Directive<'a>),
Hashbang(&'a Hashbang<'a>),
BlockStatement(&'a BlockStatement<'a>),
VariableDeclaration(&'a VariableDeclaration<'a>),
VariableDeclarator(&'a VariableDeclarator<'a>),
UsingDeclaration(&'a UsingDeclaration<'a>),
EmptyStatement(&'a EmptyStatement),
ExpressionStatement(&'a ExpressionStatement<'a>),
IfStatement(&'a IfStatement<'a>),
DoWhileStatement(&'a DoWhileStatement<'a>),
WhileStatement(&'a WhileStatement<'a>),
ForStatement(&'a ForStatement<'a>),
ForStatementInit(&'a ForStatementInit<'a>),
ForInStatement(&'a ForInStatement<'a>),
ForOfStatement(&'a ForOfStatement<'a>),
ContinueStatement(&'a ContinueStatement<'a>),
BreakStatement(&'a BreakStatement<'a>),
ReturnStatement(&'a ReturnStatement<'a>),
WithStatement(&'a WithStatement<'a>),
SwitchStatement(&'a SwitchStatement<'a>),
SwitchCase(&'a SwitchCase<'a>),
LabeledStatement(&'a LabeledStatement<'a>),
ThrowStatement(&'a ThrowStatement<'a>),
TryStatement(&'a TryStatement<'a>),
FinallyClause(&'a BlockStatement<'a>),
CatchClause(&'a CatchClause<'a>),
CatchParameter(&'a CatchParameter<'a>),
DebuggerStatement(&'a DebuggerStatement),
AssignmentPattern(&'a AssignmentPattern<'a>),
ObjectPattern(&'a ObjectPattern<'a>),
ArrayPattern(&'a ArrayPattern<'a>),
BindingRestElement(&'a BindingRestElement<'a>),
Function(&'a Function<'a>),
FormalParameters(&'a FormalParameters<'a>),
FormalParameter(&'a FormalParameter<'a>),
FunctionBody(&'a FunctionBody<'a>),
ArrowFunctionExpression(&'a ArrowFunctionExpression<'a>),
YieldExpression(&'a YieldExpression<'a>),
Class(&'a Class<'a>),
ClassHeritage(&'a Expression<'a>),
ClassBody(&'a ClassBody<'a>),
MethodDefinition(&'a MethodDefinition<'a>),
PropertyDefinition(&'a PropertyDefinition<'a>),
PrivateIdentifier(&'a PrivateIdentifier<'a>),
StaticBlock(&'a StaticBlock<'a>),
ModuleDeclaration(&'a ModuleDeclaration<'a>),
ImportExpression(&'a ImportExpression<'a>),
ImportDeclaration(&'a ImportDeclaration<'a>),
ImportSpecifier(&'a ImportSpecifier<'a>),
ImportDefaultSpecifier(&'a ImportDefaultSpecifier<'a>),
ImportNamespaceSpecifier(&'a ImportNamespaceSpecifier<'a>),
ExportNamedDeclaration(&'a ExportNamedDeclaration<'a>),
ExportDefaultDeclaration(&'a ExportDefaultDeclaration<'a>),
ExportAllDeclaration(&'a ExportAllDeclaration<'a>),
ExportSpecifier(&'a ExportSpecifier<'a>),
TSThisParameter(&'a TSThisParameter<'a>),
TSEnumDeclaration(&'a TSEnumDeclaration<'a>),
TSEnumMember(&'a TSEnumMember<'a>),
TSTypeAnnotation(&'a TSTypeAnnotation<'a>),
TSLiteralType(&'a TSLiteralType<'a>),
TSUnionType(&'a TSUnionType<'a>),
TSIntersectionType(&'a TSIntersectionType<'a>),
TSParenthesizedType(&'a TSParenthesizedType<'a>),
TSIndexedAccessType(&'a TSIndexedAccessType<'a>),
TSNamedTupleMember(&'a TSNamedTupleMember<'a>),
TSAnyKeyword(&'a TSAnyKeyword),
TSStringKeyword(&'a TSStringKeyword),
TSBooleanKeyword(&'a TSBooleanKeyword),
TSNumberKeyword(&'a TSNumberKeyword),
TSNeverKeyword(&'a TSNeverKeyword),
TSIntrinsicKeyword(&'a TSIntrinsicKeyword),
TSUnknownKeyword(&'a TSUnknownKeyword),
TSNullKeyword(&'a TSNullKeyword),
TSUndefinedKeyword(&'a TSUndefinedKeyword),
TSVoidKeyword(&'a TSVoidKeyword),
TSSymbolKeyword(&'a TSSymbolKeyword),
TSThisType(&'a TSThisType),
TSObjectKeyword(&'a TSObjectKeyword),
TSBigIntKeyword(&'a TSBigIntKeyword),
TSTypeReference(&'a TSTypeReference<'a>),
TSTypeName(&'a TSTypeName<'a>),
TSQualifiedName(&'a TSQualifiedName<'a>),
TSTypeParameterInstantiation(&'a TSTypeParameterInstantiation<'a>),
TSTypeParameter(&'a TSTypeParameter<'a>),
TSTypeParameterDeclaration(&'a TSTypeParameterDeclaration<'a>),
TSTypeAliasDeclaration(&'a TSTypeAliasDeclaration<'a>),
TSClassImplements(&'a TSClassImplements<'a>),
TSInterfaceDeclaration(&'a TSInterfaceDeclaration<'a>),
TSPropertySignature(&'a TSPropertySignature<'a>),
TSMethodSignature(&'a TSMethodSignature<'a>),
TSInterfaceHeritage(&'a TSInterfaceHeritage<'a>),
TSModuleDeclaration(&'a TSModuleDeclaration<'a>),
TSModuleBlock(&'a TSModuleBlock<'a>),
TSTypeLiteral(&'a TSTypeLiteral<'a>),
TSInferType(&'a TSInferType<'a>),
TSTypeQuery(&'a TSTypeQuery<'a>),
TSImportType(&'a TSImportType<'a>),
TSTemplateLiteralType(&'a TSTemplateLiteralType<'a>),
TSAsExpression(&'a TSAsExpression<'a>),
TSSatisfiesExpression(&'a TSSatisfiesExpression<'a>),
TSTypeAssertion(&'a TSTypeAssertion<'a>),
TSImportEqualsDeclaration(&'a TSImportEqualsDeclaration<'a>),
TSExternalModuleReference(&'a TSExternalModuleReference<'a>),
TSNonNullExpression(&'a TSNonNullExpression<'a>),
Decorator(&'a Decorator<'a>),
TSInstantiationExpression(&'a TSInstantiationExpression<'a>),
JSXElement(&'a JSXElement<'a>),
JSXOpeningElement(&'a JSXOpeningElement<'a>),
JSXClosingElement(&'a JSXClosingElement<'a>),
JSXFragment(&'a JSXFragment<'a>),
JSXElementName(&'a JSXElementName<'a>),
JSXNamespacedName(&'a JSXNamespacedName<'a>),
JSXMemberExpression(&'a JSXMemberExpression<'a>),
JSXMemberExpressionObject(&'a JSXMemberExpressionObject<'a>),
JSXExpressionContainer(&'a JSXExpressionContainer<'a>),
JSXAttributeItem(&'a JSXAttributeItem<'a>),
JSXSpreadAttribute(&'a JSXSpreadAttribute<'a>),
JSXIdentifier(&'a JSXIdentifier<'a>),
JSXText(&'a JSXText<'a>),
ExpressionArrayElement(&'a Expression<'a>),
}
impl<'a> GetSpan for AstKind<'a> {
#[allow(clippy::match_same_arms)]
fn span(&self) -> Span {
match self {
Self::BooleanLiteral(it) => it.span(),
Self::NullLiteral(it) => it.span(),
Self::NumericLiteral(it) => it.span(),
Self::BigIntLiteral(it) => it.span(),
Self::RegExpLiteral(it) => it.span(),
Self::StringLiteral(it) => it.span(),
Self::Program(it) => it.span(),
Self::IdentifierName(it) => it.span(),
Self::IdentifierReference(it) => it.span(),
Self::BindingIdentifier(it) => it.span(),
Self::LabelIdentifier(it) => it.span(),
Self::ThisExpression(it) => it.span(),
Self::ArrayExpression(it) => it.span(),
Self::ArrayExpressionElement(it) => it.span(),
Self::Elision(it) => it.span(),
Self::ObjectExpression(it) => it.span(),
Self::ObjectProperty(it) => it.span(),
Self::PropertyKey(it) => it.span(),
Self::TemplateLiteral(it) => it.span(),
Self::TaggedTemplateExpression(it) => it.span(),
Self::MemberExpression(it) => it.span(),
Self::CallExpression(it) => it.span(),
Self::NewExpression(it) => it.span(),
Self::MetaProperty(it) => it.span(),
Self::SpreadElement(it) => it.span(),
Self::Argument(it) => it.span(),
Self::UpdateExpression(it) => it.span(),
Self::UnaryExpression(it) => it.span(),
Self::BinaryExpression(it) => it.span(),
Self::PrivateInExpression(it) => it.span(),
Self::LogicalExpression(it) => it.span(),
Self::ConditionalExpression(it) => it.span(),
Self::AssignmentExpression(it) => it.span(),
Self::AssignmentTarget(it) => it.span(),
Self::SimpleAssignmentTarget(it) => it.span(),
Self::AssignmentTargetWithDefault(it) => it.span(),
Self::SequenceExpression(it) => it.span(),
Self::Super(it) => it.span(),
Self::AwaitExpression(it) => it.span(),
Self::ChainExpression(it) => it.span(),
Self::ParenthesizedExpression(it) => it.span(),
Self::Directive(it) => it.span(),
Self::Hashbang(it) => it.span(),
Self::BlockStatement(it) => it.span(),
Self::VariableDeclaration(it) => it.span(),
Self::VariableDeclarator(it) => it.span(),
Self::UsingDeclaration(it) => it.span(),
Self::EmptyStatement(it) => it.span(),
Self::ExpressionStatement(it) => it.span(),
Self::IfStatement(it) => it.span(),
Self::DoWhileStatement(it) => it.span(),
Self::WhileStatement(it) => it.span(),
Self::ForStatement(it) => it.span(),
Self::ForStatementInit(it) => it.span(),
Self::ForInStatement(it) => it.span(),
Self::ForOfStatement(it) => it.span(),
Self::ContinueStatement(it) => it.span(),
Self::BreakStatement(it) => it.span(),
Self::ReturnStatement(it) => it.span(),
Self::WithStatement(it) => it.span(),
Self::SwitchStatement(it) => it.span(),
Self::SwitchCase(it) => it.span(),
Self::LabeledStatement(it) => it.span(),
Self::ThrowStatement(it) => it.span(),
Self::TryStatement(it) => it.span(),
Self::FinallyClause(it) => it.span(),
Self::CatchClause(it) => it.span(),
Self::CatchParameter(it) => it.span(),
Self::DebuggerStatement(it) => it.span(),
Self::AssignmentPattern(it) => it.span(),
Self::ObjectPattern(it) => it.span(),
Self::ArrayPattern(it) => it.span(),
Self::BindingRestElement(it) => it.span(),
Self::Function(it) => it.span(),
Self::FormalParameters(it) => it.span(),
Self::FormalParameter(it) => it.span(),
Self::FunctionBody(it) => it.span(),
Self::ArrowFunctionExpression(it) => it.span(),
Self::YieldExpression(it) => it.span(),
Self::Class(it) => it.span(),
Self::ClassHeritage(it) => it.span(),
Self::ClassBody(it) => it.span(),
Self::MethodDefinition(it) => it.span(),
Self::PropertyDefinition(it) => it.span(),
Self::PrivateIdentifier(it) => it.span(),
Self::StaticBlock(it) => it.span(),
Self::ModuleDeclaration(it) => it.span(),
Self::ImportExpression(it) => it.span(),
Self::ImportDeclaration(it) => it.span(),
Self::ImportSpecifier(it) => it.span(),
Self::ImportDefaultSpecifier(it) => it.span(),
Self::ImportNamespaceSpecifier(it) => it.span(),
Self::ExportNamedDeclaration(it) => it.span(),
Self::ExportDefaultDeclaration(it) => it.span(),
Self::ExportAllDeclaration(it) => it.span(),
Self::ExportSpecifier(it) => it.span(),
Self::TSThisParameter(it) => it.span(),
Self::TSEnumDeclaration(it) => it.span(),
Self::TSEnumMember(it) => it.span(),
Self::TSTypeAnnotation(it) => it.span(),
Self::TSLiteralType(it) => it.span(),
Self::TSUnionType(it) => it.span(),
Self::TSIntersectionType(it) => it.span(),
Self::TSParenthesizedType(it) => it.span(),
Self::TSIndexedAccessType(it) => it.span(),
Self::TSNamedTupleMember(it) => it.span(),
Self::TSAnyKeyword(it) => it.span(),
Self::TSStringKeyword(it) => it.span(),
Self::TSBooleanKeyword(it) => it.span(),
Self::TSNumberKeyword(it) => it.span(),
Self::TSNeverKeyword(it) => it.span(),
Self::TSIntrinsicKeyword(it) => it.span(),
Self::TSUnknownKeyword(it) => it.span(),
Self::TSNullKeyword(it) => it.span(),
Self::TSUndefinedKeyword(it) => it.span(),
Self::TSVoidKeyword(it) => it.span(),
Self::TSSymbolKeyword(it) => it.span(),
Self::TSThisType(it) => it.span(),
Self::TSObjectKeyword(it) => it.span(),
Self::TSBigIntKeyword(it) => it.span(),
Self::TSTypeReference(it) => it.span(),
Self::TSTypeName(it) => it.span(),
Self::TSQualifiedName(it) => it.span(),
Self::TSTypeParameterInstantiation(it) => it.span(),
Self::TSTypeParameter(it) => it.span(),
Self::TSTypeParameterDeclaration(it) => it.span(),
Self::TSTypeAliasDeclaration(it) => it.span(),
Self::TSClassImplements(it) => it.span(),
Self::TSInterfaceDeclaration(it) => it.span(),
Self::TSPropertySignature(it) => it.span(),
Self::TSMethodSignature(it) => it.span(),
Self::TSInterfaceHeritage(it) => it.span(),
Self::TSModuleDeclaration(it) => it.span(),
Self::TSModuleBlock(it) => it.span(),
Self::TSTypeLiteral(it) => it.span(),
Self::TSInferType(it) => it.span(),
Self::TSTypeQuery(it) => it.span(),
Self::TSImportType(it) => it.span(),
Self::TSTemplateLiteralType(it) => it.span(),
Self::TSAsExpression(it) => it.span(),
Self::TSSatisfiesExpression(it) => it.span(),
Self::TSTypeAssertion(it) => it.span(),
Self::TSImportEqualsDeclaration(it) => it.span(),
Self::TSExternalModuleReference(it) => it.span(),
Self::TSNonNullExpression(it) => it.span(),
Self::Decorator(it) => it.span(),
Self::TSInstantiationExpression(it) => it.span(),
Self::JSXElement(it) => it.span(),
Self::JSXOpeningElement(it) => it.span(),
Self::JSXClosingElement(it) => it.span(),
Self::JSXFragment(it) => it.span(),
Self::JSXElementName(it) => it.span(),
Self::JSXNamespacedName(it) => it.span(),
Self::JSXMemberExpression(it) => it.span(),
Self::JSXMemberExpressionObject(it) => it.span(),
Self::JSXExpressionContainer(it) => it.span(),
Self::JSXAttributeItem(it) => it.span(),
Self::JSXSpreadAttribute(it) => it.span(),
Self::JSXIdentifier(it) => it.span(),
Self::JSXText(it) => it.span(),
Self::ExpressionArrayElement(it) => it.span(),
}
}
}