Enum solang_parser::pt::Statement
source · pub enum Statement {
Show 17 variants
Block {
loc: Loc,
unchecked: bool,
statements: Vec<Statement>,
},
Assembly {
loc: Loc,
dialect: Option<StringLiteral>,
flags: Option<Vec<StringLiteral>>,
block: YulBlock,
},
Args(Loc, Vec<NamedArgument>),
If(Loc, Expression, Box<Statement>, Option<Box<Statement>>),
While(Loc, Expression, Box<Statement>),
Expression(Loc, Expression),
VariableDefinition(Loc, VariableDeclaration, Option<Expression>),
For(Loc, Option<Box<Statement>>, Option<Box<Expression>>, Option<Box<Expression>>, Option<Box<Statement>>),
DoWhile(Loc, Box<Statement>, Expression),
Continue(Loc),
Break(Loc),
Return(Loc, Option<Expression>),
Revert(Loc, Option<IdentifierPath>, Vec<Expression>),
RevertNamedArgs(Loc, Option<IdentifierPath>, Vec<NamedArgument>),
Emit(Loc, Expression),
Try(Loc, Expression, Option<(ParameterList, Box<Statement>)>, Vec<CatchClause>),
Error(Loc),
}
Expand description
A statement.
Variants§
Block
[unchecked] { <statements>* }
Fields
Assembly
assembly [dialect] [(<flags>,*)] <block>
Fields
§
dialect: Option<StringLiteral>
The assembly dialect.
§
flags: Option<Vec<StringLiteral>>
The assembly flags.
Args(Loc, Vec<NamedArgument>)
{ <1>,* }
If(Loc, Expression, Box<Statement>, Option<Box<Statement>>)
if ({1}) <2> [else <3>]
Note that the <1>
expression does not contain the parentheses.
While(Loc, Expression, Box<Statement>)
while ({1}) <2>
Note that the <1>
expression does not contain the parentheses.
Expression(Loc, Expression)
An Expression.
VariableDefinition(Loc, VariableDeclaration, Option<Expression>)
<1> [= <2>];
For(Loc, Option<Box<Statement>>, Option<Box<Expression>>, Option<Box<Expression>>, Option<Box<Statement>>)
for ([1]; [2]; [3]) [4]
The [4]
block statement is None
when the for
statement ends with a semicolon.
DoWhile(Loc, Box<Statement>, Expression)
do <1> while ({2});
Note that the <2>
expression does not contain the parentheses.
Continue(Loc)
continue;
Break(Loc)
break;
Return(Loc, Option<Expression>)
return [1];
Revert(Loc, Option<IdentifierPath>, Vec<Expression>)
revert [1] (<2>,*);
RevertNamedArgs(Loc, Option<IdentifierPath>, Vec<NamedArgument>)
revert [1] ({ <2>,* });
Emit(Loc, Expression)
emit <1>;
<1>
is FunctionCall
.
Try(Loc, Expression, Option<(ParameterList, Box<Statement>)>, Vec<CatchClause>)
try <1> [returns (<2.1>,*) <2.2>] <3>*
<1>
is either New(FunctionCall)
or FunctionCall
.
Error(Loc)
An error occurred during parsing.
Implementations§
Trait Implementations§
source§impl OptionalCodeLocation for Statement
impl OptionalCodeLocation for Statement
source§impl PartialEq for Statement
impl PartialEq for Statement
impl Eq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
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
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>
Converts
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>
Converts
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