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

patch 9.1.0861: Vim9: no runtime check for object member access of any var

Problem:  Vim9: no runtime check for object member access of any var
          (after: 9.1.0850)
Solution: Add runtime type compatibility check for object member
          accessed using a any variable (Yegappan Lakshmanan).

closes: #16037

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-11-12 21:03:00 +01:00
committed by Christian Brabandt
parent 210c49bbe8
commit e798446362
3 changed files with 57 additions and 0 deletions

View File

@@ -2271,6 +2271,7 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
// Get the current function
ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data)
+ ectx->ec_dfunc_idx)->df_ufunc;
where_T where = WHERE_INIT;
// Check whether the member variable is writeable
if ((m->ocm_access != VIM_ACCESS_ALL) &&
@@ -2283,6 +2284,12 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
emsg_var_cl_define(msg, m->ocm_name, 0, cl);
status = FAIL;
}
// Fail if the variable is a const or final or the type
// is not compatible
else if (oc_var_check_ro(cl, m) ||
check_typval_type(m->ocm_type, tv, where)
== FAIL)
status = FAIL;
else
lidx = m_idx;
}