mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.1.2012: Vim9: cannot initialize class member with protected var
Problem: Vim9: cannot initialize class member with protected var
Solution: Allow this to work if this happens within the same class
(Foxe Chen)
closes: #18949
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
5e577c7aa8
commit
cbcc5babba
+4
-1
@@ -2122,6 +2122,8 @@ early_ret:
|
||||
cl->class_object_type.tt_type = VAR_OBJECT;
|
||||
cl->class_object_type.tt_class = cl;
|
||||
|
||||
eap->class = cl;
|
||||
|
||||
// Add the class to the script-local variables.
|
||||
// TODO: handle other context, e.g. in a function
|
||||
// TODO: does uf_hash need to be cleared?
|
||||
@@ -3243,7 +3245,8 @@ class_object_index(
|
||||
if (fp != NULL)
|
||||
{
|
||||
// Protected methods are not accessible outside the class
|
||||
if (*name == '_')
|
||||
if (fp->uf_defclass != evalarg->eval_class
|
||||
&& *name == '_')
|
||||
{
|
||||
semsg(_(e_cannot_access_protected_method_str), fp->uf_name);
|
||||
goto done;
|
||||
|
||||
Reference in New Issue
Block a user