Add quickfix to add a struct field

This commit is contained in:
Timo Freiberg 2020-06-09 23:11:16 +02:00
parent b56ad148db
commit f5ac313000
5 changed files with 134 additions and 5 deletions

View file

@ -75,6 +75,10 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordF
}
}
pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef {
ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty))
}
pub fn block_expr(
stmts: impl IntoIterator<Item = ast::Stmt>,
tail_expr: Option<ast::Expr>,