pub enum StatementKind {
Show 20 variants
Block {
body: Vec<Statement>,
},
Empty,
Debugger,
Expression {
expression: Expression,
},
If {
test: Expression,
consequent: Box<Statement>,
alternate: Option<Box<Statement>>,
},
Switch {
discriminant: Expression,
cases: Vec<SwitchCase>,
},
For {
init: Option<ForInit>,
test: Option<Expression>,
update: Option<Expression>,
body: Box<Statement>,
},
ForIn {
left: ForLeft,
right: Expression,
body: Box<Statement>,
},
ForOf {
left: ForLeft,
right: Expression,
body: Box<Statement>,
is_await: bool,
},
While {
test: Expression,
body: Box<Statement>,
},
DoWhile {
body: Box<Statement>,
test: Expression,
},
Return {
argument: Option<Expression>,
},
Throw {
argument: Expression,
},
Try {
block: Vec<Statement>,
handler: Option<CatchClause>,
finalizer: Option<Vec<Statement>>,
},
Break {
label: Option<Identifier>,
},
Continue {
label: Option<Identifier>,
},
Labeled {
label: Identifier,
body: Box<Statement>,
},
VariableDeclaration(VariableDeclaration),
FunctionDeclaration(Function),
ClassDeclaration(Class),
}Expand description
The shape of an ECMAScript statement.
Variants§
Block
A block: { ... }.
Empty
An empty statement (;).
Debugger
debugger;
Expression
An expression evaluated as a statement.
Fields
expression: ExpressionThe expression.
If
if (test) consequent else? alternate.
Fields
test: ExpressionThe test expression.
Switch
switch (discriminant) { cases }.
For
for (init; test; update) body.
Fields
test: Option<Expression>Optional loop-continuation test.
update: Option<Expression>Optional update expression evaluated after each iteration.
ForIn
for (left in right) body.
Fields
right: ExpressionThe object whose enumerable properties are iterated.
ForOf
for (left of right) body, possibly for await.
Fields
right: ExpressionThe iterable expression.
While
while (test) body.
DoWhile
do body while (test);.
Fields
test: ExpressionThe test expression checked after each iteration.
Return
return argument?;
Fields
argument: Option<Expression>Optional return value.
Throw
throw argument;
Fields
argument: ExpressionThe value to throw.
Try
try { ... } catch (e) { ... } finally { ... }.
Fields
handler: Option<CatchClause>Optional catch clause.
Break
break label?;
Fields
label: Option<Identifier>Optional label to break out of.
Continue
continue label?;
Fields
label: Option<Identifier>Optional label to continue.
Labeled
label: body – attach a label to a loop or block.
VariableDeclaration(VariableDeclaration)
A variable declaration treated as a statement.
FunctionDeclaration(Function)
A function declaration.
ClassDeclaration(Class)
A class declaration.
Trait Implementations§
Source§impl Clone for StatementKind
impl Clone for StatementKind
Source§fn clone(&self) -> StatementKind
fn clone(&self) -> StatementKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more