internal: pull_assignment_up uses mutable trees

This commit is contained in:
Aleksey Kladov 2021-05-08 23:09:36 +03:00
parent e603090961
commit 1755b57e1a
2 changed files with 72 additions and 70 deletions

View file

@ -275,6 +275,9 @@ pub fn expr_tuple(elements: impl IntoIterator<Item = ast::Expr>) -> ast::Expr {
let expr = elements.into_iter().format(", ");
expr_from_text(&format!("({})", expr))
}
pub fn expr_assignment(lhs: ast::Expr, rhs: ast::Expr) -> ast::Expr {
expr_from_text(&format!("{} = {}", lhs, rhs))
}
fn expr_from_text(text: &str) -> ast::Expr {
ast_from_text(&format!("const C: () = {};", text))
}