Mercurial > vim
diff src/vim9.h @ 21558:1c4d4aa22b37 v8.2.1329
patch 8.2.1329: Vim9: cannot define global function inside :def function
Commit: https://github.com/vim/vim/commit/38ddf333f6b2806b0ea2dd052ee1cd50dd7f4525
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 31 22:05:04 2020 +0200
patch 8.2.1329: Vim9: cannot define global function inside :def function
Problem: Vim9: cannot define global function inside :def function.
Solution: Assign to global variable instead of local. (closes https://github.com/vim/vim/issues/6584)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 31 Jul 2020 22:15:04 +0200 |
parents | 5cb6e676defd |
children | fcf978444298 |
line wrap: on
line diff
--- a/src/vim9.h +++ b/src/vim9.h @@ -79,6 +79,7 @@ typedef enum { ISN_PCALL_END, // cleanup after ISN_PCALL with cpf_top set ISN_RETURN, // return, result is on top of stack ISN_FUNCREF, // push a function ref to dfunc isn_arg.funcref + ISN_NEWFUNC, // create a global function from a lambda function // expression operations ISN_JUMP, // jump if condition is matched isn_arg.jump @@ -237,6 +238,12 @@ typedef struct { int fr_var_idx; // variable to store partial } funcref_T; +// arguments to ISN_NEWFUNC +typedef struct { + char_u *nf_lambda; // name of the lambda already defined + char_u *nf_global; // name of the global function to be created +} newfunc_T; + // arguments to ISN_CHECKLEN typedef struct { int cl_min_len; // minimum length @@ -281,6 +288,7 @@ struct isn_S { script_T script; unlet_T unlet; funcref_T funcref; + newfunc_T newfunc; checklen_T checklen; shuffle_T shuffle; } isn_arg;