pub enum ExpressionKind {
Show 29 variants
This,
Super,
Identifier(Identifier),
PrivateIdentifier(PrivateIdentifier),
Literal(Literal),
Template {
quasis: Vec<String>,
expressions: Vec<Expression>,
},
TaggedTemplate {
tag: Box<Expression>,
quasis: Vec<String>,
expressions: Vec<Expression>,
},
Array {
elements: Vec<Option<Expression>>,
},
Object {
properties: Vec<ObjectMember>,
},
Member {
object: Box<Expression>,
property: MemberProperty,
optional: bool,
},
Call {
callee: Box<Expression>,
arguments: Vec<Expression>,
optional: bool,
},
New {
callee: Box<Expression>,
arguments: Vec<Expression>,
},
Update {
operator: UpdateOperator,
argument: Box<Expression>,
prefix: bool,
},
Unary {
operator: UnaryOperator,
argument: Box<Expression>,
},
Binary {
operator: BinaryOperator,
left: Box<Expression>,
right: Box<Expression>,
},
Logical {
operator: LogicalOperator,
left: Box<Expression>,
right: Box<Expression>,
},
Conditional {
test: Box<Expression>,
consequent: Box<Expression>,
alternate: Box<Expression>,
},
Assignment {
operator: AssignmentOperator,
left: Box<Expression>,
right: Box<Expression>,
},
Sequence {
expressions: Vec<Expression>,
},
Spread {
argument: Box<Expression>,
},
ArrowFunction(Box<ArrowFunction>),
FunctionExpression(Box<Function>),
ClassExpression(Box<Class>),
Yield {
argument: Option<Box<Expression>>,
delegate: bool,
},
Await {
argument: Box<Expression>,
},
Chain {
expression: Box<Expression>,
},
ImportExpression {
source: Box<Expression>,
options: Option<Box<Expression>>,
},
MetaProperty {
meta: Identifier,
property: Identifier,
},
Parenthesized {
expression: Box<Expression>,
},
}Expand description
The shape of an ECMAScript expression.
Variants§
This
The this keyword.
Super
The super keyword (only valid in certain method bodies).
Identifier(Identifier)
A variable reference.
PrivateIdentifier(PrivateIdentifier)
A private class-field identifier (#foo) used as a value.
Literal(Literal)
A static literal value.
Template
A template literal (`hello ${name}`). The number of quasis
must satisfy quasis.len() == expressions.len() + 1.
Fields
expressions: Vec<Expression>Interpolated expressions, each appearing between two quasis.
TaggedTemplate
A tagged template (tag`hello ${name}`).
Fields
tag: Box<Expression>The tag function expression.
expressions: Vec<Expression>Interpolated expressions.
Array
An array expression. None entries represent holes
([1, , 3]), and any element may be a ExpressionKind::Spread.
Fields
elements: Vec<Option<Expression>>Array elements; None for holes.
Object
An object expression.
Fields
properties: Vec<ObjectMember>Object members in source order.
Member
Property access: object.property or object[property], optionally
?.-qualified.
Fields
object: Box<Expression>The object expression.
property: MemberPropertyThe property selector.
Call
Function application: callee(args), optionally ?.()-qualified.
Fields
callee: Box<Expression>The callee expression.
arguments: Vec<Expression>The argument list (each may be a spread).
New
new invocation: new callee(args).
Fields
callee: Box<Expression>The constructor expression.
arguments: Vec<Expression>The argument list.
Update
++ or -- applied to an argument, prefix or postfix.
Unary
A unary prefix operator (!x, -x, typeof x, …).
Binary
A binary operator without short-circuit semantics.
Fields
operator: BinaryOperatorThe operator.
left: Box<Expression>The left operand.
right: Box<Expression>The right operand.
Logical
A short-circuit logical operator (&&, ||, ??).
Fields
operator: LogicalOperatorThe operator.
left: Box<Expression>The left operand.
right: Box<Expression>The right operand (evaluated lazily).
Conditional
The ternary conditional (test ? consequent : alternate).
Fields
test: Box<Expression>The test expression.
consequent: Box<Expression>The branch when test is truthy.
alternate: Box<Expression>The branch when test is falsy.
Assignment
An assignment expression (x = v, x += v, etc.).
Fields
operator: AssignmentOperatorThe assignment operator (plain = or compound).
left: Box<Expression>The target (an expression that must be a valid assignment target; patterns are validated structurally rather than at the type level).
right: Box<Expression>The right-hand value.
Sequence
A comma expression (a, b, c). Evaluates all in order and yields
the last value.
Fields
expressions: Vec<Expression>Sub-expressions in source order.
Spread
A spread element (...expr).
Fields
argument: Box<Expression>The expression being spread.
ArrowFunction(Box<ArrowFunction>)
An arrow function expression.
FunctionExpression(Box<Function>)
A function expression (named or anonymous).
ClassExpression(Box<Class>)
A class expression.
Yield
yield or yield* in a generator.
Fields
argument: Option<Box<Expression>>Optional argument; yield; with no value gives None.
Await
await expr in an async function.
Fields
argument: Box<Expression>The promise-valued expression to await.
Chain
Optional-chaining wrapper ((obj?.a.b)). ESTree wraps the chain
root so consumers can detect optional-chain shortcircuiting cheaply.
Fields
expression: Box<Expression>The optional-chain expression (a Member or Call with
optional: true at some point in its descent).
ImportExpression
Dynamic import(source, options?).
Fields
source: Box<Expression>The module specifier expression.
options: Option<Box<Expression>>Optional second-argument options bag.
MetaProperty
A meta property: new.target or import.meta.
Fields
meta: IdentifierThe meta keyword (new or import).
property: IdentifierThe property name (target or meta).
Parenthesized
A parenthesised expression. Some tools care about whether the user wrote parens; for those, this variant preserves the distinction.
Fields
expression: Box<Expression>The inner expression.
Trait Implementations§
Source§impl Clone for ExpressionKind
impl Clone for ExpressionKind
Source§fn clone(&self) -> ExpressionKind
fn clone(&self) -> ExpressionKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more