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>
diff --git a/src/vim9instr.c b/src/vim9instr.c
index ba1aa0c..68fad25 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -136,7 +136,7 @@
* 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 @@
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 @@
* 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 @@
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);
}