Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/oxc_ast/src/ast_kind_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ impl AstKind<'_> {
t.quasi().map_or_else(|| "None".into(), |q| format!("Some({q})"))
)
.into(),
Self::TemplateElement(_) => "TemplateElement".into(),

Self::MetaProperty(_) => "MetaProperty".into(),
Self::Super(_) => "Super".into(),
Expand Down
349 changes: 179 additions & 170 deletions crates/oxc_ast/src/generated/ast_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,176 +27,177 @@ pub enum AstType {
PropertyKey = 10,
TemplateLiteral = 11,
TaggedTemplateExpression = 12,
ComputedMemberExpression = 13,
StaticMemberExpression = 14,
PrivateFieldExpression = 15,
CallExpression = 16,
NewExpression = 17,
MetaProperty = 18,
SpreadElement = 19,
Argument = 20,
UpdateExpression = 21,
UnaryExpression = 22,
BinaryExpression = 23,
PrivateInExpression = 24,
LogicalExpression = 25,
ConditionalExpression = 26,
AssignmentExpression = 27,
AssignmentTarget = 28,
SimpleAssignmentTarget = 29,
AssignmentTargetPattern = 30,
ArrayAssignmentTarget = 31,
ObjectAssignmentTarget = 32,
AssignmentTargetWithDefault = 33,
SequenceExpression = 34,
Super = 35,
AwaitExpression = 36,
ChainExpression = 37,
ParenthesizedExpression = 38,
Directive = 39,
Hashbang = 40,
BlockStatement = 41,
VariableDeclaration = 42,
VariableDeclarator = 43,
EmptyStatement = 44,
ExpressionStatement = 45,
IfStatement = 46,
DoWhileStatement = 47,
WhileStatement = 48,
ForStatement = 49,
ForInStatement = 50,
ForOfStatement = 51,
ContinueStatement = 52,
BreakStatement = 53,
ReturnStatement = 54,
WithStatement = 55,
SwitchStatement = 56,
SwitchCase = 57,
LabeledStatement = 58,
ThrowStatement = 59,
TryStatement = 60,
CatchClause = 61,
CatchParameter = 62,
DebuggerStatement = 63,
AssignmentPattern = 64,
ObjectPattern = 65,
ArrayPattern = 66,
BindingRestElement = 67,
Function = 68,
FormalParameters = 69,
FormalParameter = 70,
FunctionBody = 71,
ArrowFunctionExpression = 72,
YieldExpression = 73,
Class = 74,
ClassBody = 75,
MethodDefinition = 76,
PropertyDefinition = 77,
PrivateIdentifier = 78,
StaticBlock = 79,
ModuleDeclaration = 80,
AccessorProperty = 81,
ImportExpression = 82,
ImportDeclaration = 83,
ImportSpecifier = 84,
ImportDefaultSpecifier = 85,
ImportNamespaceSpecifier = 86,
WithClause = 87,
ImportAttribute = 88,
ExportNamedDeclaration = 89,
ExportDefaultDeclaration = 90,
ExportAllDeclaration = 91,
ExportSpecifier = 92,
V8IntrinsicExpression = 93,
BooleanLiteral = 94,
NullLiteral = 95,
NumericLiteral = 96,
StringLiteral = 97,
BigIntLiteral = 98,
RegExpLiteral = 99,
JSXElement = 100,
JSXOpeningElement = 101,
JSXClosingElement = 102,
JSXFragment = 103,
JSXOpeningFragment = 104,
JSXClosingFragment = 105,
JSXNamespacedName = 106,
JSXMemberExpression = 107,
JSXExpressionContainer = 108,
JSXEmptyExpression = 109,
JSXAttribute = 110,
JSXSpreadAttribute = 111,
JSXIdentifier = 112,
JSXSpreadChild = 113,
JSXText = 114,
TSThisParameter = 115,
TSEnumDeclaration = 116,
TSEnumBody = 117,
TSEnumMember = 118,
TSTypeAnnotation = 119,
TSLiteralType = 120,
TSConditionalType = 121,
TSUnionType = 122,
TSIntersectionType = 123,
TSParenthesizedType = 124,
TSTypeOperator = 125,
TSArrayType = 126,
TSIndexedAccessType = 127,
TSTupleType = 128,
TSNamedTupleMember = 129,
TSOptionalType = 130,
TSRestType = 131,
TSAnyKeyword = 132,
TSStringKeyword = 133,
TSBooleanKeyword = 134,
TSNumberKeyword = 135,
TSNeverKeyword = 136,
TSIntrinsicKeyword = 137,
TSUnknownKeyword = 138,
TSNullKeyword = 139,
TSUndefinedKeyword = 140,
TSVoidKeyword = 141,
TSSymbolKeyword = 142,
TSThisType = 143,
TSObjectKeyword = 144,
TSBigIntKeyword = 145,
TSTypeReference = 146,
TSTypeName = 147,
TSQualifiedName = 148,
TSTypeParameterInstantiation = 149,
TSTypeParameter = 150,
TSTypeParameterDeclaration = 151,
TSTypeAliasDeclaration = 152,
TSClassImplements = 153,
TSInterfaceDeclaration = 154,
TSPropertySignature = 155,
TSCallSignatureDeclaration = 156,
TSMethodSignature = 157,
TSConstructSignatureDeclaration = 158,
TSIndexSignatureName = 159,
TSInterfaceHeritage = 160,
TSTypePredicate = 161,
TSModuleDeclaration = 162,
TSModuleBlock = 163,
TSTypeLiteral = 164,
TSInferType = 165,
TSTypeQuery = 166,
TSImportType = 167,
TSMappedType = 168,
TSTemplateLiteralType = 169,
TSAsExpression = 170,
TSSatisfiesExpression = 171,
TSTypeAssertion = 172,
TSImportEqualsDeclaration = 173,
TSExternalModuleReference = 174,
TSNonNullExpression = 175,
Decorator = 176,
TSExportAssignment = 177,
TSNamespaceExportDeclaration = 178,
TSInstantiationExpression = 179,
JSDocNullableType = 180,
JSDocNonNullableType = 181,
JSDocUnknownType = 182,
TemplateElement = 13,
ComputedMemberExpression = 14,
StaticMemberExpression = 15,
PrivateFieldExpression = 16,
CallExpression = 17,
NewExpression = 18,
MetaProperty = 19,
SpreadElement = 20,
Argument = 21,
UpdateExpression = 22,
UnaryExpression = 23,
BinaryExpression = 24,
PrivateInExpression = 25,
LogicalExpression = 26,
ConditionalExpression = 27,
AssignmentExpression = 28,
AssignmentTarget = 29,
SimpleAssignmentTarget = 30,
AssignmentTargetPattern = 31,
ArrayAssignmentTarget = 32,
ObjectAssignmentTarget = 33,
AssignmentTargetWithDefault = 34,
SequenceExpression = 35,
Super = 36,
AwaitExpression = 37,
ChainExpression = 38,
ParenthesizedExpression = 39,
Directive = 40,
Hashbang = 41,
BlockStatement = 42,
VariableDeclaration = 43,
VariableDeclarator = 44,
EmptyStatement = 45,
ExpressionStatement = 46,
IfStatement = 47,
DoWhileStatement = 48,
WhileStatement = 49,
ForStatement = 50,
ForInStatement = 51,
ForOfStatement = 52,
ContinueStatement = 53,
BreakStatement = 54,
ReturnStatement = 55,
WithStatement = 56,
SwitchStatement = 57,
SwitchCase = 58,
LabeledStatement = 59,
ThrowStatement = 60,
TryStatement = 61,
CatchClause = 62,
CatchParameter = 63,
DebuggerStatement = 64,
AssignmentPattern = 65,
ObjectPattern = 66,
ArrayPattern = 67,
BindingRestElement = 68,
Function = 69,
FormalParameters = 70,
FormalParameter = 71,
FunctionBody = 72,
ArrowFunctionExpression = 73,
YieldExpression = 74,
Class = 75,
ClassBody = 76,
MethodDefinition = 77,
PropertyDefinition = 78,
PrivateIdentifier = 79,
StaticBlock = 80,
ModuleDeclaration = 81,
AccessorProperty = 82,
ImportExpression = 83,
ImportDeclaration = 84,
ImportSpecifier = 85,
ImportDefaultSpecifier = 86,
ImportNamespaceSpecifier = 87,
WithClause = 88,
ImportAttribute = 89,
ExportNamedDeclaration = 90,
ExportDefaultDeclaration = 91,
ExportAllDeclaration = 92,
ExportSpecifier = 93,
V8IntrinsicExpression = 94,
BooleanLiteral = 95,
NullLiteral = 96,
NumericLiteral = 97,
StringLiteral = 98,
BigIntLiteral = 99,
RegExpLiteral = 100,
JSXElement = 101,
JSXOpeningElement = 102,
JSXClosingElement = 103,
JSXFragment = 104,
JSXOpeningFragment = 105,
JSXClosingFragment = 106,
JSXNamespacedName = 107,
JSXMemberExpression = 108,
JSXExpressionContainer = 109,
JSXEmptyExpression = 110,
JSXAttribute = 111,
JSXSpreadAttribute = 112,
JSXIdentifier = 113,
JSXSpreadChild = 114,
JSXText = 115,
TSThisParameter = 116,
TSEnumDeclaration = 117,
TSEnumBody = 118,
TSEnumMember = 119,
TSTypeAnnotation = 120,
TSLiteralType = 121,
TSConditionalType = 122,
TSUnionType = 123,
TSIntersectionType = 124,
TSParenthesizedType = 125,
TSTypeOperator = 126,
TSArrayType = 127,
TSIndexedAccessType = 128,
TSTupleType = 129,
TSNamedTupleMember = 130,
TSOptionalType = 131,
TSRestType = 132,
TSAnyKeyword = 133,
TSStringKeyword = 134,
TSBooleanKeyword = 135,
TSNumberKeyword = 136,
TSNeverKeyword = 137,
TSIntrinsicKeyword = 138,
TSUnknownKeyword = 139,
TSNullKeyword = 140,
TSUndefinedKeyword = 141,
TSVoidKeyword = 142,
TSSymbolKeyword = 143,
TSThisType = 144,
TSObjectKeyword = 145,
TSBigIntKeyword = 146,
TSTypeReference = 147,
TSTypeName = 148,
TSQualifiedName = 149,
TSTypeParameterInstantiation = 150,
TSTypeParameter = 151,
TSTypeParameterDeclaration = 152,
TSTypeAliasDeclaration = 153,
TSClassImplements = 154,
TSInterfaceDeclaration = 155,
TSPropertySignature = 156,
TSCallSignatureDeclaration = 157,
TSMethodSignature = 158,
TSConstructSignatureDeclaration = 159,
TSIndexSignatureName = 160,
TSInterfaceHeritage = 161,
TSTypePredicate = 162,
TSModuleDeclaration = 163,
TSModuleBlock = 164,
TSTypeLiteral = 165,
TSInferType = 166,
TSTypeQuery = 167,
TSImportType = 168,
TSMappedType = 169,
TSTemplateLiteralType = 170,
TSAsExpression = 171,
TSSatisfiesExpression = 172,
TSTypeAssertion = 173,
TSImportEqualsDeclaration = 174,
TSExternalModuleReference = 175,
TSNonNullExpression = 176,
Decorator = 177,
TSExportAssignment = 178,
TSNamespaceExportDeclaration = 179,
TSInstantiationExpression = 180,
JSDocNullableType = 181,
JSDocNonNullableType = 182,
JSDocUnknownType = 183,
}

/// Untyped AST Node Kind
Expand All @@ -217,6 +218,7 @@ pub enum AstKind<'a> {
TemplateLiteral(&'a TemplateLiteral<'a>) = AstType::TemplateLiteral as u8,
TaggedTemplateExpression(&'a TaggedTemplateExpression<'a>) =
AstType::TaggedTemplateExpression as u8,
TemplateElement(&'a TemplateElement<'a>) = AstType::TemplateElement as u8,
ComputedMemberExpression(&'a ComputedMemberExpression<'a>) =
AstType::ComputedMemberExpression as u8,
StaticMemberExpression(&'a StaticMemberExpression<'a>) = AstType::StaticMemberExpression as u8,
Expand Down Expand Up @@ -432,6 +434,7 @@ impl GetSpan for AstKind<'_> {
Self::PropertyKey(it) => it.span(),
Self::TemplateLiteral(it) => it.span(),
Self::TaggedTemplateExpression(it) => it.span(),
Self::TemplateElement(it) => it.span(),
Self::ComputedMemberExpression(it) => it.span(),
Self::StaticMemberExpression(it) => it.span(),
Self::PrivateFieldExpression(it) => it.span(),
Expand Down Expand Up @@ -622,6 +625,7 @@ impl GetAddress for AstKind<'_> {
Self::PropertyKey(it) => it.address(),
Self::TemplateLiteral(it) => Address::from_ptr(it),
Self::TaggedTemplateExpression(it) => Address::from_ptr(it),
Self::TemplateElement(it) => Address::from_ptr(it),
Self::ComputedMemberExpression(it) => Address::from_ptr(it),
Self::StaticMemberExpression(it) => Address::from_ptr(it),
Self::PrivateFieldExpression(it) => Address::from_ptr(it),
Expand Down Expand Up @@ -862,6 +866,11 @@ impl<'a> AstKind<'a> {
if let Self::TaggedTemplateExpression(v) = self { Some(v) } else { None }
}

#[inline]
pub fn as_template_element(self) -> Option<&'a TemplateElement<'a>> {
if let Self::TemplateElement(v) = self { Some(v) } else { None }
}

#[inline]
pub fn as_computed_member_expression(self) -> Option<&'a ComputedMemberExpression<'a>> {
if let Self::ComputedMemberExpression(v) = self { Some(v) } else { None }
Expand Down
Loading
Loading