generate method assist

This commit is contained in:
mahdi-frms 2021-08-05 14:00:08 +04:30
parent b2b24255c8
commit 9ca73528ee
3 changed files with 154 additions and 0 deletions

View file

@ -531,6 +531,10 @@ pub fn param(pat: ast::Pat, ty: ast::Type) -> ast::Param {
ast_from_text(&format!("fn f({}: {}) {{ }}", pat, ty))
}
pub fn self_param() -> ast::SelfParam {
ast_from_text(&format!("fn f(&self) {{ }}"))
}
pub fn ret_type(ty: ast::Type) -> ast::RetType {
ast_from_text(&format!("fn f() -> {} {{ }}", ty))
}