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>
diff --git a/src/vim9compile.c b/src/vim9compile.c
index cc5a302..62528e9 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1868,8 +1868,10 @@
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 @@
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)