0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.1.1105: Vim9: no support for protected new() method

Problem:  Vim9: no support for protected new() method
Solution: support the protected "_new()" object method
          (Yegappan Lakshmanan)

closes: #16604

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-02-11 22:07:05 +01:00
committed by Christian Brabandt
parent f0ed0e6f63
commit 7e89800988
5 changed files with 48 additions and 4 deletions

View File

@@ -2375,7 +2375,8 @@ early_ret:
{
exarg_T ea;
garray_T lines_to_free;
int is_new = STRNCMP(p, "new", 3) == 0;
int is_new = STRNCMP(p, "new", 3) == 0
|| STRNCMP(p, "_new", 4) == 0;
if (has_public)
{
@@ -2601,7 +2602,8 @@ early_ret:
for (int i = 0; i < classfunctions.ga_len; ++i)
{
class_func = ((ufunc_T **)classfunctions.ga_data)[i];
if (STRCMP(class_func->uf_name, "new") == 0)
if (STRCMP(class_func->uf_name, "new") == 0
|| STRCMP(class_func->uf_name, "_new") == 0)
{
have_new = TRUE;
break;