use serde::Serialize; use super::*; #[derive(Debug, Clone, Serialize, Default)] pub struct Block( pub Vec>, pub Option>, ); #[derive(Debug, Clone, Serialize)] pub enum Statement { Block(Block), VarDecl(VarDeclStmt), If { initial: StatementBranch, else_if: Vec, else_branch: Option>, }, While(StatementBranch), CStyleFor { init: Box, condition: Expression, update: Box, body: Box, }, For { mutable: bool, pattern: Pattern, iterator: Expression, body: Box, }, Match(Expression, Vec<(Vec, Block)>), Return(Option), Break, Continue, } #[derive(Debug, Clone, Serialize)] pub struct VarDecl { pub mutable: bool, pub name: Pattern, pub type_: Option, } #[derive(Debug, Clone, Serialize)] pub struct VarDeclStmt { pub decl: VarDecl, pub init: Option, } #[derive(Debug, Clone, Serialize)] pub struct StatementBranch { pub condition: Expression, pub body: Box, }