0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1909: Vim9: problem calling class method from other class

Problem:  Vim9: problem calling class method from other class
Solution: Fix this problem, fix readonly object access, update error
          messages.

Calling a class method from another method without the class name prefix
doesn't work properly.

A readonly object variable is modifiable outside the class using a
nested object assignment.

Remove the unused E1338 error message.

Update error messages.

closes: #13116

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
Yegappan Lakshmanan
2023-09-18 19:56:49 +02:00
committed by Christian Brabandt
parent d25021cf03
commit 00cd18222e
11 changed files with 317 additions and 159 deletions

View File

@@ -439,12 +439,6 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
if (m != NULL)
{
// Note: type->tt_type = VAR_CLASS
if ((cl->class_flags & CLASS_INTERFACE) != 0)
{
semsg(_(e_interface_static_direct_access_str),
cl->class_name, m->ocm_name);
return FAIL;
}
// A private class variable can be accessed only in the class where
// it is defined.
if (*name == '_' && cctx->ctx_ufunc->uf_class != cl)
@@ -1152,9 +1146,6 @@ compile_call(
// the class where the function is defined.
if (cctx->ctx_ufunc->uf_defclass == cl)
{
// The generate_CALL() function expects the class type at the
// top of the stack. So push the class type to the stack.
push_type_stack(cctx, &t_class);
res = generate_CALL(cctx, cl->class_class_functions[mi], NULL,
0, type, argcount);
}