summaryrefslogtreecommitdiffstats
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-04-04 19:35:59 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-04 19:35:59 +0200
commit3e33650b3a9939f6b942c1d1eccdb261ea17a647 (patch)
tree167bd86efdf040f2866be1547d356a612b5aa2ea /src/userfunc.c
parentbd28cae1f1c21c0e3743e3427c98bbd848fad237 (diff)
patch 9.1.0261: Vim9: protected class and funcrefs accessible outside the classv9.1.0261
Problem: Vim9: protected class and funcrefs accessible outside the class (Aliaksei Budavei) Solution: Check if class and object funcrefs are protected (Yegappan) closes: #14407 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index ce144a3978..9a307966b7 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -570,10 +570,16 @@ parse_argument_types(
fp->uf_arg_types[i] = type;
if (i < fp->uf_args.ga_len
&& (type->tt_type == VAR_FUNC
- || type->tt_type == VAR_PARTIAL)
- && var_wrong_func_name(
- ((char_u **)fp->uf_args.ga_data)[i], TRUE))
- return FAIL;
+ || type->tt_type == VAR_PARTIAL))
+ {
+ char_u *name = ((char_u **)fp->uf_args.ga_data)[i];
+ if (obj_members != NULL && *name == '_')
+ // protected object method
+ name++;
+
+ if (var_wrong_func_name(name, TRUE))
+ return FAIL;
+ }
}
}
}