summaryrefslogtreecommitdiffstats
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-02-10 15:52:25 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-10 15:52:25 +0000
commit094cf9f4d588b1c29f4e35c4ccbf8505510569fb (patch)
tree27fcdc38750a9f3bda0c420ac82fa1ca89e7d950 /src/vim9execute.c
parent6c41bedeed2a1f98fb9c55ff85634138782ad92a (diff)
patch 9.0.1296: calling an object method with arguments does not workv9.0.1296
Problem: Calling an object method with arguments does not work. (Ernie Rael) Solution: Take the argument count into account when looking up the object. (closes #11911)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 605cfb25c8..49042a4afe 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -4143,8 +4143,10 @@ exec_instructions(ectx_T *ectx)
// call a method on an interface
case ISN_METHODCALL:
{
+ cmfunc_T *mfunc = iptr->isn_arg.mfunc;
+
SOURCING_LNUM = iptr->isn_lnum;
- tv = STACK_TV_BOT(-1);
+ tv = STACK_TV_BOT(-1 - mfunc->cmf_argcount);
if (tv->v_type != VAR_OBJECT)
{
object_required_error(tv);
@@ -4154,7 +4156,6 @@ exec_instructions(ectx_T *ectx)
class_T *cl = obj->obj_class;
// convert the interface index to the object index
- cmfunc_T *mfunc = iptr->isn_arg.mfunc;
int idx = object_index_from_itf_index(mfunc->cmf_itf,
TRUE, mfunc->cmf_idx, cl);