diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-06 18:31:27 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:35:20 +0100 |
commit | 8d1ca37d1f413b08f5ff9ceb502fa35ffd6034c7 (patch) | |
tree | 52e2caf3aad28d7e18983a8556a321a6101e8a49 /src/nvim/eval.c | |
parent | aa2dc8b7b4e0e86c9102f2df6b670317c5693657 (diff) | |
download | rneovim-8d1ca37d1f413b08f5ff9ceb502fa35ffd6034c7.tar.gz rneovim-8d1ca37d1f413b08f5ff9ceb502fa35ffd6034c7.tar.bz2 rneovim-8d1ca37d1f413b08f5ff9ceb502fa35ffd6034c7.zip |
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)
https://github.com/vim/vim/commit/fcfe1a9b8950b8b211ab3b24d84b17c6847ea43f
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 39e8686580..021a9a75b8 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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; |