Mercurial > vim
comparison src/evalvars.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 | 016d8f863230 |
children | 3de472480e91 |
comparison
equal
deleted
inserted
replaced
33455:d1dddc5cb66e | 33456:4a62e78803db |
---|---|
2276 } | 2276 } |
2277 | 2277 |
2278 return ret; | 2278 return ret; |
2279 } | 2279 } |
2280 | 2280 |
2281 #ifdef LOG_LOCKVAR | |
2282 static char * | |
2283 vartype_tostring(vartype_T vartype) | |
2284 { | |
2285 return | |
2286 vartype == VAR_BOOL ? "v_number" | |
2287 : vartype == VAR_SPECIAL ? "v_number" | |
2288 : vartype == VAR_NUMBER ? "v_number" | |
2289 : vartype == VAR_FLOAT ? "v_float" | |
2290 : vartype == VAR_STRING ? "v_string" | |
2291 : vartype == VAR_BLOB ? "v_blob" | |
2292 : vartype == VAR_FUNC ? "v_string" | |
2293 : vartype == VAR_PARTIAL ? "v_partial" | |
2294 : vartype == VAR_LIST ? "v_list" | |
2295 : vartype == VAR_DICT ? "v_dict" | |
2296 : vartype == VAR_JOB ? "v_job" | |
2297 : vartype == VAR_CHANNEL ? "v_channel" | |
2298 : vartype == VAR_INSTR ? "v_instr" | |
2299 : vartype == VAR_CLASS ? "v_class" | |
2300 : vartype == VAR_OBJECT ? "v_object" | |
2301 : ""; | |
2302 } | |
2303 #endif | |
2304 | |
2305 /* | 2281 /* |
2306 * Lock or unlock an item. "deep" is nr of levels to go. | 2282 * Lock or unlock an item. "deep" is nr of levels to go. |
2307 * When "check_refcount" is TRUE do not lock a list or dict with a reference | 2283 * When "check_refcount" is TRUE do not lock a list or dict with a reference |
2308 * count larger than 1. | 2284 * count larger than 1. |
2309 */ | 2285 */ |
2317 blob_T *b; | 2293 blob_T *b; |
2318 hashitem_T *hi; | 2294 hashitem_T *hi; |
2319 int todo; | 2295 int todo; |
2320 | 2296 |
2321 #ifdef LOG_LOCKVAR | 2297 #ifdef LOG_LOCKVAR |
2322 ch_log(NULL, "LKVAR: item_lock(): type %s", vartype_tostring(tv->v_type)); | 2298 ch_log(NULL, "LKVAR: item_lock(): type %s", vartype_name(tv->v_type)); |
2323 #endif | 2299 #endif |
2324 | 2300 |
2325 if (recurse >= DICT_MAXNEST) | 2301 if (recurse >= DICT_MAXNEST) |
2326 { | 2302 { |
2327 emsg(_(e_variable_nested_too_deep_for_unlock)); | 2303 emsg(_(e_variable_nested_too_deep_for_unlock)); |