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/eval.c b/src/eval.c
index 7cfe68c..4e1dbde 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1180,6 +1180,14 @@
return NULL;
lp->ll_tv = &v->di_tv;
}
+ if (vim9script && writing && lp->ll_tv->v_type == VAR_CLASS
+ && (lp->ll_tv->vval.v_class->class_flags & CLASS_INTERFACE) != 0)
+ {
+ if (!quiet)
+ semsg(_(e_interface_static_direct_access_str),
+ lp->ll_tv->vval.v_class->class_name, lp->ll_name);
+ return NULL;
+ }
if (vim9script && (flags & GLV_NO_DECL) == 0)
{