From 4545f289a991ec3888896aac0e0bcbfac9061e80 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 3 Jan 2020 19:58:56 +0100 Subject: Handle type args --- crates/ra_syntax/src/ast/make.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_syntax/src') 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 { fn path_from_text(text: &str) -> ast::Path { ast_from_text(text) } +pub fn path_with_type_arg_list(path: ast::Path, args: Option) -> ast::Path { + if let Some(args) = args { + ast_from_text(&format!("const X: {}{}", path.syntax(), args.syntax())) + } else { + path + } +} pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordField { return match expr { -- cgit v1.2.3