aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-13 10:32:45 +0100
committerAleksey Kladov <[email protected]>2020-08-13 10:37:54 +0100
commitb0f03db51dc84aac56c807ecf4da8151c01e3c04 (patch)
treeaa14955e0ea4838e6def7a953e90c2348c1a7c4a /crates/syntax/src/ast
parent26b98b07aa0e4430bc872b28eadbc822cfee7b6e (diff)
Remove deprecated function
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/make.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index 3009faed7..d20c085aa 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -134,6 +134,9 @@ pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
134 let token = token(op); 134 let token = token(op);
135 expr_from_text(&format!("{}{}", token, expr)) 135 expr_from_text(&format!("{}{}", token, expr))
136} 136}
137pub fn expr_call(f: ast::Expr, arg_list: ast::ArgList) -> ast::Expr {
138 expr_from_text(&format!("{}{}", f, arg_list))
139}
137fn expr_from_text(text: &str) -> ast::Expr { 140fn expr_from_text(text: &str) -> ast::Expr {
138 ast_from_text(&format!("const C: () = {};", text)) 141 ast_from_text(&format!("const C: () = {};", text))
139} 142}
@@ -151,6 +154,10 @@ pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
151 } 154 }
152} 155}
153 156
157pub fn arg_list(args: impl IntoIterator<Item = ast::Expr>) -> ast::ArgList {
158 ast_from_text(&format!("fn main() {{ ()({}) }}", args.into_iter().format(", ")))
159}
160
154pub fn ident_pat(name: ast::Name) -> ast::IdentPat { 161pub fn ident_pat(name: ast::Name) -> ast::IdentPat {
155 return from_text(name.text()); 162 return from_text(name.text());
156 163