comparison src/userfunc.c @ 34769:d4fb6ea26ae4 v9.1.0261

patch 9.1.0261: Vim9: protected class and funcrefs accessible outside the class Commit: https://github.com/vim/vim/commit/3e33650b3a9939f6b942c1d1eccdb261ea17a647 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Apr 4 19:35:59 2024 +0200 patch 9.1.0261: Vim9: protected class and funcrefs accessible outside the class 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>
author Christian Brabandt <cb@256bit.org>
date Thu, 04 Apr 2024 19:45:10 +0200
parents 7de5ae6a0518
children af48c532bd88
comparison
equal deleted inserted replaced
34768:1faaf5fdbb06 34769:d4fb6ea26ae4
568 if (type == NULL) 568 if (type == NULL)
569 return FAIL; 569 return FAIL;
570 fp->uf_arg_types[i] = type; 570 fp->uf_arg_types[i] = type;
571 if (i < fp->uf_args.ga_len 571 if (i < fp->uf_args.ga_len
572 && (type->tt_type == VAR_FUNC 572 && (type->tt_type == VAR_FUNC
573 || type->tt_type == VAR_PARTIAL) 573 || type->tt_type == VAR_PARTIAL))
574 && var_wrong_func_name( 574 {
575 ((char_u **)fp->uf_args.ga_data)[i], TRUE)) 575 char_u *name = ((char_u **)fp->uf_args.ga_data)[i];
576 return FAIL; 576 if (obj_members != NULL && *name == '_')
577 // protected object method
578 name++;
579
580 if (var_wrong_func_name(name, TRUE))
581 return FAIL;
582 }
577 } 583 }
578 } 584 }
579 } 585 }
580 586
581 if (varargs) 587 if (varargs)