feat: for loop to while let assist

This commit is contained in:
Vishruth-Thimmaiah 2025-03-03 18:31:13 +05:30
parent 185f9deb45
commit 53f3e6fd5f
No known key found for this signature in database
GPG key ID: B89775C5BE008866
5 changed files with 467 additions and 2 deletions

View file

@ -623,6 +623,10 @@ pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> a
expr_from_text(&format!("for {pat} in {expr} {block}"))
}
pub fn expr_while_loop(condition: ast::Expr, block: ast::BlockExpr) -> ast::WhileExpr {
expr_from_text(&format!("while {condition} {block}"))
}
pub fn expr_loop(block: ast::BlockExpr) -> ast::Expr {
expr_from_text(&format!("loop {block}"))
}