@@ -55,6 +55,29 @@ impl GenericParamsOwnerEdit for ast::Fn {
55
55
}
56
56
}
57
57
58
+ impl ast:: Fn {
59
+ pub fn syntax_editor_get_or_create_generic_param_list (
60
+ & self ,
61
+ editor : & mut SyntaxEditor ,
62
+ ) -> ast:: GenericParamList {
63
+ match self . generic_param_list ( ) {
64
+ Some ( it) => it,
65
+ None => {
66
+ let position = if let Some ( name) = self . name ( ) {
67
+ crate :: syntax_editor:: Position :: after ( name. syntax )
68
+ } else if let Some ( fn_token) = self . fn_token ( ) {
69
+ crate :: syntax_editor:: Position :: after ( fn_token)
70
+ } else if let Some ( param_list) = self . param_list ( ) {
71
+ crate :: syntax_editor:: Position :: before ( param_list. syntax )
72
+ } else {
73
+ crate :: syntax_editor:: Position :: last_child_of ( self . syntax ( ) )
74
+ } ;
75
+ syntax_editor_create_generic_param_list ( editor, position)
76
+ }
77
+ }
78
+ }
79
+ }
80
+
58
81
impl GenericParamsOwnerEdit for ast:: Impl {
59
82
fn get_or_create_generic_param_list ( & self ) -> ast:: GenericParamList {
60
83
match self . generic_param_list ( ) {
@@ -191,6 +214,15 @@ fn create_generic_param_list(position: Position) -> ast::GenericParamList {
191
214
gpl
192
215
}
193
216
217
+ fn syntax_editor_create_generic_param_list (
218
+ editor : & mut SyntaxEditor ,
219
+ position : crate :: syntax_editor:: Position ,
220
+ ) -> ast:: GenericParamList {
221
+ let gpl = make:: generic_param_list ( empty ( ) ) . clone_for_update ( ) ;
222
+ editor. insert ( position, gpl. syntax ( ) ) ;
223
+ gpl
224
+ }
225
+
194
226
pub trait AttrsOwnerEdit : ast:: HasAttrs {
195
227
fn remove_attrs_and_docs ( & self ) {
196
228
remove_attrs_and_docs ( self . syntax ( ) ) ;
0 commit comments