aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/make.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 04a5408fe..68d64a0cc 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -21,6 +21,13 @@ pub fn path_qualified(qual: ast::Path, name_ref: ast::NameRef) -> ast::Path {
21fn path_from_text(text: &str) -> ast::Path { 21fn path_from_text(text: &str) -> ast::Path {
22 ast_from_text(text) 22 ast_from_text(text)
23} 23}
24pub fn path_with_type_arg_list(path: ast::Path, args: Option<ast::TypeArgList>) -> ast::Path {
25 if let Some(args) = args {
26 ast_from_text(&format!("const X: {}{}", path.syntax(), args.syntax()))
27 } else {
28 path
29 }
30}
24 31
25pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField { 32pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField {
26 return match expr { 33 return match expr {