pub enum StmtKind {
Show 23 variants
Empty,
Block(Vec<Stmt>),
Expr(Box<Expr>),
If {
test: Box<Expr>,
cons: Box<Stmt>,
alt: Option<Box<Stmt>>,
},
DoWhile {
body: Box<Stmt>,
test: Box<Expr>,
},
While {
test: Box<Expr>,
body: Box<Stmt>,
},
For {
init: Option<ForInit>,
test: Option<Box<Expr>>,
update: Option<Box<Expr>>,
body: Box<Stmt>,
},
ForIn {
left: ForHead,
right: Box<Expr>,
body: Box<Stmt>,
},
ForOf {
is_await: bool,
left: ForHead,
right: Box<Expr>,
body: Box<Stmt>,
},
Continue(Option<Ident>),
Break(Option<Ident>),
Return(Option<Box<Expr>>),
With {
object: Box<Expr>,
body: Box<Stmt>,
},
Labeled {
label: Ident,
body: Box<Stmt>,
},
Switch {
discriminant: Box<Expr>,
cases: Vec<SwitchCase>,
},
Throw(Box<Expr>),
Try {
block: Vec<Stmt>,
handler: Option<CatchClause>,
finalizer: Option<Vec<Stmt>>,
},
Debugger,
VarDecl(VarDecl),
FuncDecl(Box<Function>),
ClassDecl(Box<Class>),
Import(Box<ImportDecl>),
Export(Box<ExportDecl>),
}Expand description
Statement and declaration nodes (StatementListItem).
Variants§
Empty
;
Block(Vec<Stmt>)
{ ... }
Expr(Box<Expr>)
expr;
If
if (test) cons else alt
DoWhile
do body while (test);
While
while (test) body
For
for (init; test; update) body
Fields
ForIn
for (decl|lhs in expr) body
ForOf
for (decl|lhs of expr) body, plus for await (…)
Fields
Continue(Option<Ident>)
continue; / continue label;
Break(Option<Ident>)
break; / break label;
Return(Option<Box<Expr>>)
return; / return expr;
With
with (obj) body
Fields
Labeled
label: stmt
Switch
switch (disc) { cases }
Throw(Box<Expr>)
throw expr;
Try
try { } catch (e) { } finally { }
Fields
§
handler: Option<CatchClause>Catch clause, if present.
Debugger
debugger;
VarDecl(VarDecl)
var/let/const declaration.
FuncDecl(Box<Function>)
function declaration.
ClassDecl(Box<Class>)
class declaration.
Import(Box<ImportDecl>)
import declaration (modules only).
Export(Box<ExportDecl>)
export declaration (modules only).
Trait Implementations§
impl StructuralPartialEq for StmtKind
Auto Trait Implementations§
impl Forget for StmtKind
impl Freeze for StmtKind
impl Move for StmtKind
impl RefUnwindSafe for StmtKind
impl Send for StmtKind
impl Sync for StmtKind
impl Unpin for StmtKind
impl UnsafeUnpin for StmtKind
impl UnwindSafe for StmtKind
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