diff src/vim9execute.c @ 33456:4a62e78803db v9.0.1982

patch 9.0.1982: vim9: clean up from v9.0.1955 Commit: https://github.com/vim/vim/commit/64885645e76b301a6c34fe762c4e29c7a0f63881 Author: Ernie Rael <errael@raelity.com> Date: Wed Oct 4 20:16:22 2023 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Wed, 04 Oct 2023 20:30:03 +0200
parents 016d8f863230
children bff8ac203a22
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2180,7 +2180,8 @@ execute_storeindex(isn_T *iptr, ectx_T *
 	    {
 		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 @@ exec_instructions(ectx_T *ectx)
 
 	    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 @@ exec_instructions(ectx_T *ectx)
 		    // 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;
 		}