Enum swc_ecma_ast::Stmt
source · [−]pub enum Stmt {
Show 19 variants
Block(BlockStmt),
Empty(EmptyStmt),
Debugger(DebuggerStmt),
With(WithStmt),
Return(ReturnStmt),
Labeled(LabeledStmt),
Break(BreakStmt),
Continue(ContinueStmt),
If(IfStmt),
Switch(SwitchStmt),
Throw(ThrowStmt),
Try(Box<TryStmt>),
While(WhileStmt),
DoWhile(DoWhileStmt),
For(ForStmt),
ForIn(ForInStmt),
ForOf(ForOfStmt),
Decl(Decl),
Expr(ExprStmt),
}
Variants
Block(BlockStmt)
Empty(EmptyStmt)
Debugger(DebuggerStmt)
With(WithStmt)
Return(ReturnStmt)
Labeled(LabeledStmt)
Break(BreakStmt)
Continue(ContinueStmt)
If(IfStmt)
Switch(SwitchStmt)
Throw(ThrowStmt)
Try(Box<TryStmt>)
A try statement. If handler is null then finalizer must be a BlockStmt.
While(WhileStmt)
DoWhile(DoWhileStmt)
For(ForStmt)
ForIn(ForInStmt)
ForOf(ForOfStmt)
Decl(Decl)
Expr(ExprStmt)
Implementations
sourceimpl Stmt
impl Stmt
sourcepub fn as_block(&self) -> Option<&BlockStmt>
pub fn as_block(&self) -> Option<&BlockStmt>
Returns Some
if self
is a reference of variant Block
, and None
otherwise.
sourcepub fn as_mut_block(&mut self) -> Option<&mut BlockStmt>
pub fn as_mut_block(&mut self) -> Option<&mut BlockStmt>
Returns Some
if self
is a mutable reference of variant Block
, and None
otherwise.
sourcepub fn expect_block(self) -> BlockStmtwhere
Self: Debug,
pub fn expect_block(self) -> BlockStmtwhere
Self: Debug,
sourcepub fn block(self) -> Option<BlockStmt>
pub fn block(self) -> Option<BlockStmt>
Returns Some
if self
is of variant Block
, and None
otherwise.
sourcepub fn as_empty(&self) -> Option<&EmptyStmt>
pub fn as_empty(&self) -> Option<&EmptyStmt>
Returns Some
if self
is a reference of variant Empty
, and None
otherwise.
sourcepub fn as_mut_empty(&mut self) -> Option<&mut EmptyStmt>
pub fn as_mut_empty(&mut self) -> Option<&mut EmptyStmt>
Returns Some
if self
is a mutable reference of variant Empty
, and None
otherwise.
sourcepub fn expect_empty(self) -> EmptyStmtwhere
Self: Debug,
pub fn expect_empty(self) -> EmptyStmtwhere
Self: Debug,
sourcepub fn empty(self) -> Option<EmptyStmt>
pub fn empty(self) -> Option<EmptyStmt>
Returns Some
if self
is of variant Empty
, and None
otherwise.
sourcepub fn is_debugger(&self) -> bool
pub fn is_debugger(&self) -> bool
Returns true
if self
is of variant Debugger
.
sourcepub fn as_debugger(&self) -> Option<&DebuggerStmt>
pub fn as_debugger(&self) -> Option<&DebuggerStmt>
Returns Some
if self
is a reference of variant Debugger
, and None
otherwise.
sourcepub fn as_mut_debugger(&mut self) -> Option<&mut DebuggerStmt>
pub fn as_mut_debugger(&mut self) -> Option<&mut DebuggerStmt>
Returns Some
if self
is a mutable reference of variant Debugger
, and None
otherwise.
sourcepub fn expect_debugger(self) -> DebuggerStmtwhere
Self: Debug,
pub fn expect_debugger(self) -> DebuggerStmtwhere
Self: Debug,
sourcepub fn debugger(self) -> Option<DebuggerStmt>
pub fn debugger(self) -> Option<DebuggerStmt>
Returns Some
if self
is of variant Debugger
, and None
otherwise.
sourcepub fn as_with(&self) -> Option<&WithStmt>
pub fn as_with(&self) -> Option<&WithStmt>
Returns Some
if self
is a reference of variant With
, and None
otherwise.
sourcepub fn as_mut_with(&mut self) -> Option<&mut WithStmt>
pub fn as_mut_with(&mut self) -> Option<&mut WithStmt>
Returns Some
if self
is a mutable reference of variant With
, and None
otherwise.
sourcepub fn expect_with(self) -> WithStmtwhere
Self: Debug,
pub fn expect_with(self) -> WithStmtwhere
Self: Debug,
sourcepub fn with(self) -> Option<WithStmt>
pub fn with(self) -> Option<WithStmt>
Returns Some
if self
is of variant With
, and None
otherwise.
sourcepub fn is_return_stmt(&self) -> bool
pub fn is_return_stmt(&self) -> bool
Returns true
if self
is of variant Return
.
sourcepub fn as_return_stmt(&self) -> Option<&ReturnStmt>
pub fn as_return_stmt(&self) -> Option<&ReturnStmt>
Returns Some
if self
is a reference of variant Return
, and None
otherwise.
sourcepub fn as_mut_return_stmt(&mut self) -> Option<&mut ReturnStmt>
pub fn as_mut_return_stmt(&mut self) -> Option<&mut ReturnStmt>
Returns Some
if self
is a mutable reference of variant Return
, and None
otherwise.
sourcepub fn expect_return_stmt(self) -> ReturnStmtwhere
Self: Debug,
pub fn expect_return_stmt(self) -> ReturnStmtwhere
Self: Debug,
sourcepub fn return_stmt(self) -> Option<ReturnStmt>
pub fn return_stmt(self) -> Option<ReturnStmt>
Returns Some
if self
is of variant Return
, and None
otherwise.
sourcepub fn is_labeled(&self) -> bool
pub fn is_labeled(&self) -> bool
Returns true
if self
is of variant Labeled
.
sourcepub fn as_labeled(&self) -> Option<&LabeledStmt>
pub fn as_labeled(&self) -> Option<&LabeledStmt>
Returns Some
if self
is a reference of variant Labeled
, and None
otherwise.
sourcepub fn as_mut_labeled(&mut self) -> Option<&mut LabeledStmt>
pub fn as_mut_labeled(&mut self) -> Option<&mut LabeledStmt>
Returns Some
if self
is a mutable reference of variant Labeled
, and None
otherwise.
sourcepub fn expect_labeled(self) -> LabeledStmtwhere
Self: Debug,
pub fn expect_labeled(self) -> LabeledStmtwhere
Self: Debug,
sourcepub fn labeled(self) -> Option<LabeledStmt>
pub fn labeled(self) -> Option<LabeledStmt>
Returns Some
if self
is of variant Labeled
, and None
otherwise.
sourcepub fn is_break_stmt(&self) -> bool
pub fn is_break_stmt(&self) -> bool
Returns true
if self
is of variant Break
.
sourcepub fn as_break_stmt(&self) -> Option<&BreakStmt>
pub fn as_break_stmt(&self) -> Option<&BreakStmt>
Returns Some
if self
is a reference of variant Break
, and None
otherwise.
sourcepub fn as_mut_break_stmt(&mut self) -> Option<&mut BreakStmt>
pub fn as_mut_break_stmt(&mut self) -> Option<&mut BreakStmt>
Returns Some
if self
is a mutable reference of variant Break
, and None
otherwise.
sourcepub fn expect_break_stmt(self) -> BreakStmtwhere
Self: Debug,
pub fn expect_break_stmt(self) -> BreakStmtwhere
Self: Debug,
sourcepub fn break_stmt(self) -> Option<BreakStmt>
pub fn break_stmt(self) -> Option<BreakStmt>
Returns Some
if self
is of variant Break
, and None
otherwise.
sourcepub fn is_continue_stmt(&self) -> bool
pub fn is_continue_stmt(&self) -> bool
Returns true
if self
is of variant Continue
.
sourcepub fn as_continue_stmt(&self) -> Option<&ContinueStmt>
pub fn as_continue_stmt(&self) -> Option<&ContinueStmt>
Returns Some
if self
is a reference of variant Continue
, and None
otherwise.
sourcepub fn as_mut_continue_stmt(&mut self) -> Option<&mut ContinueStmt>
pub fn as_mut_continue_stmt(&mut self) -> Option<&mut ContinueStmt>
Returns Some
if self
is a mutable reference of variant Continue
, and None
otherwise.
sourcepub fn expect_continue_stmt(self) -> ContinueStmtwhere
Self: Debug,
pub fn expect_continue_stmt(self) -> ContinueStmtwhere
Self: Debug,
sourcepub fn continue_stmt(self) -> Option<ContinueStmt>
pub fn continue_stmt(self) -> Option<ContinueStmt>
Returns Some
if self
is of variant Continue
, and None
otherwise.
sourcepub fn is_if_stmt(&self) -> bool
pub fn is_if_stmt(&self) -> bool
Returns true
if self
is of variant If
.
sourcepub fn as_if_stmt(&self) -> Option<&IfStmt>
pub fn as_if_stmt(&self) -> Option<&IfStmt>
Returns Some
if self
is a reference of variant If
, and None
otherwise.
sourcepub fn as_mut_if_stmt(&mut self) -> Option<&mut IfStmt>
pub fn as_mut_if_stmt(&mut self) -> Option<&mut IfStmt>
Returns Some
if self
is a mutable reference of variant If
, and None
otherwise.
sourcepub fn expect_if_stmt(self) -> IfStmtwhere
Self: Debug,
pub fn expect_if_stmt(self) -> IfStmtwhere
Self: Debug,
sourcepub fn if_stmt(self) -> Option<IfStmt>
pub fn if_stmt(self) -> Option<IfStmt>
Returns Some
if self
is of variant If
, and None
otherwise.
sourcepub fn as_switch(&self) -> Option<&SwitchStmt>
pub fn as_switch(&self) -> Option<&SwitchStmt>
Returns Some
if self
is a reference of variant Switch
, and None
otherwise.
sourcepub fn as_mut_switch(&mut self) -> Option<&mut SwitchStmt>
pub fn as_mut_switch(&mut self) -> Option<&mut SwitchStmt>
Returns Some
if self
is a mutable reference of variant Switch
, and None
otherwise.
sourcepub fn expect_switch(self) -> SwitchStmtwhere
Self: Debug,
pub fn expect_switch(self) -> SwitchStmtwhere
Self: Debug,
sourcepub fn switch(self) -> Option<SwitchStmt>
pub fn switch(self) -> Option<SwitchStmt>
Returns Some
if self
is of variant Switch
, and None
otherwise.
sourcepub fn as_throw(&self) -> Option<&ThrowStmt>
pub fn as_throw(&self) -> Option<&ThrowStmt>
Returns Some
if self
is a reference of variant Throw
, and None
otherwise.
sourcepub fn as_mut_throw(&mut self) -> Option<&mut ThrowStmt>
pub fn as_mut_throw(&mut self) -> Option<&mut ThrowStmt>
Returns Some
if self
is a mutable reference of variant Throw
, and None
otherwise.
sourcepub fn expect_throw(self) -> ThrowStmtwhere
Self: Debug,
pub fn expect_throw(self) -> ThrowStmtwhere
Self: Debug,
sourcepub fn throw(self) -> Option<ThrowStmt>
pub fn throw(self) -> Option<ThrowStmt>
Returns Some
if self
is of variant Throw
, and None
otherwise.
sourcepub fn is_try_stmt(&self) -> bool
pub fn is_try_stmt(&self) -> bool
Returns true
if self
is of variant Try
.
sourcepub fn as_try_stmt(&self) -> Option<&Box<TryStmt>>
pub fn as_try_stmt(&self) -> Option<&Box<TryStmt>>
Returns Some
if self
is a reference of variant Try
, and None
otherwise.
sourcepub fn as_mut_try_stmt(&mut self) -> Option<&mut Box<TryStmt>>
pub fn as_mut_try_stmt(&mut self) -> Option<&mut Box<TryStmt>>
Returns Some
if self
is a mutable reference of variant Try
, and None
otherwise.
sourcepub fn expect_try_stmt(self) -> Box<TryStmt>where
Self: Debug,
pub fn expect_try_stmt(self) -> Box<TryStmt>where
Self: Debug,
sourcepub fn try_stmt(self) -> Option<Box<TryStmt>>
pub fn try_stmt(self) -> Option<Box<TryStmt>>
Returns Some
if self
is of variant Try
, and None
otherwise.
sourcepub fn is_while_stmt(&self) -> bool
pub fn is_while_stmt(&self) -> bool
Returns true
if self
is of variant While
.
sourcepub fn as_while_stmt(&self) -> Option<&WhileStmt>
pub fn as_while_stmt(&self) -> Option<&WhileStmt>
Returns Some
if self
is a reference of variant While
, and None
otherwise.
sourcepub fn as_mut_while_stmt(&mut self) -> Option<&mut WhileStmt>
pub fn as_mut_while_stmt(&mut self) -> Option<&mut WhileStmt>
Returns Some
if self
is a mutable reference of variant While
, and None
otherwise.
sourcepub fn expect_while_stmt(self) -> WhileStmtwhere
Self: Debug,
pub fn expect_while_stmt(self) -> WhileStmtwhere
Self: Debug,
sourcepub fn while_stmt(self) -> Option<WhileStmt>
pub fn while_stmt(self) -> Option<WhileStmt>
Returns Some
if self
is of variant While
, and None
otherwise.
sourcepub fn is_do_while(&self) -> bool
pub fn is_do_while(&self) -> bool
Returns true
if self
is of variant DoWhile
.
sourcepub fn as_do_while(&self) -> Option<&DoWhileStmt>
pub fn as_do_while(&self) -> Option<&DoWhileStmt>
Returns Some
if self
is a reference of variant DoWhile
, and None
otherwise.
sourcepub fn as_mut_do_while(&mut self) -> Option<&mut DoWhileStmt>
pub fn as_mut_do_while(&mut self) -> Option<&mut DoWhileStmt>
Returns Some
if self
is a mutable reference of variant DoWhile
, and None
otherwise.
sourcepub fn expect_do_while(self) -> DoWhileStmtwhere
Self: Debug,
pub fn expect_do_while(self) -> DoWhileStmtwhere
Self: Debug,
sourcepub fn do_while(self) -> Option<DoWhileStmt>
pub fn do_while(self) -> Option<DoWhileStmt>
Returns Some
if self
is of variant DoWhile
, and None
otherwise.
sourcepub fn is_for_stmt(&self) -> bool
pub fn is_for_stmt(&self) -> bool
Returns true
if self
is of variant For
.
sourcepub fn as_for_stmt(&self) -> Option<&ForStmt>
pub fn as_for_stmt(&self) -> Option<&ForStmt>
Returns Some
if self
is a reference of variant For
, and None
otherwise.
sourcepub fn as_mut_for_stmt(&mut self) -> Option<&mut ForStmt>
pub fn as_mut_for_stmt(&mut self) -> Option<&mut ForStmt>
Returns Some
if self
is a mutable reference of variant For
, and None
otherwise.
sourcepub fn expect_for_stmt(self) -> ForStmtwhere
Self: Debug,
pub fn expect_for_stmt(self) -> ForStmtwhere
Self: Debug,
sourcepub fn for_stmt(self) -> Option<ForStmt>
pub fn for_stmt(self) -> Option<ForStmt>
Returns Some
if self
is of variant For
, and None
otherwise.
sourcepub fn as_for_in(&self) -> Option<&ForInStmt>
pub fn as_for_in(&self) -> Option<&ForInStmt>
Returns Some
if self
is a reference of variant ForIn
, and None
otherwise.
sourcepub fn as_mut_for_in(&mut self) -> Option<&mut ForInStmt>
pub fn as_mut_for_in(&mut self) -> Option<&mut ForInStmt>
Returns Some
if self
is a mutable reference of variant ForIn
, and None
otherwise.
sourcepub fn expect_for_in(self) -> ForInStmtwhere
Self: Debug,
pub fn expect_for_in(self) -> ForInStmtwhere
Self: Debug,
sourcepub fn for_in(self) -> Option<ForInStmt>
pub fn for_in(self) -> Option<ForInStmt>
Returns Some
if self
is of variant ForIn
, and None
otherwise.
sourcepub fn as_for_of(&self) -> Option<&ForOfStmt>
pub fn as_for_of(&self) -> Option<&ForOfStmt>
Returns Some
if self
is a reference of variant ForOf
, and None
otherwise.
sourcepub fn as_mut_for_of(&mut self) -> Option<&mut ForOfStmt>
pub fn as_mut_for_of(&mut self) -> Option<&mut ForOfStmt>
Returns Some
if self
is a mutable reference of variant ForOf
, and None
otherwise.
sourcepub fn expect_for_of(self) -> ForOfStmtwhere
Self: Debug,
pub fn expect_for_of(self) -> ForOfStmtwhere
Self: Debug,
sourcepub fn for_of(self) -> Option<ForOfStmt>
pub fn for_of(self) -> Option<ForOfStmt>
Returns Some
if self
is of variant ForOf
, and None
otherwise.
sourcepub fn as_decl(&self) -> Option<&Decl>
pub fn as_decl(&self) -> Option<&Decl>
Returns Some
if self
is a reference of variant Decl
, and None
otherwise.
sourcepub fn as_mut_decl(&mut self) -> Option<&mut Decl>
pub fn as_mut_decl(&mut self) -> Option<&mut Decl>
Returns Some
if self
is a mutable reference of variant Decl
, and None
otherwise.
sourcepub fn expect_decl(self) -> Declwhere
Self: Debug,
pub fn expect_decl(self) -> Declwhere
Self: Debug,
sourcepub fn as_expr(&self) -> Option<&ExprStmt>
pub fn as_expr(&self) -> Option<&ExprStmt>
Returns Some
if self
is a reference of variant Expr
, and None
otherwise.
sourcepub fn as_mut_expr(&mut self) -> Option<&mut ExprStmt>
pub fn as_mut_expr(&mut self) -> Option<&mut ExprStmt>
Returns Some
if self
is a mutable reference of variant Expr
, and None
otherwise.