patch 8.2.3031: no error if a function name starts with an underscore
Problem: No error if a function name starts with an underscore. (Naohiro
Ono)
Solution: In Vim9 script disallow a function name starting with an
underscore, as is mentioned in the help. (closes #8414)
diff --git a/src/userfunc.c b/src/userfunc.c
index 56b7df3..e2e745c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3595,7 +3595,8 @@
lead += (int)STRLEN(sid_buf);
}
}
- else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
+ else if (!(flags & TFN_INT) && (builtin_function(lv.ll_name, len)
+ || (in_vim9script() && *lv.ll_name == '_')))
{
semsg(_("E128: Function name must start with a capital or \"s:\": %s"),
start);