diff options
author | Ernie Rael <errael@raelity.com> | 2023-09-29 19:53:55 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-29 19:53:55 +0200 |
commit | ee865f37acab6cac2cee6a171d60e1b365f852b0 (patch) | |
tree | 37522d42aa745a1b355a71efc979651e7500f9b2 /src/errors.h | |
parent | 112431f21762bdcb3ee4ce2d7d8f91da07f3bf71 (diff) |
patch 9.0.1955: Vim9: lockvar issues with objects/classesv9.0.1955
Problem: Vim9: lockvar issues with objects/classes
Solution: fix `get_lhs()` object/class access and avoid `SEGV`,
make error messages more accurate.
- `get_lval()` detects/returns object/class access
- `compile_lock_unlock()` generate code for bare static and obj_arg access
- `do_lock_var()` check lval for `ll_object`/`ll_class` and fail if so.
Details:
- Add `ll_object`/`ll_class`/`ll_oi` to `lval_T`.
- Add `lockunlock_T` to `isn_T` for `is_arg` to specify handling of `lval_root` in `get_lval()`.
- In `get_lval()`, fill in `ll_object`/`ll_class`/`ll_oi` as needed; when no `[idx] or .key`, check lval_root on the way out.
- In `do_lock_var()` check for `ll_object`/`ll_class`; also bullet proof ll_dict case
and give `Dictionay required` if problem. (not needed to avoid lockvar crash anymore)
- In `compile_lock_unlock()` compile for the class variable and func arg cases.
closes: #13174
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
Diffstat (limited to 'src/errors.h')
-rw-r--r-- | src/errors.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/errors.h b/src/errors.h index 19779ebd09..6b4416963a 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3534,8 +3534,12 @@ EXTERN char e_missing_name_after_implements[] INIT(= N_("E1389: Missing name after implements")); EXTERN char e_cannot_use_an_object_variable_except_with_the_new_method_str[] INIT(= N_("E1390: Cannot use an object variable \"this.%s\" except with the \"new\" method")); +EXTERN char e_cannot_lock_object_variable_str[] + INIT(= N_("E1391: Cannot (un)lock variable \"%s\" in class \"%s\"")); +EXTERN char e_cannot_lock_class_variable_str[] + INIT(= N_("E1392: Cannot (un)lock class variable \"%s\" in class \"%s\"")); #endif -// E1391 - E1499 unused (reserved for Vim9 class support) +// E1393 - E1499 unused (reserved for Vim9 class support) EXTERN char e_cannot_mix_positional_and_non_positional_str[] INIT(= N_("E1500: Cannot mix positional and non-positional arguments: %s")); EXTERN char e_fmt_arg_nr_unused_str[] |