Mercurial > vim
comparison src/vim9compile.c @ 33738:2172872dfbcd v9.0.2096
patch 9.0.2096: Vim9: confusing usage of private
Commit: https://github.com/vim/vim/commit/03042a2753e3e6ac971045a8ce256d709214710e
Author: Ernie Rael <errael@raelity.com>
Date: Sat Nov 11 08:53:32 2023 +0100
patch 9.0.2096: Vim9: confusing usage of private
Problem: Vim9: confusing usage of private
Solution: clarify and use protected keyword instead
[vim9class] document `_` as protected instead of private
fixes #13504
closes: #13520
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 11 Nov 2023 09:00:06 +0100 |
parents | 2fc593290679 |
children | a259471e74fe |
comparison
equal
deleted
inserted
replaced
33737:f065fe97d07a | 33738:2172872dfbcd |
---|---|
1615 if ((m->ocm_access != VIM_ACCESS_ALL) && | 1615 if ((m->ocm_access != VIM_ACCESS_ALL) && |
1616 ((is_object && !inside_class(cctx, cl)) | 1616 ((is_object && !inside_class(cctx, cl)) |
1617 || (!is_object && cctx->ctx_ufunc->uf_class != cl))) | 1617 || (!is_object && cctx->ctx_ufunc->uf_class != cl))) |
1618 { | 1618 { |
1619 char *msg = (m->ocm_access == VIM_ACCESS_PRIVATE) | 1619 char *msg = (m->ocm_access == VIM_ACCESS_PRIVATE) |
1620 ? e_cannot_access_private_variable_str | 1620 ? e_cannot_access_protected_variable_str |
1621 : e_variable_is_not_writable_str; | 1621 : e_variable_is_not_writable_str; |
1622 emsg_var_cl_define(msg, m->ocm_name, 0, cl); | 1622 emsg_var_cl_define(msg, m->ocm_name, 0, cl); |
1623 return FALSE; | 1623 return FALSE; |
1624 } | 1624 } |
1625 | 1625 |
2032 if ((m->ocm_access != VIM_ACCESS_ALL) && | 2032 if ((m->ocm_access != VIM_ACCESS_ALL) && |
2033 ((is_object && !inside_class(cctx, cl)) | 2033 ((is_object && !inside_class(cctx, cl)) |
2034 || (!is_object && cctx->ctx_ufunc->uf_class != cl))) | 2034 || (!is_object && cctx->ctx_ufunc->uf_class != cl))) |
2035 { | 2035 { |
2036 char *msg = (m->ocm_access == VIM_ACCESS_PRIVATE) | 2036 char *msg = (m->ocm_access == VIM_ACCESS_PRIVATE) |
2037 ? e_cannot_access_private_variable_str | 2037 ? e_cannot_access_protected_variable_str |
2038 : e_variable_is_not_writable_str; | 2038 : e_variable_is_not_writable_str; |
2039 emsg_var_cl_define(msg, m->ocm_name, 0, cl); | 2039 emsg_var_cl_define(msg, m->ocm_name, 0, cl); |
2040 return FAIL; | 2040 return FAIL; |
2041 } | 2041 } |
2042 | 2042 |
2043 lhs->lhs_member_type = m->ocm_type; | 2043 lhs->lhs_member_type = m->ocm_type; |