0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1023: Vim9: redefining a function uses a new index every time

Problem:    Vim9: redefining a function uses a new index every time.
Solution:   When redefining a function clear the contents and re-use the
            index.
This commit is contained in:
Bram Moolenaar
2020-06-20 18:19:09 +02:00
parent 845e0ee594
commit 0cb5bcf583
8 changed files with 57 additions and 37 deletions

View File

@@ -1531,8 +1531,11 @@ struct blobvar_S
typedef struct funccall_S funccall_T;
// values used for "uf_dfunc_idx"
# define UF_NOT_COMPILED -2
# define UF_TO_BE_COMPILED -1
typedef enum {
UF_NOT_COMPILED,
UF_TO_BE_COMPILED,
UF_COMPILED
} def_status_T;
/*
* Structure to hold info for a user function.
@@ -1543,7 +1546,8 @@ typedef struct
int uf_flags; // FC_ flags
int uf_calls; // nr of active calls
int uf_cleared; // func_clear() was already called
int uf_dfunc_idx; // UF_NOT_COMPILED, UF_TO_BE_COMPILED or >= 0
def_status_T uf_def_status; // UF_NOT_COMPILED, UF_TO_BE_COMPILED, etc.
int uf_dfunc_idx; // only valid if uf_def_status is UF_COMPILED
garray_T uf_args; // arguments, including optional arguments
garray_T uf_def_args; // default argument expressions