0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.0.1045: in a class object members cannot be initialized

Problem:    In a class object members cannot be initialized.
Solution:   Support initializing object members. Make "dissassemble" work on
            an object method.
This commit is contained in:
Bram Moolenaar
2022-12-10 18:42:12 +00:00
parent 6c87bbb4e4
commit 7ce7daf6cd
13 changed files with 280 additions and 74 deletions

View File

@@ -4047,6 +4047,12 @@ trans_function_name(
name = vim_strsave(lv.ll_tv->vval.v_string);
*pp = end;
}
else if (lv.ll_tv->v_type == VAR_CLASS
&& lv.ll_tv->vval.v_class != NULL)
{
name = vim_strsave(lv.ll_tv->vval.v_class->class_name);
*pp = end;
}
else if (lv.ll_tv->v_type == VAR_PARTIAL
&& lv.ll_tv->vval.v_partial != NULL)
{
@@ -5240,8 +5246,17 @@ find_func_by_name(char_u *name, compiletype_T *compile_type)
fname = vim_strnsave(name, arg - name);
}
else
{
// First try finding a method in a class, find_func_by_name() will give
// an error if the function is not found.
ufunc = find_class_func(&arg);
if (ufunc != NULL)
return ufunc;
fname = trans_function_name(&arg, &is_global, FALSE,
TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL, NULL);
TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD | TFN_NO_DECL,
NULL, NULL, NULL);
}
if (fname == NULL)
{
semsg(_(e_invalid_argument_str), name);