Handle type args

This commit is contained in:
Florian Diebold 2020-01-03 19:58:56 +01:00
parent 5cb1f71322
commit 4545f289a9
2 changed files with 19 additions and 9 deletions

View file

@ -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::TypeArgList>) -> 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::Expr>) -> ast::RecordField {
return match expr {