pub enum ExprKind {
Show 36 variants
Ident(Ident),
Null,
Bool(bool),
Number(f64),
BigInt {
digits: String,
radix: u32,
},
String(String),
RegExp {
pattern: String,
flags: String,
},
This,
Array {
elements: Vec<Option<ArrayElement>>,
},
Object(Vec<ObjectProperty>),
Function(Box<Function>),
Arrow(Box<Function>),
Class(Box<Class>),
Template(Box<TemplateLiteral>),
TaggedTemplate {
tag: Box<Expr>,
quasi: Box<TemplateLiteral>,
},
Member {
object: Box<Expr>,
property: MemberProp,
optional: bool,
},
Call {
callee: Box<Expr>,
arguments: Vec<Expr>,
optional: bool,
},
New {
callee: Box<Expr>,
arguments: Option<Vec<Expr>>,
},
NewTarget,
ImportMeta,
ImportCall(Box<Expr>),
SuperCall(Vec<Expr>),
SuperProp,
Unary {
op: UnaryOp,
argument: Box<Expr>,
},
Update {
op: UpdateOp,
argument: Box<Expr>,
prefix: bool,
},
Binary {
op: BinaryOp,
left: Box<Expr>,
right: Box<Expr>,
},
Logical {
op: LogicalOp,
left: Box<Expr>,
right: Box<Expr>,
},
Conditional {
test: Box<Expr>,
cons: Box<Expr>,
alt: Box<Expr>,
},
Assign {
op: AssignOp,
target: Box<Pattern>,
value: Box<Expr>,
},
Paren(Box<Expr>),
Sequence(Vec<Expr>),
Yield {
argument: Option<Box<Expr>>,
delegate: bool,
},
Await(Box<Expr>),
Spread(Box<Expr>),
OptionalChain(Box<Expr>),
PrivateIn {
name: Ident,
object: Box<Expr>,
},
}Expand description
Expression payloads.
Variants§
Ident(Ident)
An identifier reference (not resolved to a binding yet).
Null
null
Bool(bool)
true / false
Number(f64)
1.5
BigInt
1n
String(String)
"text"
RegExp
/pattern/flags
This
this
Array
[a, b, ...c]
Fields
elements: Vec<Option<ArrayElement>>Elements; None for an elision.
Object(Vec<ObjectProperty>)
{ a, b: c, ...d }
Function(Box<Function>)
function name() {}
Arrow(Box<Function>)
(params) => body
Class(Box<Class>)
class { }
Template(Box<TemplateLiteral>)
`a${b}c`
TaggedTemplate
tag`a${b}c`
Member
a.b, a[b], a?.b, super.x
Fields
property: MemberPropSelector.
Call
f(args)
Fields
New
new C(args) / new C
Fields
NewTarget
new.target
ImportMeta
import.meta
ImportCall(Box<Expr>)
import(specifier)
SuperCall(Vec<Expr>)
super() — only valid in a derived constructor.
SuperProp
super.x / super[x] base (never standalone).
Unary
op expr
Update
++x, x--
Fields
Binary
a + b, a instanceof b, a in b, …
Logical
a && b, a || b, a ?? b (kept separate for mixing rules and
short-circuit code generation).
Conditional
a ? b : c
Assign
target op= value
Fields
Paren(Box<Expr>)
(expr) — kept as a node so that early errors can tell (a ?? b) || c
(legal) from a ?? b || c (SyntaxError), and (a) = 1 from (a, b) = 1.
Sequence(Vec<Expr>)
(a, b, c)
Yield
yield expr / yield* expr
Await(Box<Expr>)
await expr
Spread(Box<Expr>)
...expr — only valid in call arguments, arrays and object literals.
OptionalChain(Box<Expr>)
A member/call chain that contains at least one ?.. Compiling the
wrapper short-circuits the whole spine when a link’s base is nullish.
PrivateIn
#x in obj