mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 11:13:43 +00:00
feat: add expr_for_loop to make in syntax
This commit is contained in:
parent
eea21490e0
commit
61fb16577b
@ -222,6 +222,9 @@ pub fn expr_if(
|
||||
};
|
||||
expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch))
|
||||
}
|
||||
pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> ast::Expr {
|
||||
expr_from_text(&format!("for {} in {} {}", pat, expr, block))
|
||||
}
|
||||
pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
|
||||
let token = token(op);
|
||||
expr_from_text(&format!("{}{}", token, expr))
|
||||
|
Loading…
Reference in New Issue
Block a user