0
0
mirror of https://github.com/vim/vim.git synced 2025-10-23 08:44:20 -04:00

patch 9.1.0984: exception handling can be improved

Problem:  exception handling can be improved
Solution: add v:stacktrace and getstacktrace()

closes: #16360

Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: ichizok <gclient.gaap@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
ichizok
2025-01-02 18:06:00 +01:00
committed by Christian Brabandt
parent fd771613b3
commit 663d18d610
17 changed files with 285 additions and 21 deletions

View File

@@ -531,6 +531,29 @@ dict_add_callback(dict_T *d, char *key, callback_T *cb)
return OK;
}
/*
* Add a function entry to dictionary "d".
* Returns FAIL when out of memory and when key already exists.
*/
int
dict_add_func(dict_T *d, char *key, ufunc_T *fp)
{
dictitem_T *item;
item = dictitem_alloc((char_u *)key);
if (item == NULL)
return FAIL;
item->di_tv.v_type = VAR_FUNC;
item->di_tv.vval.v_string = vim_strsave(fp->uf_name);
if (dict_add(d, item) == FAIL)
{
dictitem_free(item);
return FAIL;
}
func_ref(item->di_tv.vval.v_string);
return OK;
}
/*
* Initializes "iter" for iterating over dictionary items with
* dict_iterate_next().