0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1296: calling an object method with arguments does not work

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)
This commit is contained in:
Bram Moolenaar
2023-02-10 15:52:25 +00:00
parent 6c41bedeed
commit 094cf9f4d5
3 changed files with 46 additions and 2 deletions

View File

@@ -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);