patch 9.0.1211: storing value in interface member does not always work
Problem: Storing value in interface member does not always work.
Solution: Convert the index on the interface to the index on the object.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 77945fb..c89c37a 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2178,7 +2178,22 @@
if (isn == NULL)
return FAIL;
- isn->isn_arg.vartype = dest_type;
+ isn->isn_arg.storeindex.si_vartype = dest_type;
+ isn->isn_arg.storeindex.si_class = NULL;
+
+ if (dest_type == VAR_OBJECT)
+ {
+ class_T *cl = (class_T *)lhs->lhs_type->tt_member;
+
+ if (cl->class_flags & CLASS_INTERFACE)
+ {
+ // "this.value": load "this" object and get the value
+ // at index for an object or class member get the type
+ // of the member
+ isn->isn_arg.storeindex.si_class = cl;
+ ++cl->class_refcount;
+ }
+ }
}
}
else if (range)