fix hir for new block syntax

This commit is contained in:
Aleksey Kladov 2019-09-02 21:23:19 +03:00
parent dcf8e89503
commit 5e3f291195
14 changed files with 72 additions and 57 deletions

View file

@ -9,12 +9,12 @@ use crate::{
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ElseBranch {
Block(ast::Block),
Block(ast::BlockExpr),
IfExpr(ast::IfExpr),
}
impl ast::IfExpr {
pub fn then_branch(&self) -> Option<ast::Block> {
pub fn then_branch(&self) -> Option<ast::BlockExpr> {
self.blocks().nth(0)
}
pub fn else_branch(&self) -> Option<ElseBranch> {
@ -28,7 +28,7 @@ impl ast::IfExpr {
Some(res)
}
fn blocks(&self) -> AstChildren<ast::Block> {
fn blocks(&self) -> AstChildren<ast::BlockExpr> {
children(self)
}
}