use super::{Expr, Name, Type};
use crate::source::token::Span;
#[derive(Debug, Clone, PartialEq)]
pub struct Block {
pub stmts: Vec<Stmt>,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Binding {
One(Name),
Tuple(Vec<Name>),
}
#[derive(Debug, Clone, PartialEq)]
pub enum Stmt {
Local {
ty: Option<Type>,
binding: Binding,
value: Option<Expr>,
mutable: bool,
},
Assign {
place: Expr,
op: Option<super::BinOp>,
value: Expr,
},
If {
cond: Expr,
then: Box<Stmt>,
otherwise: Option<Box<Stmt>>,
},
Foreach {
ty: Option<Type>,
binding: Binding,
iter: Expr,
body: Box<Stmt>,
},
For {
init: Option<Box<Stmt>>,
cond: Option<Expr>,
step: Option<Box<Stmt>>,
body: Box<Stmt>,
},
While {
cond: Expr,
body: Box<Stmt>,
},
DoWhile {
body: Box<Stmt>,
cond: Expr,
},
Block(Block),
Break(Span),
Continue(Span),
Return(Option<Expr>, Span),
Skip(Option<Expr>, Span),
Expr(Expr),
Value(Expr),
}