Refactored for loops

This commit is contained in:
2026-05-05 16:30:41 +02:00
parent ec45c24854
commit 0d00ebcd2c
3 changed files with 32 additions and 37 deletions
+6 -9
View File
@@ -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),