mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.0.1999: Vim9: some error messages can be improved
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>
This commit is contained in:
committed by
Christian Brabandt
parent
85f4521808
commit
e6c9aa5e6a
18
src/eval.c
18
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user