diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-05-21 15:12:35 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:31:18 +0100 |
commit | 4042ae5a2bc4bbca608ebb196a3d54a78d6c100c (patch) | |
tree | 6da940b00ff0f62ef3a2ebdeb730726e0f69755b /src/nvim/eval/userfunc.h | |
parent | 60dd76c7e29e75dee641f93483eb6e5c2afb28e4 (diff) | |
download | rneovim-4042ae5a2bc4bbca608ebb196a3d54a78d6c100c.tar.gz rneovim-4042ae5a2bc4bbca608ebb196a3d54a78d6c100c.tar.bz2 rneovim-4042ae5a2bc4bbca608ebb196a3d54a78d6c100c.zip |
vim-patch:8.1.1800: function call functions have too many arguments
Problem: Function call functions have too many arguments.
Solution: Pass values in a funcexe_T struct.
https://github.com/vim/vim/commit/c6538bcc1cdd1fb83732f22fdc69bd9bb66f968a
Use FUNCEXE_INIT to initialize funcexe_T instances.
call_callback() and other Vim listener related stuff is N/A.
Diffstat (limited to 'src/nvim/eval/userfunc.h')
-rw-r--r-- | src/nvim/eval/userfunc.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/eval/userfunc.h b/src/nvim/eval/userfunc.h index e8ad0bf1da..9af35e0411 100644 --- a/src/nvim/eval/userfunc.h +++ b/src/nvim/eval/userfunc.h @@ -30,9 +30,32 @@ typedef enum { ERROR_DELETED, } FnameTransError; +/// Used in funcexe_T. Returns the new argcount. typedef int (*ArgvFunc)(int current_argcount, typval_T *argv, int argskip, int called_func_argcount); +/// Structure passed between functions dealing with function call execution. +typedef struct { + ArgvFunc argv_func; ///< when not NULL, can be used to fill in arguments only + ///< when the invoked function uses them + linenr_T firstline; ///< first line of range + linenr_T lastline; ///< last line of range + bool *doesrange; ///< [out] if not NULL: function handled range + bool evaluate; ///< actually evaluate expressions + partial_T *partial; ///< for extra arguments + dict_T *selfdict; ///< Dictionary for "self" +} funcexe_T; + +#define FUNCEXE_INIT (funcexe_T) { \ + .argv_func = NULL, \ + .firstline = 0, \ + .lastline = 0, \ + .doesrange = NULL, \ + .evaluate = false, \ + .partial = NULL, \ + .selfdict = NULL, \ +} + #define FUNCARG(fp, j) ((char_u **)(fp->uf_args.ga_data))[j] #define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j] |