Crate swc_ecma_ast

Source

Macros§

op
Creates a corresponding operator. This macro is used to make code more readable.

Structs§

ArrayLit
Array literal.
ArrayPat
ArrowExpr
AssignExpr
AssignPat
AssignPatProp
{key} or {key = value}
AssignProp
AutoAccessor
AwaitExpr
BigInt
BigIntValue
A big signed integer type.
BinExpr
BindingIdent
Identifier used as a pattern.
BlockStmt
Use when only block statements are allowed.
Bool
A boolean literal.
BreakStmt
CallExpr
CatchClause
Class
ClassDecl
ClassExpr
Class expression.
ClassMethod
ClassProp
ComputedPropName
CondExpr
Constructor
ContinueStmt
DebuggerStmt
Decorator
DoWhileStmt
EmptyStmt
ExportAll
export * from 'mod'
ExportDecl
ExportDefaultDecl
ExportDefaultExpr
Default exports other than direct function expression or class expression.
ExportDefaultSpecifier
ExportNamedSpecifier
ExportNamespaceSpecifier
export * as foo from 'src';
ExprOrSpread
ExprStmt
FnDecl
FnExpr
Function expression.
ForInStmt
ForOfStmt
ForStmt
Function
Common parts of function and method.
GetterProp
Ident
A complete identifier with span.
IdentName
IfStmt
Import
ImportDecl
ImportDefaultSpecifier
e.g. import foo from 'mod.js'
ImportNamedSpecifier
e.g. local = foo, imported = None import { foo } from 'mod.js' e.g. local = bar, imported = Some(foo) for import { foo as bar } from 'mod.js'
ImportStarAsSpecifier
e.g. import * as foo from 'mod.js'.
ImportWith
According to the current spec with of crate::ImportDecl can only have strings or idents as keys, can’t be nested, can only have string literals as values:
ImportWithItem
Invalid
Represents a invalid node.
JSXAttr
JSXClosingElement
JSXClosingFragment
JSXElement
JSXEmptyExpr
JSXExprContainer
JSXFragment
JSXMemberExpr
JSXNamespacedName
XML-based namespace syntax:
JSXOpeningElement
JSXOpeningFragment
JSXSpreadChild
JSXText
KeyValuePatProp
{key: value}
KeyValueProp
LabeledStmt
ListFormat
Represents the formatting rule for a list of nodes.
MemberExpr
MetaPropExpr
MethodProp
Module
NamedExport
export { foo } from 'mod' export { foo as bar } from 'mod'
NewExpr
Null
Number
A numeric literal.
ObjectLit
Object literal.
ObjectPat
OptCall
OptChainExpr
Param
ParenExpr
PrivateMethod
PrivateName
PrivateProp
Regex
RestPat
EsTree RestElement
ReturnStmt
Script
SeqExpr
SetterProp
SpreadElement
StaticBlock
Str
A string literal.
Super
SuperPropExpr
SwitchCase
SwitchStmt
TaggedTpl
ThisExpr
ThrowStmt
Tpl
TplElement
TryStmt
TsArrayType
TsAsExpr
TsCallSignatureDecl
TsConditionalType
TsConstAssertion
TsConstructSignatureDecl
TsConstructorType
TsEnumDecl
TsEnumMember
TsExportAssignment
TypeScript’s own parser uses ExportAssignment for both export default and export =. But for @babel/parser, export default is an ExportDefaultDecl, so a TsExportAssignment is always export =.
TsExprWithTypeArgs
TsExternalModuleRef
TsFnType
TsGetterSignature
TsImportCallOptions
TsImportEqualsDecl
TsImportType
TsIndexSignature
TsIndexedAccessType
TsInferType
TsInstantiation
TsInterfaceBody
TsInterfaceDecl
TsIntersectionType
TsKeywordType
TsLitType
TsMappedType
TsMethodSignature
TsModuleBlock
TsModuleDecl
TsNamespaceDecl
TsNamespaceExportDecl
TsNonNullExpr
TsOptionalType
TsParamProp
TsParenthesizedType
TsPropertySignature
TsQualifiedName
TsRestType
TsSatisfiesExpr
TsSetterSignature
TsThisType
TsTplLitType
TsTupleElement
TsTupleType
TsTypeAliasDecl
TsTypeAnn
TsTypeAssertion
TsTypeLit
TsTypeOperator
TsTypeParam
TsTypeParamDecl
TsTypeParamInstantiation
TsTypePredicate
TsTypeQuery
typeof operator
TsTypeRef
TsUnionType
UnaryExpr
UpdateExpr
UsingDecl
VarDecl
VarDeclarator
WhileStmt
WithStmt
YieldExpr

Enums§

Accessibility
AssignOp
AssignTarget
AssignTargetPat
BinaryOp
BlockStmtOrExpr
Callee
ClassMember
Decl
DefaultDecl
EsVersion
Note: This type implements Serailize and Deserialize if serde is enabled, instead of requiring serde-impl feature.
ExportSpecifier
Expr
ForHead
A head for for-in and for-of loop.
ImportPhase
ImportSpecifier
JSXAttrName
JSXAttrOrSpread
JSXAttrValue
JSXElementChild
JSXElementName
JSXExpr
JSXObject
Used for obj property of JSXMemberExpr.
Key
Either a private name or a public name.
Lit
MemberProp
MetaPropKind
MethodKind
ModuleDecl
ModuleExportName
ModuleItem
ObjectPatProp
OptChainBase
ParamOrTsParamProp
Pat
Program
Prop
PropName
PropOrSpread
SimpleAssignTarget
Stmt
SuperProp
TruePlusMinus
TsEntityName
TsEnumMemberId
Invalid: Ident with empty symbol.
TsFnOrConstructorType
TsFnParam
TsKeywordTypeKind
TsLit
TsModuleName
TsModuleRef
TsNamespaceBody
namespace A.B { } is a namespace named A with another TsNamespaceDecl as its body.
TsParamPropParam
TsThisTypeOrIdent
TsType
TsTypeElement
TsTypeOperatorOp
TsTypeQueryExpr
TsUnionOrIntersectionType
UnaryOp
UpdateOp
VarDeclKind
VarDeclOrExpr

Traits§

EsReserved
Pass
A map from the Program to the Program.
SourceMapperExt
SpanExt

Functions§

fn_pass
noop_pass
unsafe_id
This is extremely unsafe so don’t use it unless you know what you are doing.
unsafe_id_from_ident
This is extremely unsafe so don’t use it unless you know what you are doing.

Type Aliases§

Id
See Ident for documentation.
UnsafeId
UnsafeId is a wrapper around Id that does not allocate, but extremely unsafe.