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

patch 8.1.1816: cannot use a user defined function as a method

Problem:    Cannot use a user defined function as a method.
Solution:   Pass the base as the first argument to the user defined function
            after "->". (partly by FUJIWARA Takuya)
This commit is contained in:
Bram Moolenaar
2019-08-04 23:04:39 +02:00
parent 7a4ea1df2f
commit fcfe1a9b89
6 changed files with 45 additions and 10 deletions

View File

@@ -4734,7 +4734,7 @@ eval7(
*arg = skipwhite(*arg);
/* Handle following '[', '(' and '.' for expr[expr], expr.name,
* expr(expr). */
* expr(expr), expr->name(expr) */
if (ret == OK)
ret = handle_subscript(arg, rettv, evaluate, TRUE);
@@ -4824,7 +4824,7 @@ eval_method(
// Locate the method name.
name = *arg;
for (len = 0; ASCII_ISALNUM(name[len]) || name[len] == '_'; ++len)
for (len = 0; eval_isnamec(name[len]); ++len)
;
if (len == 0)
{
@@ -4842,6 +4842,8 @@ eval_method(
}
*arg += len;
// TODO: if "name" is a function reference, resolve it.
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = evaluate;
funcexe.basetv = &base;