aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorLuiz Carlos Mourão Paes de Carvalho <[email protected]>2021-03-10 02:54:35 +0000
committerLuiz Carlos Mourão Paes de Carvalho <[email protected]>2021-03-10 02:54:35 +0000
commit61fb16577b3264a6ff64e33a89031db41218c840 (patch)
treeb51fdb9d9d83ff6cf6476a8bc7c803b7b93ab9f1 /crates/syntax
parenteea21490e06807960269844ab0f50b1873e1c78b (diff)
feat: add expr_for_loop to make in syntax
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/src/ast/make.rs3
1 files changed, 3 insertions, 0 deletions
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(
222 }; 222 };
223 expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch)) 223 expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch))
224} 224}
225pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> ast::Expr {
226 expr_from_text(&format!("for {} in {} {}", pat, expr, block))
227}
225pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr { 228pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
226 let token = token(op); 229 let token = token(op);
227 expr_from_text(&format!("{}{}", token, expr)) 230 expr_from_text(&format!("{}{}", token, expr))