Vector'd expressions don't need to be boxed

This commit is contained in:
greg 2016-12-30 18:27:34 -08:00
parent 2d21de7cc3
commit 12fee6158c
2 changed files with 4 additions and 4 deletions

View File

@ -203,7 +203,7 @@ impl Evaluator {
(Call(name, args), None)
}
}
Conditional(_, _, _) => unimplemented!(),
Conditional(box test, then_block, else_block) => unimplemented!(),
}
}

View File

@ -45,7 +45,7 @@ pub enum Expression {
Variable(String),
BinExp(String, Box<Expression>, Box<Expression>),
Call(String, Vec<Expression>),
Conditional(Box<Expression>, Box<Vec<Expression>>, Option<Box<Vec<Expression>>>),
Conditional(Box<Expression>, Vec<Expression>, Option<Vec<Expression>>),
}
impl fmt::Display for ASTNode {
@ -349,13 +349,13 @@ impl Parser {
}
}
}
Some(Box::new(else_exprs))
Some(else_exprs)
} else {
None
};
expect!(self, Keyword(Kw::End));
Ok(Expression::Conditional(Box::new(test), Box::new(then_block), else_block))
Ok(Expression::Conditional(Box::new(test), then_block, else_block))
}
fn identifier_expr(&mut self) -> ParseResult<Expression> {