summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorErnie Rael <errael@raelity.com>2023-10-06 19:55:52 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-06 19:55:52 +0200
commite6c9aa5e6a88d539a412a9b5526f41ea101aa185 (patch)
tree2ba9d1d12205cbe879b917b1e78b3df7bc43f4f9 /src/eval.c
parent85f4521808dd9a587c00f9a2927e84217721cfca (diff)
patch 9.0.1999: Vim9: some error messages can be improvedv9.0.1999
Problem: Vim9: some error messages can be improved Solution: Mention the defining class for variable access error message closes: #13272 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: Ernie Rael <errael@raelity.com>
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c
index a9f7112f2d..d9fbec234c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1105,26 +1105,28 @@ get_lval_check_access(
#endif
if (cl_exec == NULL || cl_exec != cl)
{
+ char *msg = NULL;
switch (om->ocm_access)
{
case VIM_ACCESS_PRIVATE:
- semsg(_(e_cannot_access_private_variable_str),
- om->ocm_name, cl->class_name);
- return FAIL;
+ msg = e_cannot_access_private_variable_str;
+ break;
case VIM_ACCESS_READ:
// If [idx] or .key following, read only OK.
if (*p == '[' || *p == '.')
break;
if ((flags & GLV_READ_ONLY) == 0)
- {
- semsg(_(e_variable_is_not_writable_str),
- om->ocm_name, cl->class_name);
- return FAIL;
- }
+ msg = e_variable_is_not_writable_str;
break;
case VIM_ACCESS_ALL:
break;
}
+ if (msg != NULL)
+ {
+ emsg_var_cl_define(msg, om->ocm_name, 0, cl);
+ return FAIL;
+ }
+
}
return OK;
}