0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 9.0.1867: Vim9: access to interface statics possible

Problem:  Vim9: access to interface statics possible
Solution: Prevent direct access to interface statics

closes: #13007

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
Ernie Rael
2023-09-04 22:30:41 +02:00
committed by Christian Brabandt
parent dccc29c228
commit 18143d3111
12 changed files with 332 additions and 25 deletions

View File

@@ -136,7 +136,7 @@ generate_CONSTRUCT(cctx_T *cctx, class_T *cl)
* index.
*/
int
generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type, int is_static)
{
RETURN_OK_IF_SKIP(cctx);
@@ -145,7 +145,9 @@ generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
if (isn == NULL)
return FAIL;
isn->isn_arg.number = idx;
isn->isn_arg.classmember.cm_class = NULL;
isn->isn_arg.classmember.cm_idx = idx;
isn->isn_arg.classmember.cm_static = is_static;
return push_type_stack2(cctx, type, &t_any);
}
@@ -154,7 +156,8 @@ generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
* by index.
*/
int
generate_GET_ITF_MEMBER(cctx_T *cctx, class_T *itf, int idx, type_T *type)
generate_GET_ITF_MEMBER(cctx_T *cctx, class_T *itf, int idx, type_T *type,
int is_static)
{
RETURN_OK_IF_SKIP(cctx);
@@ -166,6 +169,7 @@ generate_GET_ITF_MEMBER(cctx_T *cctx, class_T *itf, int idx, type_T *type)
isn->isn_arg.classmember.cm_class = itf;
++itf->class_refcount;
isn->isn_arg.classmember.cm_idx = idx;
isn->isn_arg.classmember.cm_static = is_static;
return push_type_stack2(cctx, type, &t_any);
}