mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.2016: Vim9: assignment operators don't work for class vars
Problem: Vim9: assignment operators don't work for class vars Solution: implement it closes: #13306 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
committed by
Christian Brabandt
parent
4c8da025ef
commit
1ea428883f
@@ -1770,7 +1770,7 @@ compile_lhs(
|
||||
lhs->lhs_dest = dest_class_member;
|
||||
lhs->lhs_class = cctx->ctx_ufunc->uf_class;
|
||||
lhs->lhs_type =
|
||||
class_member_type_by_idx(cctx->ctx_ufunc->uf_class,
|
||||
oc_member_type_by_idx(cctx->ctx_ufunc->uf_class,
|
||||
FALSE, lhs->lhs_classmember_idx);
|
||||
}
|
||||
else
|
||||
@@ -2254,7 +2254,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, TRUE, dot + 1,
|
||||
type_T *type = oc_member_type(cl, TRUE, dot + 1,
|
||||
lhs->lhs_end, &lhs->lhs_member_idx);
|
||||
if (lhs->lhs_member_idx < 0)
|
||||
return FAIL;
|
||||
@@ -2275,6 +2275,22 @@ compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx)
|
||||
return generate_GET_ITF_MEMBER(cctx, cl, lhs->lhs_member_idx, type);
|
||||
return generate_GET_OBJ_MEMBER(cctx, lhs->lhs_member_idx, type);
|
||||
}
|
||||
else if (lhs->lhs_type->tt_type == VAR_CLASS)
|
||||
{
|
||||
// "<classname>.value": load class variable "classname.value"
|
||||
char_u *dot = vim_strchr(var_start, '.');
|
||||
if (dot == NULL)
|
||||
return FAIL;
|
||||
|
||||
class_T *cl = lhs->lhs_type->tt_class;
|
||||
ocmember_T *m = class_member_lookup(cl, dot + 1,
|
||||
lhs->lhs_end - dot - 1,
|
||||
&lhs->lhs_member_idx);
|
||||
if (m == NULL)
|
||||
return FAIL;
|
||||
|
||||
return generate_CLASSMEMBER(cctx, TRUE, cl, lhs->lhs_member_idx);
|
||||
}
|
||||
|
||||
compile_load_lhs(lhs, var_start, NULL, cctx);
|
||||
|
||||
|
Reference in New Issue
Block a user