pub enum Node {
Show 71 variants
Program {
body: List,
source_type: SourceType,
},
Expression {
expression: NodeId,
directive: bool,
},
Block {
body: List,
},
Empty,
Debugger,
With {
object: NodeId,
body: NodeId,
},
Return {
argument: Option<NodeId>,
},
Labeled {
label: NodeId,
body: NodeId,
},
Break {
label: Option<NodeId>,
},
Continue {
label: Option<NodeId>,
},
If {
test: NodeId,
consequent: NodeId,
alternate: Option<NodeId>,
},
Switch {
discriminant: NodeId,
cases: List,
},
SwitchCase {
test: Option<NodeId>,
consequent: List,
},
Throw {
argument: NodeId,
},
Try {
block: NodeId,
handler: Option<NodeId>,
finalizer: Option<NodeId>,
},
CatchClause {
param: Option<NodeId>,
body: NodeId,
},
While {
test: NodeId,
body: NodeId,
},
DoWhile {
body: NodeId,
test: NodeId,
},
For {
init: Option<NodeId>,
test: Option<NodeId>,
update: Option<NodeId>,
body: NodeId,
},
ForIn {
left: NodeId,
right: NodeId,
body: NodeId,
},
ForOf {
left: NodeId,
right: NodeId,
body: NodeId,
is_await: bool,
},
VariableDeclaration {
kind: VarKind,
declarations: List,
},
VariableDeclarator {
id: NodeId,
init: Option<NodeId>,
},
Function(Function),
Class(Class),
ClassBody {
body: List,
},
Method {
key: NodeId,
value: NodeId,
kind: MethodKind,
computed: bool,
is_static: bool,
},
Field {
key: NodeId,
value: Option<NodeId>,
computed: bool,
is_static: bool,
},
StaticBlock {
body: List,
},
Identifier,
PrivateIdentifier,
Literal(LiteralKind),
This,
Super,
Array {
elements: List,
comma_after_spread: bool,
},
Elision,
Object {
properties: List,
comma_after_spread: bool,
},
Property {
key: NodeId,
value: NodeId,
kind: PropertyKind,
method: bool,
shorthand: bool,
computed: bool,
},
Template {
quasis: List,
expressions: List,
},
TemplateElement {
tail: bool,
cooked: bool,
},
TaggedTemplate {
tag: NodeId,
quasi: NodeId,
},
Unary {
operator: UnaryOp,
argument: NodeId,
},
Update {
operator: UpdateOp,
prefix: bool,
argument: NodeId,
},
Binary {
operator: BinaryOp,
left: NodeId,
right: NodeId,
},
Logical {
operator: LogicalOp,
left: NodeId,
right: NodeId,
},
Assign {
operator: AssignOp,
left: NodeId,
right: NodeId,
},
Conditional {
test: NodeId,
consequent: NodeId,
alternate: NodeId,
},
Call {
callee: NodeId,
arguments: List,
optional: bool,
},
New {
callee: NodeId,
arguments: List,
},
Member {
object: NodeId,
property: NodeId,
computed: bool,
optional: bool,
},
Chain {
expression: NodeId,
},
Sequence {
expressions: List,
},
Yield {
argument: Option<NodeId>,
delegate: bool,
},
Await {
argument: NodeId,
},
Spread {
argument: NodeId,
},
MetaProperty {
meta: NodeId,
property: NodeId,
},
Import {
source: NodeId,
options: Option<NodeId>,
},
Paren {
expression: NodeId,
},
ImportDeclaration {
specifiers: List,
source: NodeId,
attributes: List,
},
ImportSpecifier {
imported: NodeId,
local: NodeId,
},
ImportDefaultSpecifier {
local: NodeId,
},
ImportNamespaceSpecifier {
local: NodeId,
},
ImportAttribute {
key: NodeId,
value: NodeId,
},
ExportNamed {
declaration: Option<NodeId>,
specifiers: List,
source: Option<NodeId>,
attributes: List,
},
ExportSpecifier {
local: NodeId,
exported: NodeId,
},
ExportDefault {
declaration: NodeId,
},
ExportAll {
exported: Option<NodeId>,
source: NodeId,
attributes: List,
},
ObjectPattern {
properties: List,
},
ArrayPattern {
elements: List,
},
Rest {
argument: NodeId,
},
AssignmentPattern {
left: NodeId,
right: NodeId,
},
}Expand description
A node. The variants are ESTree’s node types, named without their
Statement and Expression suffixes where those are plain.
Variants§
Program
The whole source. Its span is the whole input.
Expression
An expression as a statement; directive when it’s a string in a
directive prologue, like "use strict".
Block
Empty
Debugger
With
Return
Labeled
Break
Continue
If
Switch
SwitchCase
Throw
Try
CatchClause
While
DoWhile
For
ForIn
ForOf
VariableDeclaration
VariableDeclarator
Function(Function)
Class(Class)
ClassBody
Method
A class method; value is its function.
Field
A class field, ESTree’s PropertyDefinition.
StaticBlock
Identifier
PrivateIdentifier
#name; the span includes the #.
Literal(LiteralKind)
This
Super
Array
elements has a Node::Elision for each hole.
Elision
A hole in an array: the nothing between [, and ,].
Object
Property
An object literal’s or object pattern’s property.
Template
TemplateElement
A template’s text between delimiters; the span leaves the
delimiters out, as acorn’s does. cooked is false for a tagged
template’s invalid escape, whose cooked value is undefined.
TaggedTemplate
Unary
Update
Binary
Logical
Assign
Conditional
Call
New
Member
Chain
An optional chain, a?.b.c, from its start to its end.
Sequence
Yield
Await
Spread
MetaProperty
new.target or import.meta.
Import
import(source) or import(source, options).
Paren
A parenthesized expression. ESTree has no such node, and
Ast::to_estree writes the expression inside instead.
ImportDeclaration
import ... from "source" with { ... }; attributes are
Node::ImportAttributes.
ImportSpecifier
imported as local, or one name as both; imported may be a
string literal.
ImportDefaultSpecifier
ImportNamespaceSpecifier
* as local.
ImportAttribute
type: "json" in a with clause.
ExportNamed
export with a declaration, or with { ... } and maybe a source.
ExportSpecifier
local as exported, or one name as both; either may be a string
literal.
ExportDefault
export default, with a declaration or an expression.
ExportAll
export * from "source", or export * as exported from ....