From 61fb16577b3264a6ff64e33a89031db41218c840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Carlos=20Mour=C3=A3o=20Paes=20de=20Carvalho?= Date: Tue, 9 Mar 2021 23:54:35 -0300 Subject: feat: add expr_for_loop to make in syntax --- crates/syntax/src/ast/make.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 70ba8adb4..05a6b0b25 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -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)) -- cgit v1.2.3