add make::expr_op

This commit is contained in:
Yoshua Wuyts 2021-08-10 19:48:32 +02:00
parent c943057038
commit 20c3b20db3
2 changed files with 39 additions and 0 deletions

View file

@ -264,6 +264,9 @@ pub fn expr_path(path: ast::Path) -> ast::Expr {
pub fn expr_continue() -> ast::Expr {
expr_from_text("continue")
}
pub fn expr_op(op: ast::BinOp, lhs: ast::Expr, rhs: ast::Expr) -> ast::Expr {
expr_from_text(&format!("{} {} {}", lhs, op, rhs))
}
pub fn expr_break(expr: Option<ast::Expr>) -> ast::Expr {
match expr {
Some(expr) => expr_from_text(&format!("break {}", expr)),