wip enum record/tuple generation

This commit is contained in:
Yoshua Wuyts 2021-08-10 22:08:14 +02:00
parent 65ce87cad8
commit 1cf7af7032
3 changed files with 78 additions and 8 deletions

View file

@ -160,6 +160,18 @@ pub enum ElseBranch {
IfExpr(ast::IfExpr),
}
impl From<ast::BlockExpr> for ElseBranch {
fn from(block_expr: ast::BlockExpr) -> Self {
Self::Block(block_expr)
}
}
impl From<ast::IfExpr> for ElseBranch {
fn from(if_expr: ast::IfExpr) -> Self {
Self::IfExpr(if_expr)
}
}
impl ast::IfExpr {
pub fn then_branch(&self) -> Option<ast::BlockExpr> {
self.blocks().next()