diff src/vim9.h @ 31843:ffa11e2757e7 v9.0.1254

patch 9.0.1254: calling a method on an interface does not work Commit: https://github.com/vim/vim/commit/d0200c8631582bbb16a9b585e2ca7adccc84ccdd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 28 15:19:40 2023 +0000 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 https://github.com/vim/vim/issues/11901)
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Jan 2023 16:30:04 +0100
parents 5ce5d78afcc9
children f1a5e67e9a1b
line wrap: on
line diff
--- a/src/vim9.h
+++ b/src/vim9.h
@@ -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;