mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 14:28:18 +00:00
vim-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)
fcfe1a9b89
This commit is contained in:
@@ -4031,7 +4031,7 @@ static int 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((const char **)arg, rettv, evaluate, true);
|
||||
}
|
||||
@@ -4094,7 +4094,7 @@ static int eval_method(char_u **const arg, typval_T *const rettv,
|
||||
// Locate the method name.
|
||||
const char_u *const name = *arg;
|
||||
size_t len;
|
||||
for (len = 0; ASCII_ISALNUM(name[len]) || name[len] == '_'; len++) {
|
||||
for (len = 0; eval_isnamec(name[len]); len++) {
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
@@ -4113,6 +4113,8 @@ static int eval_method(char_u **const arg, typval_T *const rettv,
|
||||
}
|
||||
*arg += len;
|
||||
|
||||
// TODO(seandewar): if "name" is a function reference, resolve it.
|
||||
|
||||
typval_T base = *rettv;
|
||||
funcexe_T funcexe = FUNCEXE_INIT;
|
||||
funcexe.evaluate = evaluate;
|
||||
|
Reference in New Issue
Block a user