From 22f17a29cd0b0cc3107dc6cd1d96c62eee52a7d9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 21 Jun 2021 20:48:58 +0200 Subject: 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) --- src/userfunc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/userfunc.c') diff --git a/src/userfunc.c b/src/userfunc.c index 56b7df32f..e2e745c33 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -3595,7 +3595,8 @@ trans_function_name( 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); -- cgit v1.2.1