comparison src/vim9class.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 508dfc0c261c
children baa62f464436
comparison
equal deleted inserted replaced
33455:d1dddc5cb66e 33456:4a62e78803db
2170 if (m == NULL) 2170 if (m == NULL)
2171 return FAIL; 2171 return FAIL;
2172 2172
2173 if (*name == '_') 2173 if (*name == '_')
2174 { 2174 {
2175 semsg(_(e_cannot_access_private_variable_str), m->ocm_name); 2175 semsg(_(e_cannot_access_private_variable_str), m->ocm_name,
2176 cl->class_name);
2176 return FAIL; 2177 return FAIL;
2177 } 2178 }
2178 2179
2179 // The object only contains a pointer to the class, the member 2180 // The object only contains a pointer to the class, the member
2180 // values array follows right after that. 2181 // values array follows right after that.
2329 return FAIL; 2330 return FAIL;
2330 } 2331 }
2331 2332
2332 if (*name == '_') 2333 if (*name == '_')
2333 { 2334 {
2334 semsg(_(e_cannot_access_private_variable_str), m->ocm_name); 2335 semsg(_(e_cannot_access_private_variable_str), m->ocm_name,
2336 cl->class_name);
2335 return FAIL; 2337 return FAIL;
2336 } 2338 }
2337 2339
2338 typval_T *tv = &cl->class_members_tv[m_idx]; 2340 typval_T *tv = &cl->class_members_tv[m_idx];
2339 copy_tv(tv, rettv); 2341 copy_tv(tv, rettv);