Crate dprint_swc_ecma_ast_view[][src]

Re-exports

pub use swc_ecmascript::ast as swc_ast;

Structs

AncestorIterator
ArrayLit

Array literal.

ArrayPat
ArrowExpr
AssignExpr
AssignPat
AssignPatProp

{key} or {key = value}

AssignProp
AwaitExpr
BigInt
BinExpr
BindingIdent

Identifer used as a pattern.

BlockStmt

Use when only block statements are allowed.

Bool
BreakStmt
BytePos

A byte offset. Keep this small (currently 32-bits), as AST contains a lot of them.

CallExpr
CatchClause
Class
ClassDecl
ClassExpr

Class expression.

ClassMethod
ClassProp
Comment
CommentsIterator
ComputedPropName
CondExpr
Constructor
ContinueStmt
DebuggerStmt
Decorator
DoWhileStmt
EmptyStmt
ExportAll

export * from 'mod'

ExportDecl
ExportDefaultDecl
ExportDefaultExpr
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

Ident with span.

IfStmt
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'.

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
MemberExpr
MetaPropExpr
MethodProp
Module
ModuleInfo
NamedExport

export { foo } from 'mod' export { foo as bar } from 'mod'

NewExpr
Null
Number
ObjectLit

Object literal.

ObjectPat
OptChainExpr
Param
ParenExpr
PrivateMethod
PrivateName
PrivateProp
ProgramInfo
Regex
RestPat

EsTree RestElement

ReturnStmt
Script
ScriptInfo
SeqExpr
SetterProp
Span

Spans represent a region of code, used for error reporting. Positions in spans are absolute positions from the beginning of the source_map, not positions relative to SourceFiles. Methods on the SourceMap can be used to relate spans back to the original source. You must be careful if the span crosses more than one file - you will not be able to use many of the functions on spans in source_map and you cannot assume that the length of the span = hi - lo; there may be space in the BytePos range between files.

SpreadElement
Str
Super
SwitchCase
SwitchStmt
TaggedTpl
ThisExpr
ThrowStmt
TokenAndSpan
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
TsImportEqualsDecl
TsImportType
TsIndexSignature
TsIndexedAccessType
TsInferType
TsInterfaceBody
TsInterfaceDecl
TsIntersectionType
TsKeywordType
TsLitType
TsMappedType
TsMethodSignature
TsModuleBlock
TsModuleDecl
TsNamespaceDecl
TsNamespaceExportDecl
TsNonNullExpr
TsOptionalType
TsParamProp
TsParenthesizedType
TsPropertySignature
TsQualifiedName
TsRestType
TsThisType
TsTplLitType
TsTupleElement
TsTupleType
TsTypeAliasDecl
TsTypeAnn
TsTypeAssertion
TsTypeLit
TsTypeOperator
TsTypeParam
TsTypeParamDecl
TsTypeParamInstantiation
TsTypePredicate
TsTypeQuery

typeof operator

TsTypeRef
TsUnionType
UnaryExpr
UpdateExpr
VarDecl
VarDeclarator
WhileStmt
WithStmt
YieldExpr

Enums

Accessibility
AssignOp
BinaryOp
BlockStmtOrExpr
ClassMember
CommentKind
Decl
DefaultDecl
EsVersion
ExportSpecifier
Expr
ExprOrSuper
ImportSpecifier
JSXAttrName
JSXAttrOrSpread
JSXAttrValue
JSXElementChild
JSXElementName
JSXExpr
JSXObject

Used for obj property of JSXMemberExpr.

Lit
MethodKind
ModuleDecl
ModuleItem
Node
NodeKind
NodeOrToken
ObjectPatProp
ParamOrTsParamProp
Pat
PatOrExpr
Program

A Module or Script node.

Prop
PropName
PropOrSpread
Stmt
StrKind

THis enum determines how string literal should be printed.

Token
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
    VarDeclOrPat

    Traits

    CastableNode
    NodeTrait
    RootNode

    A Module or Script node.

    Spanned

    Derive

    SpannedExt
    TokenExt

    Functions

    with_ast_view
    with_ast_view_for_module
    with_ast_view_for_script

    Derive Macros

    Spanned