0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1254: calling a method on an interface does not work

Problem:    Calling a method on an interface does not work.
Solution:   At runtime figure out what method to call. (closes #11901)
This commit is contained in:
Bram Moolenaar
2023-01-28 15:19:40 +00:00
parent 192e24d974
commit d0200c8631
10 changed files with 236 additions and 39 deletions

View File

@@ -112,6 +112,7 @@ typedef enum {
// function call
ISN_BCALL, // call builtin function isn_arg.bfunc
ISN_DCALL, // call def function isn_arg.dfunc
ISN_METHODCALL, // call method on interface, uses isn_arg.mfunc
ISN_UCALL, // call user function or funcref/partial isn_arg.ufunc
ISN_PCALL, // call partial, use isn_arg.pfunc
ISN_PCALL_END, // cleanup after ISN_PCALL with cpf_top set
@@ -234,6 +235,13 @@ typedef struct {
int cdf_argcount; // number of arguments on top of stack
} cdfunc_T;
// arguments to ISN_METHODCALL
typedef struct {
class_T *cmf_itf; // interface used
int cmf_idx; // index in "def_functions" for ISN_DCALL
int cmf_argcount; // number of arguments on top of stack
} cmfunc_T;
// arguments to ISN_PCALL
typedef struct {
int cpf_top; // when TRUE partial is above the arguments
@@ -517,6 +525,7 @@ struct isn_S {
trycont_T trycont;
cbfunc_T bfunc;
cdfunc_T dfunc;
cmfunc_T *mfunc;
cpfunc_T pfunc;
cufunc_T ufunc;
echo_T echo;