comparison src/vim9type.c @ 24996:0136c6ee1961 v8.2.3035

patch 8.2.3035: Vim9: crash when calling :def function with partial Commit: https://github.com/vim/vim/commit/831bdf8622fdfce7f02d48f847005e3909a055a8 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 22 19:32:17 2021 +0200 patch 8.2.3035: Vim9: crash when calling :def function with partial Problem: Vim9: crash when calling :def function with partial and return type is not set. Solution: When the return type is not set handle like the return type is unknown. (closes #8422)
author Bram Moolenaar <Bram@vim.org>
date Tue, 22 Jun 2021 19:45:03 +0200
parents e61a2085c89b
children b825efff9790
comparison
equal deleted inserted replaced
24995:541097a70f43 24996:0136c6ee1961
169 type_T *type = get_type_ptr(type_gap); 169 type_T *type = get_type_ptr(type_gap);
170 170
171 if (type == NULL) 171 if (type == NULL)
172 return &t_any; 172 return &t_any;
173 type->tt_type = VAR_FUNC; 173 type->tt_type = VAR_FUNC;
174 type->tt_member = ret_type; 174 type->tt_member = ret_type == NULL ? &t_unknown : ret_type;
175 type->tt_argcount = argcount; 175 type->tt_argcount = argcount;
176 type->tt_args = NULL; 176 type->tt_args = NULL;
177 return type; 177 return type;
178 } 178 }
179 179
186 get_func_type(type_T *ret_type, int argcount, garray_T *type_gap) 186 get_func_type(type_T *ret_type, int argcount, garray_T *type_gap)
187 { 187 {
188 // recognize commonly used types 188 // recognize commonly used types
189 if (argcount <= 0) 189 if (argcount <= 0)
190 { 190 {
191 if (ret_type == &t_unknown) 191 if (ret_type == &t_unknown || ret_type == NULL)
192 { 192 {
193 // (argcount == 0) is not possible 193 // (argcount == 0) is not possible
194 return &t_func_unknown; 194 return &t_func_unknown;
195 } 195 }
196 if (ret_type == &t_void) 196 if (ret_type == &t_void)