diff src/vim9instr.c @ 33173:9efd99a717c1 v9.0.1867

patch 9.0.1867: Vim9: access to interface statics possible Commit: https://github.com/vim/vim/commit/18143d3111b2122c7a94ca51085a60b3073cb139 Author: Ernie Rael <errael@raelity.com> Date: Mon Sep 4 22:30:41 2023 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Mon, 04 Sep 2023 22:45:04 +0200
parents 669898c9a6c3
children 108d890d887f
line wrap: on
line diff
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -136,7 +136,7 @@ generate_CONSTRUCT(cctx_T *cctx, class_T
  * 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, in
     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, in
  * 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, cl
     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);
 }