diff options
Diffstat (limited to 'crates/rebel-parse/src/ast/expr.rs')
-rw-r--r-- | crates/rebel-parse/src/ast/expr.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/rebel-parse/src/ast/expr.rs b/crates/rebel-parse/src/ast/expr.rs index 9ac4a38..2e8d750 100644 --- a/crates/rebel-parse/src/ast/expr.rs +++ b/crates/rebel-parse/src/ast/expr.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -use super::{DestrPat, Ident, Path, ValidationError}; +use super::{Block, DestrPat, Ident, Path, ValidationError}; use crate::token; pub use token::StrKind; @@ -33,6 +33,7 @@ pub enum Expr<'a> { base: Box<Expr<'a>>, field: Ident<'a>, }, + Block(Block<'a>), Paren(Box<Expr<'a>>), Path(Path<'a>), Literal(Literal<'a>), @@ -122,6 +123,12 @@ impl<'a> Expr<'a> { base.validate() } Expr::Field { base, field: _ } => base.validate(), + Expr::Block(block) => { + for stmt in &block.0 { + stmt.validate()?; + } + Ok(()) + } Expr::Paren(expr) => expr.validate(), Expr::Path(_) => Ok(()), Expr::Literal(lit) => lit.validate(), |