summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-parse/src/ast.rs')
-rw-r--r--crates/rebel-parse/src/ast.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/crates/rebel-parse/src/ast.rs b/crates/rebel-parse/src/ast.rs
index 490c2f1..8be015b 100644
--- a/crates/rebel-parse/src/ast.rs
+++ b/crates/rebel-parse/src/ast.rs
@@ -49,8 +49,13 @@ impl<'a> Body<'a> {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BodyStmt<'a> {
- Assign { dest: TypedExpr<'a>, expr: Expr<'a> },
- Expr { expr: Expr<'a> },
+ Assign {
+ dest: Box<TypedExpr<'a>>,
+ expr: Box<Expr<'a>>,
+ },
+ Expr {
+ expr: Box<Expr<'a>>,
+ },
Empty,
}
@@ -61,17 +66,20 @@ impl<'a> BodyStmt<'a> {
swapped: bool,
expr: Expr<'a>,
) -> Self {
- match op {
+ let expr = match op {
Some(op) => {
let dest_expr = dest.expr.clone();
- let expr = if swapped {
+ if swapped {
Expr::binary(expr, op, dest_expr)
} else {
Expr::binary(dest_expr, op, expr)
- };
- BodyStmt::Assign { dest, expr }
+ }
}
- None => BodyStmt::Assign { dest, expr },
+ None => expr,
+ };
+ BodyStmt::Assign {
+ dest: Box::new(dest),
+ expr: Box::new(expr),
}
}