pub enum StmtKind<'ast> {
Block(Block<'ast>),
AssignSingle(AstPath<'ast>, Expr<'ast>),
AssignMulti(&'ast mut RawThinSlice<(), AstPath<'ast>>, Expr<'ast>),
Expr(Expr<'ast>),
If(Expr<'ast>, Block<'ast>),
For(&'ast mut StmtFor<'ast>),
Switch(StmtSwitch<'ast>),
Leave,
Break,
Continue,
FunctionDef(Function<'ast>),
VarDecl(&'ast mut RawThinSlice<(), Ident>, Option<Expr<'ast>>),
}Expand description
A kind of Yul statement.
Variants§
Block(Block<'ast>)
A blocked scope: { ... }.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulBlock
AssignSingle(AstPath<'ast>, Expr<'ast>)
A single-variable assignment statement: x := 1.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulAssignment
AssignMulti(&'ast mut RawThinSlice<(), AstPath<'ast>>, Expr<'ast>)
A multiple-variable assignment statement: x, y, z := foo(1, 2).
Multi-assignments require a function call on the right-hand side.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulAssignment
Expr(Expr<'ast>)
An expression statement. This can only be a function call.
If(Expr<'ast>, Block<'ast>)
An if statement: if lt(a, b) { ... }.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulIfStatement
For(&'ast mut StmtFor<'ast>)
A for statement: for {let i := 0} lt(i,10) {i := add(i,1)} { ... }.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulForStatement
Breakdown of parts: https://docs.soliditylang.org/en/latest/yul.html#loops
Switch(StmtSwitch<'ast>)
A switch statement: switch expr case 0 { ... } default { ... }.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulSwitchStatement
Leave
A leave statement: leave.
Break
A break statement: break.
Continue
A continue statement: continue.
FunctionDef(Function<'ast>)
A function definition statement: function f() { ... }.
VarDecl(&'ast mut RawThinSlice<(), Ident>, Option<Expr<'ast>>)
A variable declaration statement: let x := 0.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulVariableDeclaration
Trait Implementations§
Auto Trait Implementations§
impl<'ast> Freeze for StmtKind<'ast>
impl<'ast> RefUnwindSafe for StmtKind<'ast>
impl<'ast> Send for StmtKind<'ast>
impl<'ast> Sync for StmtKind<'ast>
impl<'ast> Unpin for StmtKind<'ast>
impl<'ast> !UnwindSafe for StmtKind<'ast>
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
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more