patch 9.0.1982: vim9: clean up from v9.0.1955
Problem: vim9: clean up from v9.0.1955
Solution: Fix a few remaining issues, improve error message
- Use `cl_exec`, the executing class, to check permissions in `get_lval()`.
- Handle lockvar of script variable from class.
- Add 'in class "Xxx"' to e_cannot_access_private_variable_str.
closes: #13222
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 209f86f..a899745 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2180,7 +2180,8 @@
{
if (*member == '_')
{
- semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
+ semsg(_(e_cannot_access_private_variable_str),
+ m->ocm_name, cl->class_name);
status = FAIL;
}
@@ -4178,9 +4179,7 @@
case ISN_LOCKUNLOCK:
{
- // TODO: could put lval_root info in struct
- typval_T *lval_root_save = lval_root;
- int lval_root_is_arg_save = lval_root_is_arg;
+ lval_root_T *lval_root_save = lval_root;
int res;
#ifdef LOG_LOCKVAR
ch_log(NULL, "LKVAR: execute INS_LOCKUNLOCK isn_arg %s",
@@ -4190,12 +4189,14 @@
// Stack has the local variable, argument the whole :lock
// or :unlock command, like ISN_EXEC.
--ectx->ec_stack.ga_len;
- lval_root = STACK_TV_BOT(0);
- lval_root_is_arg = iptr->isn_arg.lockunlock.is_arg;
- res = exec_command(iptr, iptr->isn_arg.lockunlock.string);
- clear_tv(lval_root);
+ lval_root_T root = { STACK_TV_BOT(0),
+ iptr->isn_arg.lockunlock.lu_cl_exec,
+ iptr->isn_arg.lockunlock.lu_is_arg };
+ lval_root = &root;
+ res = exec_command(iptr,
+ iptr->isn_arg.lockunlock.lu_string);
+ clear_tv(root.lr_tv);
lval_root = lval_root_save;
- lval_root_is_arg = lval_root_is_arg_save;
if (res == FAIL)
goto on_error;
}