diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 6c198d061e..ea276459dc 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -1370,14 +1370,16 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett } /// There are two kinds of function names: -/// 1. ordinary names, function defined with :function -/// 2. numbered functions and lambdas +/// 1. ordinary names, function defined with :function; +/// can start with "123_" literally or with K_SPECIAL. +/// 2. Numbered functions and lambdas: "123" /// For the first we only count the name stored in func_hashtab as a reference, /// using function() does not count as a reference, because the function is /// looked up by name. static bool func_name_refcount(const char *name) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE { - return isdigit((uint8_t)(*name)) || *name == '<'; + return isdigit((uint8_t)(*name)) || (name[0] == '<' && name[1] == 'l'); } /// Check the argument count for user function "fp".