Refactored for loops
This commit is contained in:
+6
-9
@@ -106,7 +106,12 @@ pub enum Statement {
|
||||
else_branch: Option<Box<Statement>>,
|
||||
},
|
||||
While(StatementBranch),
|
||||
For(ForStmt),
|
||||
CStyleFor {
|
||||
init: Box<Statement>,
|
||||
condition: Box<Expression>,
|
||||
update: Box<Statement>,
|
||||
body: Box<Statement>,
|
||||
},
|
||||
|
||||
Return(Option<Expression>),
|
||||
Break,
|
||||
@@ -138,14 +143,6 @@ pub struct StatementBranch {
|
||||
pub body: Box<Statement>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct ForStmt {
|
||||
pub init: (bool, String, Option<Expression>),
|
||||
pub condition: Option<Expression>,
|
||||
pub update: Option<Box<Statement>>,
|
||||
pub body: Box<Statement>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub enum Expression {
|
||||
Literal(Literal),
|
||||
|
||||
Reference in New Issue
Block a user