diff src/vim9expr.c @ 33498:bff8ac203a22 v9.0.1999

patch 9.0.1999: Vim9: some error messages can be improved Commit: https://github.com/vim/vim/commit/e6c9aa5e6a88d539a412a9b5526f41ea101aa185 Author: Ernie Rael <errael@raelity.com> Date: Fri Oct 6 19:55:52 2023 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Fri, 06 Oct 2023 20:00:06 +0200
parents 4a62e78803db
children 86dbcbb94fdb
line wrap: on
line diff
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -407,8 +407,8 @@ compile_class_object_index(cctx_T *cctx,
 	{
 	    if (*name == '_' && !inside_class(cctx, cl))
 	    {
-		semsg(_(e_cannot_access_private_variable_str), m->ocm_name,
-							    cl->class_name);
+		emsg_var_cl_define(e_cannot_access_private_variable_str,
+							m->ocm_name, 0, cl);
 		return FAIL;
 	    }
 
@@ -443,8 +443,8 @@ compile_class_object_index(cctx_T *cctx,
 	    // it is defined.
 	    if (*name == '_' && cctx->ctx_ufunc->uf_class != cl)
 	    {
-		semsg(_(e_cannot_access_private_variable_str), m->ocm_name,
-							    cl->class_name);
+		emsg_var_cl_define(e_cannot_access_private_variable_str,
+							m->ocm_name, 0, cl);
 		return FAIL;
 	    }