mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.0.1201: assignment with operator doesn't work in object method
Problem: Assignment with operator doesn't work in object method. Solution: Handle loading the object member. (closes #11820) Add a few more tests.
This commit is contained in:
@@ -2044,6 +2044,21 @@ compile_load_lhs(
|
||||
int
|
||||
compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx)
|
||||
{
|
||||
if (lhs->lhs_type->tt_type == VAR_OBJECT)
|
||||
{
|
||||
// "this.value": load "this" object and get the value at index
|
||||
// for an object or class member get the type of the member
|
||||
class_T *cl = (class_T *)lhs->lhs_type->tt_member;
|
||||
type_T *type = class_member_type(cl, var_start + 5,
|
||||
lhs->lhs_end, &lhs->lhs_member_idx);
|
||||
if (lhs->lhs_member_idx < 0)
|
||||
return FAIL;
|
||||
|
||||
if (generate_LOAD(cctx, ISN_LOAD, 0, NULL, lhs->lhs_type) == FAIL)
|
||||
return FAIL;
|
||||
return generate_GET_OBJ_MEMBER(cctx, lhs->lhs_member_idx, type);
|
||||
}
|
||||
|
||||
compile_load_lhs(lhs, var_start, NULL, cctx);
|
||||
|
||||
if (lhs->lhs_has_index)
|
||||
|
Reference in New Issue
Block a user