summaryrefslogtreecommitdiff
path: root/src/vim9expr.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-24 15:07:04 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-24 15:07:04 +0000
commit62a6923470827acbf124df41134ae6df52f334e6 (patch)
tree52f1ea2c62400809c2a75075da2d33466a9fe62f /src/vim9expr.c
parentb149d2279673aa89ab5e35958d05cc4bcc70f82a (diff)
downloadvim-git-62a6923470827acbf124df41134ae6df52f334e6.tar.gz
patch 9.0.1240: cannot access a private object member in a lambdav9.0.1240
Problem: Cannot access a private object member in a lambda defined inside the class. Solution: Go up the context stack to find the class. (closes #11866)
Diffstat (limited to 'src/vim9expr.c')
-rw-r--r--src/vim9expr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 95c6d7db0..1034f64b0 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -357,7 +357,7 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
ocmember_T *m = &cl->class_obj_members[i];
if (STRNCMP(name, m->ocm_name, len) == 0 && m->ocm_name[len] == NUL)
{
- if (*name == '_' && cctx->ctx_ufunc->uf_class != cl)
+ if (*name == '_' && !inside_class(cctx, cl))
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
return FAIL;