0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.3829: no error when setting a func option to script-local function

Problem:    No error when setting a func option to a script-local function.
Solution:   Give an error if the name starts with "s:". (closes #9358)
This commit is contained in:
Bram Moolenaar
2021-12-16 19:45:47 +00:00
parent 8103527da7
commit 94c785d235
4 changed files with 22 additions and 0 deletions

View File

@@ -7199,6 +7199,9 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED)
return OK;
}
if (STRNCMP(optval, "s:", 2) == 0 && !SCRIPT_ID_VALID(current_sctx.sc_sid))
return FAIL;
if (*optval == '{' || (in_vim9script() && *optval == '(')
|| (STRNCMP(optval, "function(", 9) == 0)
|| (STRNCMP(optval, "funcref(", 8) == 0))