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<Statement>>, 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
Fields
[unchecked] { <statements>* }
Assembly
Fields
§
dialect: Option<StringLiteral>The assembly dialect.
§
flags: Option<Vec<StringLiteral>>The assembly flags.
assembly [dialect] [(<flags>,*)] <block>
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<Statement>>, 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.