vim-patch:8.1.1863: confusing error when using a builtin function as method

Problem:    Confusing error when using a builtin function as method while it
            does not support that.
Solution:   Add a specific error message.
9174639a82
This commit is contained in:
Sean Dewar
2021-08-07 15:10:28 +01:00
parent 287a77ef51
commit 98dfe4adc4
4 changed files with 11 additions and 1 deletions

View File

@@ -199,8 +199,10 @@ int call_internal_method(const char_u *const fname, const int argcount,
FUNC_ATTR_NONNULL_ALL
{
const VimLFuncDef *const fdef = find_internal_func((const char *)fname);
if (fdef == NULL || fdef->base_arg == BASE_NONE) {
if (fdef == NULL) {
return ERROR_UNKNOWN;
} else if (fdef->base_arg == BASE_NONE) {
return ERROR_NOTMETHOD;
} else if (argcount + 1 < fdef->min_argc) {
return ERROR_TOOFEW;
} else if (argcount + 1 > fdef->max_argc) {