pub enum Expr {
Show 24 variants
Null,
Undefined,
True,
False,
Number(f64),
Str(String),
Template {
quasis: Vec<String>,
exprs: Vec<Expr>,
},
Ident(String),
This,
Array(Vec<Expr>),
Object(Vec<Prop>),
Spread(Box<Expr>),
Logical(LogicalOp, Box<Expr>, Box<Expr>),
Unary(UnOp, Box<Expr>),
Binary(BinOp, Box<Expr>, Box<Expr>),
Conditional {
test: Box<Expr>,
cons: Box<Expr>,
alt: Box<Expr>,
},
Assign {
target: Box<Expr>,
value: Box<Expr>,
},
Update {
op: UpdateOp,
prefix: bool,
target: Box<Expr>,
},
Call {
func: Box<Expr>,
args: Vec<Expr>,
optional: bool,
},
New {
callee: Box<Expr>,
args: Vec<Expr>,
},
Member {
object: Box<Expr>,
property: String,
optional: bool,
},
Index {
object: Box<Expr>,
index: Box<Expr>,
optional: bool,
},
Function {
params: Vec<Param>,
body: FnBody,
is_arrow: bool,
name: Option<String>,
},
Sequence(Vec<Expr>),
}Expand description
A JavaScript expression.
Variants§
Null
Undefined
True
False
Number(f64)
Str(String)
Template
A template literal: alternating literal quasis and interpolated exprs.
quasis.len() == exprs.len() + 1.
Ident(String)
A bare identifier (x); the compiler resolves scope at runtime.
This
this.
Array(Vec<Expr>)
Object(Vec<Prop>)
Spread(Box<Expr>)
...expr — a spread element (array/call).
Logical(LogicalOp, Box<Expr>, Box<Expr>)
Unary(UnOp, Box<Expr>)
Binary(BinOp, Box<Expr>, Box<Expr>)
Conditional
test ? cons : alt.
Assign
target = value (or a compound target op= value desugared by the parser).
Update
++x / x++ / --x / x--.
Call
A call func(args). optional marks ?.(.
New
new Ctor(args).
Member
value.name — optional marks ?.name.
Index
value[expr] — optional marks ?.[expr].
Function
A function expression / arrow function.
Sequence(Vec<Expr>)
,-sequence expression: evaluate all, yield the last.
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more