0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1838: Vim9: Cannot modify class member vars from def function

Problem:  Vim9: Cannot modify class member vars from def function
Solution: Add support for modifying class member variables from a def
          function

closes: #12995

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
Yegappan Lakshmanan
2023-09-01 22:05:45 +02:00
committed by Christian Brabandt
parent b147d31489
commit 3775f777a6
7 changed files with 77 additions and 24 deletions

View File

@@ -1868,8 +1868,10 @@ compile_lhs(
class_T *cl = lhs->lhs_type->tt_class;
ocmember_T *m;
lhs->lhs_member_type = class_member_type(cl, after + 1,
lhs->lhs_end, &lhs->lhs_member_idx, &m);
lhs->lhs_member_type = class_member_type(cl,
lhs->lhs_type->tt_type == VAR_OBJECT,
after + 1, lhs->lhs_end,
&lhs->lhs_member_idx, &m);
if (lhs->lhs_member_idx < 0)
return FAIL;
@@ -2091,7 +2093,7 @@ compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx)
return FAIL;
class_T *cl = lhs->lhs_type->tt_class;
type_T *type = class_member_type(cl, dot + 1,
type_T *type = class_member_type(cl, TRUE, dot + 1,
lhs->lhs_end, &lhs->lhs_member_idx,
NULL);
if (lhs->lhs_member_idx < 0)