0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1804: Vim9: no support for private object methods

Problem:  Vim9: no support for private object methods
Solution: Add support for private object/class methods

closes: #12920

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
Yegappan Lakshmanan
2023-08-27 19:18:23 +02:00
committed by Christian Brabandt
parent 03e44a1d70
commit cd7293bf6c
9 changed files with 691 additions and 5 deletions

View File

@@ -4369,10 +4369,14 @@ trans_function_name_ext(
lead += (int)STRLEN(sid_buf);
}
}
// The function name must start with an upper case letter (unless it is a
// Vim9 class new() function or a Vim9 class private method)
else if (!(flags & TFN_INT)
&& (builtin_function(lv.ll_name, len)
|| (vim9script && *lv.ll_name == '_'))
&& !((flags & TFN_IN_CLASS) && STRNCMP(lv.ll_name, "new", 3) == 0))
&& !((flags & TFN_IN_CLASS)
&& (STRNCMP(lv.ll_name, "new", 3) == 0
|| (*lv.ll_name == '_'))))
{
semsg(_(vim9script ? e_function_name_must_start_with_capital_str
: e_function_name_must_start_with_capital_or_s_str),