summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-21 20:48:58 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-21 20:48:58 +0200
commit22f17a29cd0b0cc3107dc6cd1d96c62eee52a7d9 (patch)
treeb4f07018a9d2d00cea788c9f39dade141d9c3010 /src/userfunc.c
parentcb54bc65625abad9a0af501acac5c70fba17e2cc (diff)
downloadvim-git-22f17a29cd0b0cc3107dc6cd1d96c62eee52a7d9.tar.gz
patch 8.2.3031: no error if a function name starts with an underscorev8.2.3031
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)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c3
1 files changed, 2 insertions, 1 deletions
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);