Mercurial > vim
comparison src/eval.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 | 0081ca43bee9 |
children | f72004b37b2b |
comparison
equal
deleted
inserted
replaced
33497:5bb56da92a88 | 33498:bff8ac203a22 |
---|---|
1103 ch_log(NULL, "LKVAR: get_lval_check_access(), cl_exec %p, cl %p, %c", | 1103 ch_log(NULL, "LKVAR: get_lval_check_access(), cl_exec %p, cl %p, %c", |
1104 (void*)cl_exec, (void*)cl, *p); | 1104 (void*)cl_exec, (void*)cl, *p); |
1105 #endif | 1105 #endif |
1106 if (cl_exec == NULL || cl_exec != cl) | 1106 if (cl_exec == NULL || cl_exec != cl) |
1107 { | 1107 { |
1108 char *msg = NULL; | |
1108 switch (om->ocm_access) | 1109 switch (om->ocm_access) |
1109 { | 1110 { |
1110 case VIM_ACCESS_PRIVATE: | 1111 case VIM_ACCESS_PRIVATE: |
1111 semsg(_(e_cannot_access_private_variable_str), | 1112 msg = e_cannot_access_private_variable_str; |
1112 om->ocm_name, cl->class_name); | 1113 break; |
1113 return FAIL; | |
1114 case VIM_ACCESS_READ: | 1114 case VIM_ACCESS_READ: |
1115 // If [idx] or .key following, read only OK. | 1115 // If [idx] or .key following, read only OK. |
1116 if (*p == '[' || *p == '.') | 1116 if (*p == '[' || *p == '.') |
1117 break; | 1117 break; |
1118 if ((flags & GLV_READ_ONLY) == 0) | 1118 if ((flags & GLV_READ_ONLY) == 0) |
1119 { | 1119 msg = e_variable_is_not_writable_str; |
1120 semsg(_(e_variable_is_not_writable_str), | |
1121 om->ocm_name, cl->class_name); | |
1122 return FAIL; | |
1123 } | |
1124 break; | 1120 break; |
1125 case VIM_ACCESS_ALL: | 1121 case VIM_ACCESS_ALL: |
1126 break; | 1122 break; |
1127 } | 1123 } |
1124 if (msg != NULL) | |
1125 { | |
1126 emsg_var_cl_define(msg, om->ocm_name, 0, cl); | |
1127 return FAIL; | |
1128 } | |
1129 | |
1128 } | 1130 } |
1129 return OK; | 1131 return OK; |
1130 } | 1132 } |
1131 | 1133 |
1132 /* | 1134 /* |